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>
Public Types | |
| enum | PixelFormat { kRGBA8888 , kBGRA8888 , kRGBAFloat32 } |
Public Types inherited from tonic::DartWrappable | |
| enum | DartNativeFields { kPeerIndex , kNumberOfNativeFields } |
Public Member Functions | |
| ~ImageDescriptor () override=default | |
| void | instantiateCodec (Dart_Handle codec, int target_width, int target_height) |
| 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 SkImageInfo & | 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, PixelFormat pixel_format) |
Synchronously initializes an ImageDescriptor for decompressed image data as specified by the PixelFormat. | |
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 32 of file image_descriptor.h.
| Enumerator | |
|---|---|
| kRGBA8888 | |
| kBGRA8888 | |
| kRGBAFloat32 | |
Definition at line 37 of file image_descriptor.h.
|
overridedefault |
|
inline |
The bytes per pixel of the image.
Definition at line 72 of file image_descriptor.h.
|
inline |
The underlying buffer for this image.
Definition at line 88 of file image_descriptor.h.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture(), and flutter::ImageFromDecompressedData().
|
inline |
Definition at line 113 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 128 of file image_descriptor.cc.
References FML_DCHECK.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture(), and 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 102 of file image_descriptor.h.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture(), and flutter::ImageDecoderSkia::ImageFromCompressedData().
|
inline |
The height of this image. EXIF oriented if applicable.
Definition at line 69 of file image_descriptor.h.
Referenced by should_resize().
| sk_sp< SkImage > flutter::ImageDescriptor::image | ( | ) | const |
Definition at line 124 of file image_descriptor.cc.
Referenced by flutter::ImageDecoderSkia::ImageFromCompressedData().
|
inline |
The orientation corrected image info for this image.
Definition at line 97 of file image_descriptor.h.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture(), flutter::ImageDecoderSkia::ImageFromCompressedData(), and flutter::ImageFromDecompressedData().
|
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 40 of file image_descriptor.cc.
References 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 81 of file image_descriptor.cc.
References alpha_type, color_type, data, FML_DCHECK, height, and width.
| void flutter::ImageDescriptor::instantiateCodec | ( | Dart_Handle | codec, |
| int | target_width, | ||
| int | target_height | ||
| ) |
Associates a flutter::Codec object with the dart.ui Codec handle.
Definition at line 110 of file image_descriptor.cc.
|
inline |
Whether this descriptor represents compressed (encoded) data or not.
Definition at line 94 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 76 of file image_descriptor.h.
Referenced by flutter::ImageDecoderImpeller::DecompressTexture(), and flutter::ImageFromDecompressedData().
|
inline |
Whether the given target_width or target_height differ from width() and height() respectively.
Definition at line 83 of file image_descriptor.h.
References height(), and width().
Referenced by flutter::ImageDecoderSkia::ImageFromCompressedData().
|
inline |
The width of this image, EXIF oriented if applicable.
Definition at line 66 of file image_descriptor.h.
Referenced by should_resize().
|
friend |
Definition at line 137 of file image_descriptor.h.