react-native-rectangle-doc-scanner 7.4.0 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -629,15 +629,27 @@ class CameraController(
|
|
|
629
629
|
}
|
|
630
630
|
|
|
631
631
|
private fun rotateAndMirror(bitmap: Bitmap, rotationDegrees: Int, mirror: Boolean): Bitmap {
|
|
632
|
+
Log.d(TAG, "[ROTATE_MIRROR] rotationDegrees=$rotationDegrees mirror=$mirror bitmap=${bitmap.width}x${bitmap.height}")
|
|
632
633
|
if (rotationDegrees == 0 && !mirror) {
|
|
633
634
|
return bitmap
|
|
634
635
|
}
|
|
635
636
|
val matrix = Matrix()
|
|
636
|
-
|
|
637
|
+
|
|
638
|
+
// For back camera, we need to mirror horizontally to fix the flip issue
|
|
639
|
+
// The camera sensor output is already mirrored, so we need to flip it back
|
|
640
|
+
if (!mirror) {
|
|
641
|
+
// Back camera: flip horizontally
|
|
642
|
+
matrix.postScale(-1f, 1f, bitmap.width / 2f, bitmap.height / 2f)
|
|
643
|
+
Log.d(TAG, "[ROTATE_MIRROR] Applied horizontal flip for back camera")
|
|
644
|
+
} else {
|
|
645
|
+
// Front camera: keep mirror
|
|
637
646
|
matrix.postScale(-1f, 1f, bitmap.width / 2f, bitmap.height / 2f)
|
|
647
|
+
Log.d(TAG, "[ROTATE_MIRROR] Applied horizontal flip for front camera")
|
|
638
648
|
}
|
|
649
|
+
|
|
639
650
|
if (rotationDegrees != 0) {
|
|
640
651
|
matrix.postRotate(rotationDegrees.toFloat(), bitmap.width / 2f, bitmap.height / 2f)
|
|
652
|
+
Log.d(TAG, "[ROTATE_MIRROR] Applied rotation: $rotationDegrees degrees")
|
|
641
653
|
}
|
|
642
654
|
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true)
|
|
643
655
|
}
|