Flutter Engine
The Flutter Engine
|
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. More... | |
int | width () const |
The width of this image, EXIF oriented if applicable. More... | |
int | height () const |
The height of this image. EXIF oriented if applicable. More... | |
int | bytesPerPixel () const |
The bytes per pixel of the image. More... | |
int | row_bytes () const |
The byte length of the first row of the image. Defaults to width() * 4. More... | |
bool | should_resize (int target_width, int target_height) const |
Whether the given target_width or target_height differ from width() and height() respectively. More... | |
sk_sp< SkData > | data () const |
The underlying buffer for this image. More... | |
sk_sp< SkImage > | image () const |
bool | is_compressed () const |
Whether this descriptor represents compressed (encoded) data or not. More... | |
const SkImageInfo & | image_info () const |
The orientation corrected image info for this image. More... | |
SkISize | get_scaled_dimensions (float scale) |
Gets the scaled dimensions of this image, if backed by an ImageGenerator that can perform efficient subpixel scaling. More... | |
bool | get_pixels (const SkPixmap &pixmap) const |
Gets pixels for this image transformed based on the EXIF orientation tag, if applicable. More... | |
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< ImageDescriptor > | |
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 |
virtual void | RetainDartWrappableReference () const =0 |
virtual void | ReleaseDartWrappableReference () 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. More... | |
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 . More... | |
Friends | |
class | ImageDecoderFixtureTest |
Additional Inherited Members | |
Protected Member Functions inherited from fml::RefCountedThreadSafe< ImageDescriptor > | |
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 underlying buffer for this image.
Definition at line 88 of file image_descriptor.h.
|
inline |
Definition at line 113 of file image_descriptor.h.
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.
|
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.
|
inline |
The height of this image. EXIF oriented if applicable.
Definition at line 69 of file image_descriptor.h.
Definition at line 124 of file image_descriptor.cc.
|
inline |
The orientation corrected image info for this image.
Definition at line 97 of file image_descriptor.h.
|
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.
|
static |
Synchronously initializes an ImageDescriptor
for decompressed image data as specified by the PixelFormat
.
Definition at line 81 of file image_descriptor.cc.
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.
|
inline |
The byte length of the first row of the image. Defaults to width() * 4.
Definition at line 76 of file image_descriptor.h.
|
inline |
The width of this image, EXIF oriented if applicable.
Definition at line 66 of file image_descriptor.h.
|
friend |
Definition at line 137 of file image_descriptor.h.