forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[camera_platform_interface] Add platform interface methods for settin…
…g auto focus. (flutter#3369) * Added platform interface methods for setting auto exposure. * Added platform interface methods for setting auto exposure. * Remove workspace files * Added auto exposure implementations for Android and iOS * Added platform interface methods for managing auto focus. * Formatted code * Export focus mode * Update platform interface for changes to autofocus methods * Revert "Update platform interface for changes to autofocus methods" This reverts commit bdeed1d. * iOS fix for setting the exposure point * Removed unnecessary check * Updated changelog and pubspec.yaml * Update platform interface dependency * Implement PR feedback * Restore test * Revert test change * Update camera pubspec * Update platform interface to prevent breaking changes with current master Co-authored-by: Maurits van Beusekom <[email protected]>
- Loading branch information
Showing
12 changed files
with
283 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/camera/camera_platform_interface/lib/src/types/focus_mode.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// 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 focus modes that can be set for a camera. | ||
enum FocusMode { | ||
/// Automatically determine focus settings. | ||
auto, | ||
|
||
/// Lock the currently determined focus settings. | ||
locked, | ||
} | ||
|
||
/// Returns the focus mode as a String. | ||
String serializeFocusMode(FocusMode focusMode) { | ||
if (focusMode == null) return null; | ||
switch (focusMode) { | ||
case FocusMode.locked: | ||
return 'locked'; | ||
case FocusMode.auto: | ||
return 'auto'; | ||
default: | ||
throw ArgumentError('Unknown FocusMode value'); | ||
} | ||
} | ||
|
||
/// Returns the focus mode for a given String. | ||
FocusMode deserializeFocusMode(String str) { | ||
if (str == null) return null; | ||
switch (str) { | ||
case "locked": | ||
return FocusMode.locked; | ||
case "auto": | ||
return FocusMode.auto; | ||
default: | ||
throw ArgumentError('"$str" is not a valid FocusMode value'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.