From 73a6a0436b35fa7d1ec7ef425e0cd40e0e80209f Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Wed, 8 May 2024 12:08:43 +0200 Subject: [PATCH] store entire scope buffer --- app/src/main/java/xdsopl/robot36/MainActivity.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/xdsopl/robot36/MainActivity.java b/app/src/main/java/xdsopl/robot36/MainActivity.java index 7ca3172..880654a 100644 --- a/app/src/main/java/xdsopl/robot36/MainActivity.java +++ b/app/src/main/java/xdsopl/robot36/MainActivity.java @@ -430,7 +430,7 @@ public class MainActivity extends AppCompatActivity { public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_store_scope) { - storeBitmap(scopeBitmap); + storeScope(); return true; } if (id == R.id.action_auto_mode) { @@ -576,6 +576,14 @@ public class MainActivity extends AppCompatActivity { return super.onOptionsItemSelected(item); } + private void storeScope() { + int width = scopeBuffer.width; + int height = scopeBuffer.height / 2; + int stride = scopeBuffer.width; + int offset = stride * scopeBuffer.line; + storeBitmap(Bitmap.createBitmap(scopeBuffer.pixels, offset, stride, width, height, Bitmap.Config.ARGB_8888)); + } + private void createScope(Configuration config) { int width = scopeBuffer.width; int height = scopeBuffer.height / 2;