Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.12.1

* Adds support for `ImageFormatGroup.rgba8888` image format.

## 0.12.0+1

* Makes `Optional.of` constructor `const`.
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ dev_dependencies:

flutter:
uses-material-design: true
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
camera_platform_interface: {path: ../../../../packages/camera/camera_platform_interface}
6 changes: 6 additions & 0 deletions packages/camera/camera/lib/src/camera_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ ImageFormatGroup _asImageFormatGroup(dynamic rawFormat) {
// android.graphics.ImageFormat.NV21
case 17:
return ImageFormatGroup.nv21;
// android.graphics.PixelFormat.RGBA_8888
case 1:
return ImageFormatGroup.rgba8888;
}
}

Expand All @@ -100,6 +103,9 @@ ImageFormatGroup _asImageFormatGroup(dynamic rawFormat) {
// kCVPixelFormatType_32BGRA
case 1111970369:
return ImageFormatGroup.bgra8888;
// kCVPixelFormatType_32RGBA
case 1380401729:
return ImageFormatGroup.rgba8888;
}
}

Expand Down
12 changes: 9 additions & 3 deletions packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
Dart.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.12.0+1
version: 0.12.1
Comment thread
Mairramer marked this conversation as resolved.

environment:
sdk: ^3.9.0
Expand All @@ -21,9 +21,9 @@ flutter:
default_package: camera_web

dependencies:
camera_android_camerax: ^0.7.0
camera_android_camerax: ^0.7.3
camera_avfoundation: ^0.10.0
camera_platform_interface: ^2.12.0
camera_platform_interface: ^2.14.0
camera_web: ^0.3.3
flutter:
sdk: flutter
Expand All @@ -38,3 +38,9 @@ dev_dependencies:

topics:
- camera
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
camera_platform_interface: {path: ../camera_platform_interface}
camera_avfoundation: {path: ../camera_avfoundation}
camera_android_camerax: {path: ../camera_android_camerax}
4 changes: 4 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.7.3

* Adds support for `ImageFormatGroup.rgba8888` image format.

## 0.7.2

* Bumps camerax_version from 1.5.3 to 1.6.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ ImageFormatGroup _asImageFormatGroup(dynamic rawFormat) {
// android.graphics.ImageFormat.JPEG
case 256:
return ImageFormatGroup.jpeg;
// android.graphics.PixelFormat.RGBA_8888
case 1:
return ImageFormatGroup.rgba8888;
}
}

Expand All @@ -100,6 +103,9 @@ ImageFormatGroup _asImageFormatGroup(dynamic rawFormat) {
// kCVPixelFormatType_32BGRA
case 1111970369:
return ImageFormatGroup.bgra8888;
// kCVPixelFormatType_32RGBA
case 1380401729:
return ImageFormatGroup.rgba8888;
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_android_camerax/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ dev_dependencies:

flutter:
uses-material-design: true
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
camera_platform_interface: {path: ../../camera_platform_interface}

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:flutter/services.dart'
show DeviceOrientation, PlatformException;
import 'package:flutter/widgets.dart' show Texture, Widget, visibleForTesting;
import 'package:stream_transform/stream_transform.dart';

import 'camerax_library.dart';
import 'rotated_preview_delegate.dart';

Expand Down Expand Up @@ -184,6 +185,11 @@ class AndroidCameraCameraX extends CameraPlatform {
/// See https://developer.android.com/reference/android/graphics/ImageFormat#JPEG.
static const int imageProxyFormatJpeg = 256;

/// Constant representing the RGBA_8888 image format used by ImageProxy.
///
/// See https://developer.android.com/reference/android/graphics/PixelFormat#RGBA_8888.
static const int imageProxyFormatRgba8888 = 1;

/// Constant representing the YUV 420 image format used for configuring ImageAnalysis.
///
/// See https://developer.android.com/reference/androidx/camera/core/ImageAnalysis#OUTPUT_IMAGE_FORMAT_YUV_420_888()
Expand All @@ -194,6 +200,11 @@ class AndroidCameraCameraX extends CameraPlatform {
/// See https://developer.android.com/reference/androidx/camera/core/ImageAnalysis#OUTPUT_IMAGE_FORMAT_NV21().
static const int imageAnalysisOutputImageFormatNv21 = 3;

/// Constant representing the RGBA_8888 image format used for configuring ImageAnalysis.
///
/// See https://developer.android.com/reference/androidx/camera/core/ImageAnalysis#OUTPUT_IMAGE_FORMAT_RGBA_8888()
static const int imageAnalysisOutputImageFormatRgba8888 = 2;

/// Error code indicating a [ZoomState] was requested, but one has not been
/// set for the camera in use.
static const String zoomStateNotSetErrorCode = 'zoomStateNotSet';
Expand Down Expand Up @@ -457,8 +468,8 @@ class AndroidCameraCameraX extends CameraPlatform {
/// * Retrieves information about the camera and sends a [CameraInitializedEvent].
///
/// [imageFormatGroup] is used to specify the image format used for image
/// streaming, but CameraX currently only supports YUV_420_888 (the CameraX default),
/// NV21, and RGBA (not supported by Flutter).
/// streaming. CameraX currently supports YUV_420_888 (the CameraX default),
/// NV21, and RGBA8888.
@override
Future<void> initializeCamera(
int cameraId, {
Expand Down Expand Up @@ -1447,6 +1458,8 @@ class AndroidCameraCameraX extends CameraPlatform {
return imageAnalysisOutputImageFormatYuv420_888;
case ImageFormatGroup.nv21:
return imageAnalysisOutputImageFormatNv21;
case ImageFormatGroup.rgba8888:
return imageAnalysisOutputImageFormatRgba8888;
}

return null;
Expand All @@ -1463,6 +1476,8 @@ class AndroidCameraCameraX extends CameraPlatform {
return ImageFormatGroup.nv21;
case imageProxyFormatJpeg: // android.graphics.ImageFormat.JPEG
return ImageFormatGroup.jpeg;
case imageProxyFormatRgba8888: // android.graphics.PixelFormat.RGBA_8888
return ImageFormatGroup.rgba8888;
}

return ImageFormatGroup.unknown;
Expand Down
8 changes: 6 additions & 2 deletions packages/camera/camera_android_camerax/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_android_camerax
description: Android implementation of the camera plugin using the CameraX library.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.7.2
version: 0.7.3

environment:
sdk: ^3.9.0
Expand All @@ -19,7 +19,7 @@ flutter:

dependencies:
async: ^2.5.0
camera_platform_interface: ^2.12.0
camera_platform_interface: ^2.14.0
flutter:
sdk: flutter
meta: ^1.7.0
Expand All @@ -35,3 +35,7 @@ dev_dependencies:

topics:
- camera
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
camera_platform_interface: {path: ../camera_platform_interface}
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,8 @@ void main() {
AndroidCameraCameraX.imageAnalysisOutputImageFormatYuv420_888,
ImageFormatGroup.nv21 =>
AndroidCameraCameraX.imageAnalysisOutputImageFormatNv21,
ImageFormatGroup.rgba8888 =>
AndroidCameraCameraX.imageAnalysisOutputImageFormatRgba8888,
_ => null,
};
// Tell plugin to create mock/detached objects for testing createCamera
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_avfoundation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.2

* Adds support for `ImageFormatGroup.rgba8888` image format.

## 0.10.1

* Fixes fatal crash on iPhone 17 when using `ResolutionPreset.max`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ final class CameraPropertiesTests: XCTestCase {
XCTAssertEqual(
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,
getPixelFormat(for: .yuv420))
XCTAssertEqual(
kCVPixelFormatType_32RGBA,
getPixelFormat(for: .rgba8888))
}

// MARK: - Device Orientation Tests
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_avfoundation/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ dev_dependencies:

flutter:
uses-material-design: true
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
camera_platform_interface: {path: ../../camera_platform_interface}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ func getPixelFormat(for imageFormat: PlatformImageFormatGroup) -> OSType {
return kCVPixelFormatType_32BGRA
case .yuv420:
return kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
case .rgba8888:
return kCVPixelFormatType_32RGBA
@unknown default:
assertionFailure("Unknown image format")
return kCVPixelFormatType_32BGRA
Expand Down
Loading