Skia
2D Graphics Library
SkImageGenerator Class Reference

#include <SkImageGenerator.h>

Classes

struct  Options
 

Public Member Functions

virtual ~SkImageGenerator ()
 The PixelRef which takes ownership of this SkImageGenerator will call the image generator's destructor. More...
 
uint32_t uniqueID () const
 
sk_sp< SkDatarefEncodedData ()
 Return a ref to the encoded (i.e. More...
 
const SkImageInfogetInfo () const
 Return the ImageInfo associated with this generator. More...
 
bool isValid (GrRecordingContext *context) const
 Can this generator be used to produce images that will be drawable to the specified context (or to CPU, if context is nullptr)? More...
 
bool isProtected () const
 Will this generator produce protected content. More...
 
bool getPixels (const SkImageInfo &info, void *pixels, size_t rowBytes)
 Decode into the given pixels, a block of memory of size at least (info.fHeight - 1) * rowBytes + (info.fWidth * bytesPerPixel) More...
 
bool getPixels (const SkPixmap &pm)
 
bool queryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &supportedDataTypes, SkYUVAPixmapInfo *yuvaPixmapInfo) const
 If decoding to YUV is supported, this returns true. More...
 
bool getYUVAPlanes (const SkYUVAPixmaps &yuvaPixmaps)
 Returns true on success and false on failure. More...
 
virtual bool isTextureGenerator () const
 

Protected Member Functions

 SkImageGenerator (const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
 
virtual sk_sp< SkDataonRefEncodedData ()
 
virtual bool onGetPixels (const SkImageInfo &, void *, size_t, const Options &)
 
virtual bool onIsValid (GrRecordingContext *) const
 
virtual bool onIsProtected () const
 
virtual bool onQueryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &, SkYUVAPixmapInfo *) const
 
virtual bool onGetYUVAPlanes (const SkYUVAPixmaps &)
 

Protected Attributes

const SkImageInfo fInfo
 

Static Protected Attributes

static constexpr int kNeedNewImageUniqueID = 0
 

Constructor & Destructor Documentation

◆ ~SkImageGenerator()

virtual SkImageGenerator::~SkImageGenerator ( )
inlinevirtual

The PixelRef which takes ownership of this SkImageGenerator will call the image generator's destructor.

◆ SkImageGenerator()

SkImageGenerator::SkImageGenerator ( const SkImageInfo info,
uint32_t  uniqueId = kNeedNewImageUniqueID 
)
protected

Member Function Documentation

◆ getInfo()

const SkImageInfo& SkImageGenerator::getInfo ( ) const
inline

Return the ImageInfo associated with this generator.

◆ getPixels() [1/2]

bool SkImageGenerator::getPixels ( const SkImageInfo info,
void *  pixels,
size_t  rowBytes 
)

Decode into the given pixels, a block of memory of size at least (info.fHeight - 1) * rowBytes + (info.fWidth * bytesPerPixel)

Repeated calls to this function should give the same results, allowing the PixelRef to be immutable.

Parameters
infoA description of the format expected by the caller. This can simply be identical to the info returned by getInfo().

This contract also allows the caller to specify different output-configs, which the implementation can decide to support or not.

A size that does not match getInfo() implies a request to scale. If the generator cannot perform this scale, it will return false.

Returns
true on success.

◆ getPixels() [2/2]

bool SkImageGenerator::getPixels ( const SkPixmap pm)
inline

◆ getYUVAPlanes()

bool SkImageGenerator::getYUVAPlanes ( const SkYUVAPixmaps yuvaPixmaps)

Returns true on success and false on failure.

This always attempts to perform a full decode. To get the planar configuration without decoding use queryYUVAInfo().

Parameters
yuvaPixmapsContains preallocated pixmaps configured according to a successful call to queryYUVAInfo().

◆ isProtected()

bool SkImageGenerator::isProtected ( ) const
inline

Will this generator produce protected content.

◆ isTextureGenerator()

virtual bool SkImageGenerator::isTextureGenerator ( ) const
inlinevirtual

◆ isValid()

bool SkImageGenerator::isValid ( GrRecordingContext context) const
inline

Can this generator be used to produce images that will be drawable to the specified context (or to CPU, if context is nullptr)?

◆ onGetPixels()

virtual bool SkImageGenerator::onGetPixels ( const SkImageInfo ,
void *  ,
size_t  ,
const Options  
)
inlineprotectedvirtual

◆ onGetYUVAPlanes()

virtual bool SkImageGenerator::onGetYUVAPlanes ( const SkYUVAPixmaps )
inlineprotectedvirtual

◆ onIsProtected()

virtual bool SkImageGenerator::onIsProtected ( ) const
inlineprotectedvirtual

◆ onIsValid()

virtual bool SkImageGenerator::onIsValid ( GrRecordingContext ) const
inlineprotectedvirtual

◆ onQueryYUVAInfo()

virtual bool SkImageGenerator::onQueryYUVAInfo ( const SkYUVAPixmapInfo::SupportedDataTypes ,
SkYUVAPixmapInfo  
) const
inlineprotectedvirtual

◆ onRefEncodedData()

virtual sk_sp<SkData> SkImageGenerator::onRefEncodedData ( )
inlineprotectedvirtual

◆ queryYUVAInfo()

bool SkImageGenerator::queryYUVAInfo ( const SkYUVAPixmapInfo::SupportedDataTypes supportedDataTypes,
SkYUVAPixmapInfo yuvaPixmapInfo 
) const

If decoding to YUV is supported, this returns true.

Otherwise, this returns false and the caller will ignore output parameter yuvaPixmapInfo.

Parameters
supportedDataTypesIndicates the data type/planar config combinations that are supported by the caller. If the generator supports decoding to YUV(A), but not as a type in supportedDataTypes, this method returns false.
yuvaPixmapInfoOutput parameter that specifies the planar configuration, subsampling, orientation, chroma siting, plane color types, and row bytes.

◆ refEncodedData()

sk_sp<SkData> SkImageGenerator::refEncodedData ( )
inline

Return a ref to the encoded (i.e.

compressed) representation of this data.

If non-NULL is returned, the caller is responsible for calling unref() on the data when it is finished.

◆ uniqueID()

uint32_t SkImageGenerator::uniqueID ( ) const
inline

Member Data Documentation

◆ fInfo

const SkImageInfo SkImageGenerator::fInfo
protected

◆ kNeedNewImageUniqueID

constexpr int SkImageGenerator::kNeedNewImageUniqueID = 0
staticconstexprprotected

The documentation for this class was generated from the following file: