SourceClass ImageInfo
from skia import ImageInfoclass ImageInfo:Describes pixel dimensions and encoding. skia.Bitmap, skia.Image, skia.Pixmap,
and skia.Surface can be created from ImageInfo. ImageInfo can be retrieved from
skia.Bitmap and skia.Pixmap, but not from skia.Image and skia.Surface.
For example, skia.Image and skia.Surface implementations may defer pixel depth, so
may not completely specify ImageInfo.
ImageInfo contains dimensions, the pixel integral width and height. It encodes how pixel
bits describe alpha, transparency; color components red, blue, and green; and ColorSpace,
the range and linearity of colors.
Properties§
Source@property
def alpha_type(self, /) -> AlphaType§
Returns the alpha type.
Source@property
def color_type(self, /) -> ColorType§
Returns the color type.
Source@property
def height(self, /) -> int§
Returns the pixel row count.
Source@property
def width(self, /) -> int§
Returns the pixel count in each row.
Methods§
Sourcedef compute_byte_size(self, /, row_bytes: int) -> int§
Returns the storage required by the pixel array, given ImageInfo dimensions, color
type, and row_bytes. row_bytes is assumed to be at least skia.ImageInfo.min_row_bytes().
Returns zero if the height is zero. Returns int.MAX if the answer exceeds the range of
int.
row_bytessize of the pixel row or larger
Sourcedef compute_offset(self, /, x: int, y: int, row_bytes: int) -> int§
Returns the byte offset of a pixel from the pixel base address.
Asserts in debug builds if point is outside of bounds. Does not assert if row_bytes is
smaller than skia.ImageInfo.min_row_bytes(), even though the result may be incorrect.
row_bytessize of the pixel row or larger
@classmethod
def make_a8(cls, /, width: int, height: int) -> ImageInfo§
@classmethod
def make_n32_premul(cls, /, width: int, height: int) -> ImageInfo§
@classmethod
def make_unknown(cls, /, width: int, height: int) -> ImageInfo§
Sourcedef with_alpha_type(self, /, new_alpha_type: AlphaType) -> ImageInfo§
Sourcedef with_color_type(self, /, new_color_type: ColorType) -> ImageInfo§
Creates ImageInfo with the same alpha type, color space, width, and height, with the
color type set to new_color_type.
new_color_typenew color type
Sourcedef with_dimensions(self, /, width: int, height: int) -> ImageInfo§
Creates ImageInfo with the same color type, color space, and alpha type, with dimensions
set to new_dimensions.