From a54b3f7fad0970b8cfd601e4b1324890e3fce397 Mon Sep 17 00:00:00 2001 From: Marek Ossowski Date: Thu, 21 Aug 2025 22:57:45 +0200 Subject: [PATCH] Storing 640 pixel wide bitmap and stretching later --- app/src/main/java/xdsopl/robot36/HFFax.java | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/xdsopl/robot36/HFFax.java b/app/src/main/java/xdsopl/robot36/HFFax.java index f6f43eb..30de43a 100644 --- a/app/src/main/java/xdsopl/robot36/HFFax.java +++ b/app/src/main/java/xdsopl/robot36/HFFax.java @@ -38,7 +38,7 @@ public class HFFax extends BaseMode { @Override public int getWidth() { - return 1808; + return 640; } @Override @@ -67,24 +67,24 @@ public class HFFax extends BaseMode { @Override public Bitmap postProcessScopeImage(Bitmap bmp) { + int realWidth = 1808; + int realHorizontalShift = horizontalShift * realWidth / getWidth(); + Bitmap bmpMutable = Bitmap.createBitmap(realWidth, bmp.getHeight(), Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bmpMutable); if (horizontalShift > 0) { - Bitmap bmpMutable = Bitmap.createBitmap(getWidth(), bmp.getHeight(), Bitmap.Config.ARGB_8888); - Canvas canvas = new Canvas(bmpMutable); canvas.drawBitmap( bmp, new Rect(0, 0, horizontalShift, bmp.getHeight()), - new Rect(getWidth() - horizontalShift, 0, getWidth(), bmp.getHeight()), + new Rect(realWidth - realHorizontalShift, 0, realWidth, bmp.getHeight()), null); - canvas.drawBitmap( - bmp, - new Rect(horizontalShift, 0, getWidth(), bmp.getHeight()), - new Rect(0, 1, getWidth() - horizontalShift, bmp.getHeight() + 1), - null); - - return bmpMutable; } + canvas.drawBitmap( + bmp, + new Rect(horizontalShift, 0, getWidth(), bmp.getHeight()), + new Rect(0, 1, realWidth - realHorizontalShift, bmp.getHeight() + 1), + null); - return bmp; + return bmpMutable; } @Override