Creates an image descriptor for encoded or decoded image data, describing the width, height, and bytes per pixel for that image. This class will hold a reference on the underlying image data, and in the case of compressed data, an ImageGenerator for the data. The Codec initialization actually happens in initEncoded, making initstantiateCodec a lightweight operation.
More...
#include <image_descriptor.h>
Classes | |
| struct | ImageInfo |
Public Types | |
| enum | PixelFormat { kUnknown , kRGBA8888 , kBGRA8888 , kRGBAFloat32 , kR32Float , kGray8 } |
Public Types inherited from tonic::DartWrappable | |
| enum | DartNativeFields { kPeerIndex , kNumberOfNativeFields } |
Public Member Functions | |
| ~ImageDescriptor () override=default | |
| void | instantiateCodec (Dart_Handle codec, int32_t target_width, int32_t target_height, int32_t destination_format) |
| Associates a flutter::Codec object with the dart.ui Codec handle. | |
| int | width () const |
| The width of this image, EXIF oriented if applicable. | |
| int | height () const |
| The height of this image. EXIF oriented if applicable. | |
| int | bytesPerPixel () const |
| The bytes per pixel of the image. | |
| int | row_bytes () const |
| The byte length of the first row of the image. Defaults to width() * 4. | |
| bool | should_resize (int target_width, int target_height) const |
Whether the given target_width or target_height differ from width() and height() respectively. | |
| sk_sp< SkData > | data () const |
| The underlying buffer for this image. | |
| sk_sp< SkImage > | image () const |
| bool | is_compressed () const |
| Whether this descriptor represents compressed (encoded) data or not. | |
| const ImageInfo & | image_info () const |
| The orientation corrected image info for this image. | |
| SkISize | get_scaled_dimensions (float scale) |
Gets the scaled dimensions of this image, if backed by an ImageGenerator that can perform efficient subpixel scaling. | |
| bool | get_pixels (const SkPixmap &pixmap) const |
| Gets pixels for this image transformed based on the EXIF orientation tag, if applicable. | |
| void | dispose () |
Public Member Functions inherited from flutter::RefCountedDartWrappable< ImageDescriptor > | |
| virtual void | RetainDartWrappableReference () const override |
| virtual void | ReleaseDartWrappableReference () const override |
Public Member Functions inherited from fml::RefCountedThreadSafe< T > | |
| void | Release () const |
Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase | |
| void | AddRef () const |
| bool | HasOneRef () const |
| void | AssertHasOneRef () const |
Public Member Functions inherited from tonic::DartWrappable | |
| DartWrappable () | |
| virtual const DartWrapperInfo & | GetDartWrapperInfo () const =0 |
| Dart_Handle | CreateDartWrapper (DartState *dart_state) |
| void | AssociateWithDartWrapper (Dart_Handle wrappable) |
| void | ClearDartWrapper () |
| Dart_WeakPersistentHandle | dart_wrapper () const |
Static Public Member Functions | |
| static Dart_Handle | initEncoded (Dart_Handle descriptor_handle, ImmutableBuffer *immutable_buffer, Dart_Handle callback_handle) |
Asynchronously initializes an ImageDescriptor for an encoded image, as long as the format is recognized by an encoder installed in the ImageGeneratorRegistry. Calling this method will create an ImageGenerator and read EXIF corrected dimensions from the image data. | |
| static void | initRaw (Dart_Handle descriptor_handle, const fml::RefPtr< ImmutableBuffer > &data, int width, int height, int row_bytes, int pixel_format) |
Synchronously initializes an ImageDescriptor for decompressed image data as specified by the PixelFormat. | |
| static ImageInfo | CreateImageInfo (const SkImageInfo &sk_image_info) |
| static SkImageInfo | ToSkImageInfo (const ImageInfo &image_info) |
Friends | |
| class | ImageDecoderFixtureTest |
Additional Inherited Members | |
Protected Member Functions inherited from fml::RefCountedThreadSafe< T > | |
| RefCountedThreadSafe () | |
| ~RefCountedThreadSafe () | |
Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase | |
| RefCountedThreadSafeBase () | |
| ~RefCountedThreadSafeBase () | |
| bool | Release () const |
| void | Adopt () |
Protected Member Functions inherited from tonic::DartWrappable | |
| virtual | ~DartWrappable () |
Static Protected Member Functions inherited from tonic::DartWrappable | |
| static Dart_PersistentHandle | GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info) |
Creates an image descriptor for encoded or decoded image data, describing the width, height, and bytes per pixel for that image. This class will hold a reference on the underlying image data, and in the case of compressed data, an ImageGenerator for the data. The Codec initialization actually happens in initEncoded, making initstantiateCodec a lightweight operation.
ImageGenerator Definition at line 33 of file image_descriptor.h.
| Enumerator | |
|---|---|
| kUnknown | |
| kRGBA8888 | |
| kBGRA8888 | |
| kRGBAFloat32 | |
| kR32Float | |
| kGray8 | |
Definition at line 38 of file image_descriptor.h.
|
overridedefault |
| int flutter::ImageDescriptor::bytesPerPixel | ( | ) | const |
The bytes per pixel of the image.
Definition at line 221 of file image_descriptor.cc.
References flutter::ImageDescriptor::ImageInfo::format, kBGRA8888, kGray8, kR32Float, kRGBA8888, kRGBAFloat32, and kUnknown.
Referenced by row_bytes().
|
static |
Definition at line 20 of file image_descriptor.cc.
References alpha_type, FML_DCHECK, format, height(), kBGRA8888, kGray8, kRGBA8888, kRGBAFloat32, kUnknown, and flutter::ImageDescriptor::ImageInfo::width.
Referenced by flutter::testing::TEST_F(), and flutter::testing::TEST_F().
|
inline |
The underlying buffer for this image.
Definition at line 104 of file image_descriptor.h.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture(), flutter::ImageFromDecompressedData(), and initRaw().
|
inline |
Definition at line 129 of file image_descriptor.h.
References tonic::DartWrappable::ClearDartWrapper().
| bool flutter::ImageDescriptor::get_pixels | ( | const SkPixmap & | pixmap | ) | const |
Gets pixels for this image transformed based on the EXIF orientation tag, if applicable.
Definition at line 215 of file image_descriptor.cc.
References FML_DCHECK.
Referenced by flutter::ImageDecoderSkia::ImageFromCompressedData().
|
inline |
Gets the scaled dimensions of this image, if backed by an ImageGenerator that can perform efficient subpixel scaling.
Definition at line 118 of file image_descriptor.h.
References flutter::ImageDescriptor::ImageInfo::height, and flutter::ImageDescriptor::ImageInfo::width.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture(), and flutter::ImageDecoderSkia::ImageFromCompressedData().
|
inline |
The height of this image. EXIF oriented if applicable.
Definition at line 85 of file image_descriptor.h.
References flutter::ImageDescriptor::ImageInfo::height.
Referenced by CreateImageInfo(), initRaw(), and should_resize().
| sk_sp< SkImage > flutter::ImageDescriptor::image | ( | ) | const |
Definition at line 211 of file image_descriptor.cc.
Referenced by flutter::ImageDecoderSkia::ImageFromCompressedData().
|
inline |
The orientation corrected image info for this image.
Definition at line 113 of file image_descriptor.h.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture(), flutter::ImageDecoderSkia::ImageFromCompressedData(), flutter::ImageFromDecompressedData(), initRaw(), and ToSkImageInfo().
|
static |
Asynchronously initializes an ImageDescriptor for an encoded image, as long as the format is recognized by an encoder installed in the ImageGeneratorRegistry. Calling this method will create an ImageGenerator and read EXIF corrected dimensions from the image data.
ImageGeneratorRegistry Definition at line 94 of file image_descriptor.cc.
References flutter::UIDartState::Current(), tonic::DartInvoke(), flutter::ImmutableBuffer::data(), FML_DCHECK, and tonic::ToDart().
|
static |
Synchronously initializes an ImageDescriptor for decompressed image data as specified by the PixelFormat.
Definition at line 154 of file image_descriptor.cc.
References data(), height(), image_info(), kRGBAFloat32, row_bytes(), flutter::ImageDescriptor::ImageInfo::width, and width().
| void flutter::ImageDescriptor::instantiateCodec | ( | Dart_Handle | codec, |
| int32_t | target_width, | ||
| int32_t | target_height, | ||
| int32_t | destination_format | ||
| ) |
Associates a flutter::Codec object with the dart.ui Codec handle.
Definition at line 194 of file image_descriptor.cc.
References flutter::ToImageDecoderTargetPixelFormat().
|
inline |
Whether this descriptor represents compressed (encoded) data or not.
Definition at line 110 of file image_descriptor.h.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture().
|
inline |
The byte length of the first row of the image. Defaults to width() * 4.
Definition at line 92 of file image_descriptor.h.
References bytesPerPixel(), and flutter::ImageDescriptor::ImageInfo::width.
Referenced by flutter::ImageFromDecompressedData(), and initRaw().
|
inline |
Whether the given target_width or target_height differ from width() and height() respectively.
Definition at line 99 of file image_descriptor.h.
References height(), and width().
Referenced by flutter::ImageDecoderSkia::ImageFromCompressedData().
|
static |
Definition at line 53 of file image_descriptor.cc.
References flutter::ImageDescriptor::ImageInfo::alpha_type, flutter::ImageDescriptor::ImageInfo::color_space, color_type, FML_DCHECK, flutter::ImageDescriptor::ImageInfo::format, flutter::ImageDescriptor::ImageInfo::height, image_info(), kBGRA8888, kGray8, kR32Float, kRGBA8888, kRGBAFloat32, kUnknown, and flutter::ImageDescriptor::ImageInfo::width.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture(), flutter::ImageDecoderSkia::ImageFromCompressedData(), and flutter::ImageFromDecompressedData().
|
inline |
The width of this image, EXIF oriented if applicable.
Definition at line 82 of file image_descriptor.h.
References flutter::ImageDescriptor::ImageInfo::width.
Referenced by initRaw(), and should_resize().
|
friend |
Definition at line 154 of file image_descriptor.h.