Skia
2D Graphics Library
SkYUVAPixmapInfo Class Reference

SkYUVAInfo combined with per-plane SkColorTypes and row bytes. More...

#include <SkYUVAPixmaps.h>

Classes

class  SupportedDataTypes
 

Public Types

enum class  DataType {
  kUnorm8 , kUnorm16 , kFloat16 , kUnorm10_Unorm2 ,
  kLast = kUnorm10_Unorm2
}
 Data type for Y, U, V, and possibly A channels independent of how values are packed into planes. More...
 
using PlaneConfig = SkYUVAInfo::PlaneConfig
 
using Subsampling = SkYUVAInfo::Subsampling
 

Public Member Functions

 SkYUVAPixmapInfo ()=default
 Default SkYUVAPixmapInfo is invalid. More...
 
 SkYUVAPixmapInfo (const SkYUVAInfo &, const SkColorType[kMaxPlanes], const size_t rowBytes[kMaxPlanes])
 Initializes the SkYUVAPixmapInfo from a SkYUVAInfo with per-plane color types and row bytes. More...
 
 SkYUVAPixmapInfo (const SkYUVAInfo &, DataType, const size_t rowBytes[kMaxPlanes])
 Like above but uses DefaultColorTypeForDataType to determine each plane's SkColorType. More...
 
 SkYUVAPixmapInfo (const SkYUVAPixmapInfo &)=default
 
SkYUVAPixmapInfooperator= (const SkYUVAPixmapInfo &)=default
 
bool operator== (const SkYUVAPixmapInfo &) const
 
bool operator!= (const SkYUVAPixmapInfo &that) const
 
const SkYUVAInfoyuvaInfo () const
 
SkYUVColorSpace yuvColorSpace () const
 
int numPlanes () const
 The number of SkPixmap planes, 0 if this SkYUVAPixmapInfo is invalid. More...
 
DataType dataType () const
 The per-YUV[A] channel data type. More...
 
size_t rowBytes (int i) const
 Row bytes for the ith plane. More...
 
const SkImageInfoplaneInfo (int i) const
 Image info for the ith plane, or default SkImageInfo if i >= numPlanes() More...
 
size_t computeTotalBytes (size_t planeSizes[kMaxPlanes]=nullptr) const
 Determine size to allocate for all planes. More...
 
bool initPixmapsFromSingleAllocation (void *memory, SkPixmap pixmaps[kMaxPlanes]) const
 Takes an allocation that is assumed to be at least computeTotalBytes() in size and configures the first numPlanes() entries in pixmaps array to point into that memory. More...
 
bool isValid () const
 Returns true if this has been configured with a non-empty dimensioned SkYUVAInfo with compatible color types and row bytes. More...
 
bool isSupported (const SupportedDataTypes &) const
 Is this valid and does it use color types allowed by the passed SupportedDataTypes? More...
 

Static Public Member Functions

static constexpr SkColorType DefaultColorTypeForDataType (DataType dataType, int numChannels)
 Gets the default SkColorType to use with numChannels channels, each represented as DataType. More...
 
static std::tuple< int, DataTypeNumChannelsAndDataType (SkColorType)
 If the SkColorType is supported for YUVA pixmaps this will return the number of YUVA channels that can be stored in a plane of this color type and what the DataType is of those channels. More...
 

Static Public Attributes

static constexpr auto kMaxPlanes = SkYUVAInfo::kMaxPlanes
 
static constexpr int kDataTypeCnt = static_cast<int>(DataType::kLast) + 1
 

Detailed Description

SkYUVAInfo combined with per-plane SkColorTypes and row bytes.

Fully specifies the SkPixmaps for a YUVA image without the actual pixel memory and data.

Member Typedef Documentation

◆ PlaneConfig

◆ Subsampling

Member Enumeration Documentation

◆ DataType

Data type for Y, U, V, and possibly A channels independent of how values are packed into planes.

Enumerator
kUnorm8 

8 bit unsigned normalized

kUnorm16 

16 bit unsigned normalized

kFloat16 

16 bit (half) floating point

kUnorm10_Unorm2 

10 bit unorm for Y, U, and V. 2 bit unorm for alpha (if present).

kLast 

Constructor & Destructor Documentation

◆ SkYUVAPixmapInfo() [1/4]

SkYUVAPixmapInfo::SkYUVAPixmapInfo ( )
default

Default SkYUVAPixmapInfo is invalid.

◆ SkYUVAPixmapInfo() [2/4]

SkYUVAPixmapInfo::SkYUVAPixmapInfo ( const SkYUVAInfo ,
const  SkColorType[kMaxPlanes],
const size_t  rowBytes[kMaxPlanes] 
)

Initializes the SkYUVAPixmapInfo from a SkYUVAInfo with per-plane color types and row bytes.

This will be invalid if the colorTypes aren't compatible with the SkYUVAInfo or if a rowBytes entry is not valid for the plane dimensions and color type. Color type and row byte values beyond the number of planes in SkYUVAInfo are ignored. All SkColorTypes must have the same DataType or this will be invalid.

If rowBytes is nullptr then bpp*width is assumed for each plane.

◆ SkYUVAPixmapInfo() [3/4]

SkYUVAPixmapInfo::SkYUVAPixmapInfo ( const SkYUVAInfo ,
DataType  ,
const size_t  rowBytes[kMaxPlanes] 
)

Like above but uses DefaultColorTypeForDataType to determine each plane's SkColorType.

If rowBytes is nullptr then bpp*width is assumed for each plane.

◆ SkYUVAPixmapInfo() [4/4]

SkYUVAPixmapInfo::SkYUVAPixmapInfo ( const SkYUVAPixmapInfo )
default

Member Function Documentation

◆ computeTotalBytes()

size_t SkYUVAPixmapInfo::computeTotalBytes ( size_t  planeSizes[kMaxPlanes] = nullptr) const

Determine size to allocate for all planes.

Optionally retrieves the per-plane sizes in planeSizes if not null. If total size overflows will return SIZE_MAX and set all planeSizes to SIZE_MAX. Returns 0 and fills planesSizes with 0 if this SkYUVAPixmapInfo is not valid.

◆ dataType()

DataType SkYUVAPixmapInfo::dataType ( ) const
inline

The per-YUV[A] channel data type.

◆ DefaultColorTypeForDataType()

constexpr SkColorType SkYUVAPixmapInfo::DefaultColorTypeForDataType ( DataType  dataType,
int  numChannels 
)
staticconstexpr

Gets the default SkColorType to use with numChannels channels, each represented as DataType.

Returns kUnknown_SkColorType if no such color type.

◆ initPixmapsFromSingleAllocation()

bool SkYUVAPixmapInfo::initPixmapsFromSingleAllocation ( void *  memory,
SkPixmap  pixmaps[kMaxPlanes] 
) const

Takes an allocation that is assumed to be at least computeTotalBytes() in size and configures the first numPlanes() entries in pixmaps array to point into that memory.

The remaining entries of pixmaps are default initialized. Fails if this SkYUVAPixmapInfo not valid.

◆ isSupported()

bool SkYUVAPixmapInfo::isSupported ( const SupportedDataTypes ) const

Is this valid and does it use color types allowed by the passed SupportedDataTypes?

◆ isValid()

bool SkYUVAPixmapInfo::isValid ( ) const
inline

Returns true if this has been configured with a non-empty dimensioned SkYUVAInfo with compatible color types and row bytes.

◆ NumChannelsAndDataType()

static std::tuple<int, DataType> SkYUVAPixmapInfo::NumChannelsAndDataType ( SkColorType  )
static

If the SkColorType is supported for YUVA pixmaps this will return the number of YUVA channels that can be stored in a plane of this color type and what the DataType is of those channels.

If the SkColorType is not supported as a YUVA plane the number of channels is reported as 0 and the DataType returned should be ignored.

◆ numPlanes()

int SkYUVAPixmapInfo::numPlanes ( ) const
inline

The number of SkPixmap planes, 0 if this SkYUVAPixmapInfo is invalid.

◆ operator!=()

bool SkYUVAPixmapInfo::operator!= ( const SkYUVAPixmapInfo that) const
inline

◆ operator=()

SkYUVAPixmapInfo& SkYUVAPixmapInfo::operator= ( const SkYUVAPixmapInfo )
default

◆ operator==()

bool SkYUVAPixmapInfo::operator== ( const SkYUVAPixmapInfo ) const

◆ planeInfo()

const SkImageInfo& SkYUVAPixmapInfo::planeInfo ( int  i) const
inline

Image info for the ith plane, or default SkImageInfo if i >= numPlanes()

◆ rowBytes()

size_t SkYUVAPixmapInfo::rowBytes ( int  i) const
inline

Row bytes for the ith plane.

Returns zero if i >= numPlanes() or this SkYUVAPixmapInfo is invalid.

◆ yuvaInfo()

const SkYUVAInfo& SkYUVAPixmapInfo::yuvaInfo ( ) const
inline

◆ yuvColorSpace()

SkYUVColorSpace SkYUVAPixmapInfo::yuvColorSpace ( ) const
inline

Member Data Documentation

◆ kDataTypeCnt

constexpr int SkYUVAPixmapInfo::kDataTypeCnt = static_cast<int>(DataType::kLast) + 1
staticconstexpr

◆ kMaxPlanes

constexpr auto SkYUVAPixmapInfo::kMaxPlanes = SkYUVAInfo::kMaxPlanes
staticconstexpr

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