ColorInfo

class ColorInfo

Describes pixel and encoding.

ImageInfo can be created from ColorInfo by providing dimensions.

It encodes how pixel bits describe alpha, transparency; color components red, blue, and green; and ColorSpace, the range and linearity of colors.

Methods

__init__

__init__(*args, **kwargs) Overloaded function.

alphaType

alphaType(self: skia.ColorInfo) -> skia.AlphaType

bytesPerPixel

bytesPerPixel(self: skia.ColorInfo) -> int

colorSpace

colorSpace(self: skia.ColorInfo) -> skia.ColorSpace

colorType

colorType(self: skia.ColorInfo) -> skia.ColorType

gammaCloseToSRGB

gammaCloseToSRGB(self: skia.ColorInfo) -> bool

isOpaque

isOpaque(self: skia.ColorInfo) -> bool

makeAlphaType

makeAlphaType(self: skia.ColorInfo, newAlphaType: skia.AlphaType) -> skia.ColorInfo

makeColorSpace

makeColorSpace(self: skia.ColorInfo, cs: skia.ColorSpace) -> skia.ColorInfo

makeColorType

makeColorType(self: skia.ColorInfo, newColorType: skia.ColorType) -> skia.ColorInfo

refColorSpace

refColorSpace(self: skia.ColorInfo) -> skia.ColorSpace

shiftPerPixel

shiftPerPixel(self: skia.ColorInfo) -> int

Methods

ColorInfo.__init__(*args, **kwargs)

Overloaded function.

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

  2. __init__(self: skia.ColorInfo, ct: skia.ColorType, at: skia.AlphaType, cs: skia.ColorSpace = None) -> None

    Creates ColorInfo from ColorType ct, AlphaType at, and optionally ColorSpace cs.

    If ColorSpace cs is nullptr and ColorInfo is part of drawing source: ColorSpace defaults to sRGB, mapping into Surface ColorSpace.

    Parameters are not validated to see if their values are legal, or that the combination is supported.

  3. __init__(self: skia.ColorInfo, arg0: skia.ColorInfo) -> None

ColorInfo.alphaType(self: skia.ColorInfo) skia.AlphaType
ColorInfo.bytesPerPixel(self: skia.ColorInfo) int

Returns number of bytes per pixel required by ColorType.

Returns zero if colorType() is kUnknown_ColorType.

Returns:

bytes in pixel

ColorInfo.colorSpace(self: skia.ColorInfo) skia.ColorSpace
ColorInfo.colorType(self: skia.ColorInfo) skia.ColorType
ColorInfo.gammaCloseToSRGB(self: skia.ColorInfo) bool
ColorInfo.isOpaque(self: skia.ColorInfo) bool
ColorInfo.makeAlphaType(self: skia.ColorInfo, newAlphaType: skia.AlphaType) skia.ColorInfo

Creates ColorInfo with same ColorType, ColorSpace, with AlphaType set to newAlphaType.

Created ColorInfo contains newAlphaType even if it is incompatible with ColorType, in which case AlphaType in ColorInfo is ignored.

ColorInfo.makeColorSpace(self: skia.ColorInfo, cs: skia.ColorSpace) skia.ColorInfo

Creates ColorInfo with same AlphaType, ColorType, with ColorSpace set to cs.

cs may be nullptr.

ColorInfo.makeColorType(self: skia.ColorInfo, newColorType: skia.ColorType) skia.ColorInfo

Creates new ColorInfo with same AlphaType, ColorSpace, with ColorType set to newColorType.

ColorInfo.refColorSpace(self: skia.ColorInfo) skia.ColorSpace
ColorInfo.shiftPerPixel(self: skia.ColorInfo) int

Returns bit shift converting row bytes to row pixels.

Returns zero for ColorType.kUnknown_ColorType.

Returns:

one of: 0, 1, 2, 3, 4; left shift to convert pixels to bytes