react-native-rectangle-doc-scanner 10.40.0 → 10.41.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.
|
@@ -186,6 +186,7 @@ class CameraController(
|
|
|
186
186
|
imageAnalyzer = ImageAnalysis.Builder()
|
|
187
187
|
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
|
|
188
188
|
.setTargetAspectRatio(AspectRatio.RATIO_4_3)
|
|
189
|
+
.setTargetResolution(android.util.Size(1280, 960))
|
|
189
190
|
.setTargetRotation(targetRotation) // Match preview rotation
|
|
190
191
|
.build()
|
|
191
192
|
.also {
|
|
@@ -495,6 +496,7 @@ class CameraController(
|
|
|
495
496
|
return
|
|
496
497
|
}
|
|
497
498
|
|
|
499
|
+
val sensorOrientation = getCameraSensorOrientation()
|
|
498
500
|
val displayRotationDegrees = when (textureView.display?.rotation ?: Surface.ROTATION_0) {
|
|
499
501
|
Surface.ROTATION_0 -> 0
|
|
500
502
|
Surface.ROTATION_90 -> 90
|
|
@@ -506,16 +508,33 @@ class CameraController(
|
|
|
506
508
|
Log.d(
|
|
507
509
|
TAG,
|
|
508
510
|
"[TRANSFORM] View: ${viewWidth}x${viewHeight}, Buffer: ${bufferWidth}x${bufferHeight}, " +
|
|
509
|
-
"Display: ${displayRotationDegrees}°"
|
|
511
|
+
"Sensor: ${sensorOrientation}°, Display: ${displayRotationDegrees}°"
|
|
510
512
|
)
|
|
511
513
|
|
|
512
514
|
val matrix = android.graphics.Matrix()
|
|
513
515
|
val centerX = viewWidth / 2f
|
|
514
516
|
val centerY = viewHeight / 2f
|
|
515
517
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
518
|
+
val rotationDegrees = if (sensorOrientation == 0) {
|
|
519
|
+
displayRotationDegrees.toFloat()
|
|
520
|
+
} else {
|
|
521
|
+
sensorOrientation.toFloat()
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (rotationDegrees != 0f) {
|
|
525
|
+
matrix.postRotate(rotationDegrees, centerX, centerY)
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
val rotatedBufferWidth = if (rotationDegrees == 90f || rotationDegrees == 270f) {
|
|
529
|
+
bufferHeight
|
|
530
|
+
} else {
|
|
531
|
+
bufferWidth
|
|
532
|
+
}
|
|
533
|
+
val rotatedBufferHeight = if (rotationDegrees == 90f || rotationDegrees == 270f) {
|
|
534
|
+
bufferWidth
|
|
535
|
+
} else {
|
|
536
|
+
bufferHeight
|
|
537
|
+
}
|
|
519
538
|
|
|
520
539
|
// Scale to fill the view while maintaining aspect ratio (center-crop).
|
|
521
540
|
val scaleX = viewWidth.toFloat() / rotatedBufferWidth.toFloat()
|
package/package.json
CHANGED