YUVAPixmapInfo

class YUVAPixmapInfo

YUVAInfo combined with per-plane ColorType and row bytes. Fully specifies the Pixmaps for a YUVA image without the actual pixel memory and data.

Classes

DataType

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

SupportedDataTypes

Methods

DefaultColorTypeForDataType

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

NumChannelsAndDataType

If the ColorType 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.

__init__

Overloaded function.

computeTotalBytes

Determine size to allocate for all planes.

dataType

The per-YUV[A] channel data type.

initPixmapsFromSingleAllocation

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.

isSupported

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

isValid

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

numPlanes

The number of Pixmap planes, 0 if this YUVAPixmapInfo is invalid.

planeInfo

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

rowBytes

Row bytes for the ith plane.

yuvColorSpace

yuvaInfo

Attributes

kFloat16

kLast

kMaxPlanes

kUnorm10_Unorm2

kUnorm16

kUnorm8

Methods

static YUVAPixmapInfo.DefaultColorTypeForDataType(dataType: skia.YUVAPixmapInfo.DataType, numChannels: int) skia.ColorType

Gets the default SkColorType to use with numChannels channels, each represented as DataType. Returns kUnknown_SkColorType if no such color type.

static YUVAPixmapInfo.NumChannelsAndDataType(colorType: skia.ColorType) Tuple[int, skia.YUVAPixmapInfo.DataType]

If the ColorType 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 ColorType is not supported as a YUVA plane the number of channels is reported as 0 and the DataType returned should be ignored.

YUVAPixmapInfo.__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: skia.YUVAPixmapInfo) -> None

    Default SkYUVAPixmapInfo is invalid.

  2. __init__(self: skia.YUVAPixmapInfo, info: skia.YUVAInfo, colorType: List[skia.ColorType], rowBytes: object = None) -> None

    Initializes the YUVAPixmapInfo from a YUVAInfo with per-plane color types and row bytes. This will be invalid if the colorTypes aren’t compatible with the YUVAInfo 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 YUVAInfo are ignored. All ColorTypes must have the same DataType or this will be invalid.

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

  3. __init__(self: skia.YUVAPixmapInfo, info: skia.YUVAInfo, dataType: skia.YUVAPixmapInfo.DataType, rowBytes: object = None) -> None

    Like above but uses DefaultColorTypeForDataType to determine each plane’s ColorType. If rowBytes is nullptr then bpp*width is assumed for each plane.

YUVAPixmapInfo.computeTotalBytes(self: skia.YUVAPixmapInfo, returnPlaneSizes: bool = False) object

Determine size to allocate for all planes. Optionally returns the per-plane sizes if returnPlaneSizes is True. If total size overflows will return SIZE_MAX and set all planeSizes to SIZE_MAX. Returns 0 and fills planesSizes with 0 if this YUVAPixmapInfo is not valid.

YUVAPixmapInfo.dataType(self: skia.YUVAPixmapInfo) skia.YUVAPixmapInfo.DataType

The per-YUV[A] channel data type.

YUVAPixmapInfo.initPixmapsFromSingleAllocation(self: skia.YUVAPixmapInfo, memory: buffer) List[skia.Pixmap]

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 YUVAPixmapInfo not valid.

Parameters:

memory – Buffer that is at least computeTotalBytes() in size.

Return type:

List[skia.Pixmap]

YUVAPixmapInfo.isSupported(self: skia.YUVAPixmapInfo, supportedDataTypes: skia.YUVAPixmapInfo.SupportedDataTypes) bool

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

YUVAPixmapInfo.isValid(self: skia.YUVAPixmapInfo) bool

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

YUVAPixmapInfo.numPlanes(self: skia.YUVAPixmapInfo) int

The number of Pixmap planes, 0 if this YUVAPixmapInfo is invalid.

YUVAPixmapInfo.planeInfo(self: skia.YUVAPixmapInfo, i: int) skia.ImageInfo

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

YUVAPixmapInfo.rowBytes(self: skia.YUVAPixmapInfo, i: int) int

Row bytes for the ith plane. Returns zero if i >= numPlanes() or this YUVAPixmapInfo is invalid.

YUVAPixmapInfo.yuvColorSpace(self: skia.YUVAPixmapInfo) skia.YUVColorSpace
YUVAPixmapInfo.yuvaInfo(self: skia.YUVAPixmapInfo) skia.YUVAInfo

Attributes

YUVAPixmapInfo.kFloat16 = <DataType.kFloat16: 2>
YUVAPixmapInfo.kLast = <DataType.kUnorm10_Unorm2: 3>
YUVAPixmapInfo.kMaxPlanes = 4
YUVAPixmapInfo.kUnorm10_Unorm2 = <DataType.kUnorm10_Unorm2: 3>
YUVAPixmapInfo.kUnorm16 = <DataType.kUnorm16: 1>
YUVAPixmapInfo.kUnorm8 = <DataType.kUnorm8: 0>