Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
c9f7e21
Added platform interface methods for setting auto exposure.
BeMacized Dec 24, 2020
532b22f
Added platform interface methods for setting auto exposure.
BeMacized Dec 24, 2020
1844b24
Remove workspace files
BeMacized Dec 24, 2020
fd8dd40
Added auto exposure implementations for Android and iOS
BeMacized Dec 24, 2020
92966de
Added platform interface methods for managing auto focus.
BeMacized Dec 25, 2020
deea6a0
Formatted code
BeMacized Dec 25, 2020
42a4517
Export focus mode
BeMacized Dec 25, 2020
b595f93
Add Android and iOS implementations (WIP)
BeMacized Dec 25, 2020
bdeed1d
Update platform interface for changes to autofocus methods
BeMacized Dec 25, 2020
e63b537
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 25, 2020
4e405b0
WIP
BeMacized Dec 25, 2020
798d458
Revert "Update platform interface for changes to autofocus methods"
BeMacized Dec 25, 2020
7a6a21c
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 25, 2020
68d3e74
Finish android implementation
BeMacized Dec 25, 2020
d830704
Fix iOS implementation
BeMacized Dec 25, 2020
2b98bdd
iOS fix for setting the exposure point
BeMacized Dec 25, 2020
b886e55
Merge branch 'feature/camera_exposure_auto' into feature/camera_focus…
BeMacized Dec 25, 2020
10f3d61
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 25, 2020
06f436f
Removed unnecessary check
BeMacized Dec 25, 2020
e19c2a5
Merge branch 'feature/camera_exposure_auto' into feature/camera_focus…
BeMacized Dec 25, 2020
73f6798
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 25, 2020
df1c09b
Updated changelog and pubspec.yaml
BeMacized Dec 25, 2020
ff45da4
Updated changelog and pubspec.yaml
BeMacized Dec 25, 2020
a6e47e8
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 25, 2020
95b4795
Merge branch 'master' into feature/camera_focus_auto_platform_interface
BeMacized Dec 25, 2020
6d9f9ca
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 25, 2020
70804a0
Merge branch 'master' into feature/camera_exposure_auto
BeMacized Dec 29, 2020
5f1a730
Merge branch 'feature/camera_exposure_auto' into feature/camera_focus…
BeMacized Dec 29, 2020
58d9411
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 29, 2020
7b4445d
Merge branch 'master' into feature/camera_exposure_auto
BeMacized Dec 29, 2020
67b37f2
Merge branch 'feature/camera_exposure_auto' into feature/camera_focus…
BeMacized Dec 29, 2020
0842f2c
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 29, 2020
14c6ab6
Update platform interface dependency
BeMacized Dec 29, 2020
a52f690
Implement PR feedback
BeMacized Dec 29, 2020
1e6ed87
Merge branch 'master' into feature/camera_exposure_auto
BeMacized Dec 29, 2020
9a88bca
Restore test
BeMacized Dec 29, 2020
0b748ef
Merge branch 'feature/camera_exposure_auto' into feature/camera_focus…
BeMacized Dec 30, 2020
171fe0b
Revert test change
BeMacized Dec 30, 2020
6fb50d6
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 30, 2020
930d901
Update camera pubspec
BeMacized Dec 30, 2020
5ebbca5
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 30, 2020
60a1137
Update platform interface to prevent breaking changes with current ma…
BeMacized Dec 30, 2020
525d58c
Merge branch 'feature/camera_focus_auto_platform_interface' into feat…
BeMacized Dec 30, 2020
b0149e9
Update test to match platform interface updates
BeMacized Dec 30, 2020
e6367bd
Code format
BeMacized Dec 30, 2020
9473843
Merged with master
mvanbeusekom Jan 6, 2021
4ebae73
Merged with master
mvanbeusekom Jan 6, 2021
23fe0db
Merged with master
mvanbeusekom Jan 7, 2021
971b4e6
Fixed compilation error
mvanbeusekom Jan 7, 2021
6d174fb
Fix formatting
mvanbeusekom Jan 7, 2021
50dcdce
Update version number
mvanbeusekom Jan 7, 2021
5d8c235
Add missing license headers to java source files.
BeMacized Jan 11, 2021
9500a74
Merge branch 'master' into feature/camera_focus_auto
BeMacized Jan 11, 2021
0ba1c90
Update platform interface dependency
BeMacized Jan 11, 2021
bc97fb9
Merge branch 'feature/camera_focus_auto' of github.com:Baseflow/flutt…
BeMacized Jan 11, 2021
a6f4442
Change fps range determination
BeMacized Jan 11, 2021
1a0ced8
Update with master branch
mvanbeusekom Jan 11, 2021
bcacd4b
Fix analysis warnings
mvanbeusekom Jan 11, 2021
c11c46f
Update version number
mvanbeusekom Jan 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added platform interface methods for setting auto exposure.
  • Loading branch information
BeMacized committed Dec 24, 2020
commit 532b22ff7b71a3eba0fd8eb1dd0911ecb00621dd
1 change: 1 addition & 0 deletions packages/camera/camera/example/ios/Flutter/.last_build_id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5490cb309144ac61a67edda5c46bb18b
18 changes: 18 additions & 0 deletions packages/camera/camera/example/ios/Flutter/Flutter.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# NOTE: This podspec is NOT to be published. It is only used as a local source!
#

Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'High-performance, high-fidelity mobile apps.'
s.description = <<-DESC
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
DESC
s.homepage = 'https://flutter.io'
s.license = { :type => 'MIT' }
s.author = { 'Flutter Dev Team' => '[email protected]' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.vendored_frameworks = 'Flutter.framework'
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 4 additions & 0 deletions packages/camera/camera_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.5

- Added interface to support automatic exposure.

## 1.0.4

- Added the torch option to the FlashMode enum, which when implemented indicates the flash light should be turned on continuously.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import '../../camera_platform_interface.dart';

/// Generic Event coming from the native side of Camera.
///
/// All [CameraEvent]s contain the `cameraId` that originated the event. This
Expand Down Expand Up @@ -45,6 +47,12 @@ class CameraInitializedEvent extends CameraEvent {
/// The height of the preview in pixels.
final double previewHeight;

/// The default exposure mode
final ExposureMode exposureMode;

/// Whether setting exposure points is supported.
final bool exposurePointSupported;

/// Build a CameraInitialized event triggered from the camera represented by
/// `cameraId`.
///
Expand All @@ -54,13 +62,17 @@ class CameraInitializedEvent extends CameraEvent {
int cameraId,
this.previewWidth,
this.previewHeight,
this.exposureMode,
this.exposurePointSupported,
) : super(cameraId);

/// Converts the supplied [Map] to an instance of the [CameraInitializedEvent]
/// class.
CameraInitializedEvent.fromJson(Map<String, dynamic> json)
: previewWidth = json['previewWidth'],
previewHeight = json['previewHeight'],
exposureMode = deserializeExposureMode(json['exposureMode']),
exposurePointSupported = json['exposurePointSupported'],
super(json['cameraId']);

/// Converts the [CameraInitializedEvent] instance into a [Map] instance that
Expand All @@ -69,6 +81,8 @@ class CameraInitializedEvent extends CameraEvent {
'cameraId': cameraId,
'previewWidth': previewWidth,
'previewHeight': previewHeight,
'exposureMode': serializeExposureMode(exposureMode),
'exposurePointSupported': exposurePointSupported,
};

@override
Expand All @@ -78,11 +92,17 @@ class CameraInitializedEvent extends CameraEvent {
other is CameraInitializedEvent &&
runtimeType == other.runtimeType &&
previewWidth == other.previewWidth &&
previewHeight == other.previewHeight;
previewHeight == other.previewHeight &&
exposureMode == other.exposureMode &&
exposurePointSupported == other.exposurePointSupported;

@override
int get hashCode =>
super.hashCode ^ previewWidth.hashCode ^ previewHeight.hashCode;
super.hashCode ^
previewWidth.hashCode ^
previewHeight.hashCode ^
exposureMode.hashCode ^
exposurePointSupported.hashCode;
}

/// An event fired when the resolution preset of the camera has changed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

import 'dart:async';
import 'dart:math';

import 'package:camera_platform_interface/camera_platform_interface.dart';
import 'package:camera_platform_interface/src/utils/utils.dart';
Expand Down Expand Up @@ -185,6 +186,62 @@ class MethodChannelCamera extends CameraPlatform {
},
);

@override
Future<void> setExposureMode(int cameraId, ExposureMode mode) =>
_channel.invokeMethod<void>(
'setExposureMode',
<String, dynamic>{
'cameraId': cameraId,
'mode': serializeExposureMode(mode),
},
);

@override
Future<void> setExposurePoint(int cameraId, Point<double> point) {
assert(point == null || point.x >= 0 && point.x <= 1);
assert(point == null || point.y >= 0 && point.y <= 1);
return _channel.invokeMethod<void>(
'setExposurePoint',
<String, dynamic>{
'cameraId': cameraId,
'reset': point == null,
'x': point?.x,
'y': point?.y,
},
);
}

@override
Future<double> getMinExposureOffset(int cameraId) =>
_channel.invokeMethod<double>(
'getMinExposureOffset',
<String, dynamic>{'cameraId': cameraId},
);

@override
Future<double> getMaxExposureOffset(int cameraId) =>
_channel.invokeMethod<double>(
'getMaxExposureOffset',
<String, dynamic>{'cameraId': cameraId},
);

@override
Future<double> getExposureOffsetStepSize(int cameraId) =>
_channel.invokeMethod<double>(
'getExposureOffsetStepSize',
<String, dynamic>{'cameraId': cameraId},
);

@override
Future<double> setExposureOffset(int cameraId, double offset) =>
_channel.invokeMethod<double>(
'setExposureOffset',
<String, dynamic>{
'cameraId': cameraId,
'offset': offset,
},
);

@override
Future<double> getMaxZoomLevel(int cameraId) => _channel.invokeMethod<double>(
'getMaxZoomLevel',
Expand Down Expand Up @@ -265,6 +322,8 @@ class MethodChannelCamera extends CameraPlatform {
cameraId,
call.arguments['previewWidth'],
call.arguments['previewHeight'],
deserializeExposureMode(call.arguments['exposureMode']),
call.arguments['exposurePointSupported'],
));
break;
case 'resolution_changed':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
// found in the LICENSE file.

import 'dart:async';
import 'dart:math';

import 'package:camera_platform_interface/camera_platform_interface.dart';
import 'package:camera_platform_interface/src/method_channel/method_channel_camera.dart';
import 'package:camera_platform_interface/src/types/exposure_mode.dart';
import 'package:cross_file/cross_file.dart';
import 'package:flutter/widgets.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
Expand Down Expand Up @@ -113,6 +115,48 @@ abstract class CameraPlatform extends PlatformInterface {
throw UnimplementedError('setFlashMode() is not implemented.');
}

/// Sets the exposure mode for taking pictures.
Future<void> setExposureMode(int cameraId, ExposureMode mode) {
throw UnimplementedError('setExposureMode() is not implemented.');
}

/// Sets the exposure point for automatically determining the exposure value.
Future<void> setExposurePoint(int cameraId, Point<double> point) {
throw UnimplementedError('setExposurePoint() is not implemented.');
}

/// Gets the minimum supported exposure offset for the selected camera in EV units.
Future<double> getMinExposureOffset(int cameraId) {
throw UnimplementedError('getMinExposureOffset() is not implemented.');
}

/// Gets the maximum supported exposure offset for the selected camera in EV units.
Future<double> getMaxExposureOffset(int cameraId) {
throw UnimplementedError('getMaxExposureOffset() is not implemented.');
}

/// Gets the supported step size for exposure offset for the selected camera in EV units.
///
/// Returns 0 when the camera supports using a free value without stepping.
Future<double> getExposureOffsetStepSize(int cameraId) {
throw UnimplementedError('getMinExposureOffset() is not implemented.');
}

/// Sets the exposure offset for the selected camera.
///
/// The supplied [offset] value should be in EV units. 1 EV unit represents a
/// doubling in brightness. It should be between the minimum and maximum offsets
/// obtained through `getMinExposureOffset` and `getMaxExposureOffset` respectively.
/// Throws a `CameraException` when an illegal offset is supplied.
///
/// When the supplied [offset] value does not align with the step size obtained
/// through `getExposureStepSize`, it will automatically be rounded to the nearest step.
///
/// Returns the (rounded) offset value that was set.
Future<double> setExposureOffset(int cameraId, double offset) {
throw UnimplementedError('setExposureOffset() is not implemented.');
}

/// Gets the maximum supported zoom level for the selected camera.
Future<double> getMaxZoomLevel(int cameraId) {
throw UnimplementedError('getMaxZoomLevel() is not implemented.');
Expand All @@ -126,7 +170,7 @@ abstract class CameraPlatform extends PlatformInterface {
/// Set the zoom level for the selected camera.
///
/// The supplied [zoom] value should be between 1.0 and the maximum supported
/// zoom level returned by the `getMaxZoomLevel`. Throws an `CameraException`
/// zoom level returned by the `getMaxZoomLevel`. Throws a `CameraException`
/// when an illegal zoom level is supplied.
Future<void> setZoomLevel(int cameraId, double zoom) {
throw UnimplementedError('setZoomLevel() is not implemented.');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// The possible exposure modes that can be set for a camera.
enum ExposureMode {
/// Automatically determine exposure settings.
auto,

/// Lock the currently determined exposure settings.
locked,
}

/// Returns the exposure mode as a String.
String serializeExposureMode(ExposureMode exposureMode) {
switch (exposureMode) {
case ExposureMode.locked:
return 'locked';
case ExposureMode.auto:
return 'auto';
default:
throw ArgumentError('Unknown ExposureMode value');
}
}

/// Returns the exposure mode for a given String.
ExposureMode deserializeExposureMode(String str) {
switch (str) {
case "locked":
return ExposureMode.locked;
case "auto":
return ExposureMode.auto;
default:
throw ArgumentError('"$str" is not a valid ExposureMode value');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export 'camera_description.dart';
export 'resolution_preset.dart';
export 'camera_exception.dart';
export 'flash_mode.dart';
export 'exposure_mode.dart';
2 changes: 1 addition & 1 deletion packages/camera/camera_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A common platform interface for the camera plugin.
homepage: https://github.com/flutter/plugins/tree/master/packages/camera/camera_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 1.0.4
version: 1.0.5

dependencies:
flutter:
Expand Down
Loading