5#ifndef FLUTTER_LIB_UI_PAINTING_IMAGE_DESCRIPTOR_H_
6#define FLUTTER_LIB_UI_PAINTING_IMAGE_DESCRIPTOR_H_
12#include "flutter/fml/macros.h"
13#include "flutter/lib/ui/dart_wrapper.h"
14#include "flutter/lib/ui/painting/image_generator_registry.h"
15#include "flutter/lib/ui/painting/immutable_buffer.h"
77 return row_bytes_.value_or(
84 return target_width !=
width() || target_height !=
height();
104 return generator_->GetScaledDimensions(
scale);
124 std::shared_ptr<ImageGenerator> generator);
127 std::shared_ptr<ImageGenerator> generator_;
129 std::optional<size_t> row_bytes_;
133 DEFINE_WRAPPERTYPEINFO();
Creates an image descriptor for encoded or decoded image data, describing the width,...
sk_sp< SkImage > image() const
const SkImageInfo & image_info() const
The orientation corrected image info for this image.
~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.
SkISize get_scaled_dimensions(float scale)
Gets the scaled dimensions of this image, if backed by an ImageGenerator that can perform efficient s...
friend class ImageDecoderFixtureTest
int row_bytes() const
The byte length of the first row of the image. Defaults to width() * 4.
int height() const
The height of this image. EXIF oriented if applicable.
bool should_resize(int target_width, int target_height) const
Whether the given target_width or target_height differ from width() and height() respectively.
bool get_pixels(const SkPixmap &pixmap) const
Gets pixels for this image transformed based on the EXIF orientation tag, if applicable.
int bytesPerPixel() const
The bytes per pixel of the image.
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 recogniz...
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 PixelFor...
bool is_compressed() const
Whether this descriptor represents compressed (encoded) data or not.
sk_sp< SkData > data() const
The underlying buffer for this image.
void reset(T *ptr=nullptr)
struct _Dart_Handle * Dart_Handle
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
int bytesPerPixel() const
SkISize dimensions() const