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__

Overloaded function.

alphaType

bytesPerPixel

Returns number of bytes per pixel required by ColorType.

colorSpace

colorType

gammaCloseToSRGB

isOpaque

makeAlphaType

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

makeColorSpace

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

makeColorType

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

refColorSpace

shiftPerPixel

Returns bit shift converting row bytes to row pixels.

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