Flutter Engine
The Flutter Engine
Functions
SkImageGenerators Namespace Reference

Functions

std::unique_ptr< SkImageGeneratorMakeFromEncoded (sk_sp< SkData > data, std::optional< SkAlphaType > at)
 
std::unique_ptr< SkImageGeneratorMakeFromPicture (const SkISize &, sk_sp< SkPicture >, const SkMatrix *, const SkPaint *, SkImages::BitDepth, sk_sp< SkColorSpace >, SkSurfaceProps props)
 
std::unique_ptr< SkImageGeneratorMakeFromPicture (const SkISize &, sk_sp< SkPicture >, const SkMatrix *, const SkPaint *, SkImages::BitDepth, sk_sp< SkColorSpace >)
 

Function Documentation

◆ MakeFromEncoded()

std::unique_ptr< SkImageGenerator > SkImageGenerators::MakeFromEncoded ( sk_sp< SkData ,
std::optional< SkAlphaType = std::nullopt 
)

If the default image decoder system can interpret the specified (encoded) data, then this returns a new ImageGenerator for it. Otherwise this returns NULL. Either way the caller is still responsible for managing their ownership of the data. By default, images will be converted to premultiplied pixels. The alpha type can be overridden by specifying kPremul_SkAlphaType or kUnpremul_SkAlphaType. Specifying kOpaque_SkAlphaType is not supported, and will return NULL.

Definition at line 35 of file SkImageGenerator_FromEncoded.cpp.

36 {
37 if (!data || at == kOpaque_SkAlphaType) {
38 return nullptr;
39 }
40 if (gFactory) {
41 if (std::unique_ptr<SkImageGenerator> generator = gFactory(data)) {
42 return generator;
43 }
44 }
46}
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
static SkGraphics::ImageGeneratorFromEncodedDataFactory gFactory
static std::unique_ptr< SkImageGenerator > MakeFromEncodedCodec(sk_sp< SkData >, std::optional< SkAlphaType >=std::nullopt)
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ MakeFromPicture() [1/2]

std::unique_ptr< SkImageGenerator > SkImageGenerators::MakeFromPicture ( const SkISize size,
sk_sp< SkPicture picture,
const SkMatrix matrix,
const SkPaint paint,
SkImages::BitDepth  bitDepth,
sk_sp< SkColorSpace colorSpace 
)

Definition at line 28 of file SkPictureImageGenerator.cpp.

34 {
35 return MakeFromPicture(size, picture, matrix, paint, bitDepth, colorSpace, {});
36}
const Paint & paint
Definition: color_source.cc:38
std::unique_ptr< SkImageGenerator > MakeFromPicture(const SkISize &, sk_sp< SkPicture >, const SkMatrix *, const SkPaint *, SkImages::BitDepth, sk_sp< SkColorSpace >, SkSurfaceProps props)
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ MakeFromPicture() [2/2]

std::unique_ptr< SkImageGenerator > SkImageGenerators::MakeFromPicture ( const SkISize size,
sk_sp< SkPicture picture,
const SkMatrix matrix,
const SkPaint paint,
SkImages::BitDepth  bitDepth,
sk_sp< SkColorSpace colorSpace,
SkSurfaceProps  props 
)

Return a new image generator backed by the specified picture. If the size is empty or the picture is NULL, this returns NULL. The optional matrix and paint arguments are passed to drawPicture() at rasterization time.

Definition at line 38 of file SkPictureImageGenerator.cpp.

44 {
45 if (!picture || !colorSpace || size.isEmpty()) {
46 return nullptr;
47 }
48
49 SkColorType colorType = kN32_SkColorType;
50 if (SkImages::BitDepth::kF16 == bitDepth) {
52 }
53
55 SkImageInfo::Make(size, colorType, kPremul_SkAlphaType, std::move(colorSpace));
56 return std::unique_ptr<SkImageGenerator>(
57 new SkPictureImageGenerator(info, std::move(picture), matrix, paint, props));
58}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
SkColorType
Definition: SkColorType.h:19
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition: SkColorType.h:38
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
@ kF16
uses 16-bit float per color component
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)