Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 }
45 return SkCodecImageGenerator::MakeFromEncodedCodec(std::move(data), at);
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)

◆ 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
std::unique_ptr< SkImageGenerator > MakeFromPicture(const SkISize &, sk_sp< SkPicture >, const SkMatrix *, const SkPaint *, SkImages::BitDepth, sk_sp< SkColorSpace >, SkSurfaceProps props)

◆ 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)