Skip to content

Commit ce119d3

Browse files
mvanbeusekomadsonpleal
authored andcommitted
[camera] Copy zoom settings from preview to final capture builder on Android (flutter#3413)
* Copy SCALER_CROP_REGION from preview to final capture builder * Update version number * Fix formatting
1 parent 4737ca9 commit ce119d3

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

packages/camera/camera/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.0+4
2+
3+
* Make sure the configured zoom scale is copied over to the final capture builder on Android. Fixes the issue where the preview is zoomed but the final picture is not.
4+
15
## 0.7.0+3
26

37
* Fixes crash with using inner camera on some Android devices.

packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,15 @@ private void runPictureCapture() {
543543
final CaptureRequest.Builder captureBuilder =
544544
cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
545545
captureBuilder.addTarget(pictureImageReader.getSurface());
546+
captureBuilder.set(
547+
CaptureRequest.SCALER_CROP_REGION,
548+
captureRequestBuilder.get(CaptureRequest.SCALER_CROP_REGION));
546549
captureBuilder.set(
547550
CaptureRequest.JPEG_ORIENTATION,
548551
lockedCaptureOrientation == null
549552
? deviceOrientationListener.getMediaOrientation()
550553
: deviceOrientationListener.getMediaOrientation(lockedCaptureOrientation));
554+
551555
switch (flashMode) {
552556
case off:
553557
captureBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON);

packages/camera/camera/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera
22
description: A Flutter plugin for getting information about and controlling the
33
camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video,
44
and streaming image buffers to dart.
5-
version: 0.7.0+3
5+
version: 0.7.0+4
66
homepage: https://github.com/flutter/plugins/tree/master/packages/camera/camera
77

88
dependencies:

0 commit comments

Comments
 (0)