animator.skia.Bitmap¶
- class animator.skia.Bitmap¶
Bases:
pybind11_builtins.pybind11_object
Bitmap
describes a two-dimensional raster pixel array.Bitmap
supports buffer protocol. It is possible to mountBitmap
as array:array = np.array(pixmap, copy=False)
Or mount array as
Bitmap
withImageInfo
:buffer = np.zeros((100, 100, 4), np.uint8) bitmap = skia.Bitmap() bitmap.setInfo(skia.ImageInfo.MakeN32Premul(100, 100)) bitmap.setPixels(buffer)
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: animator.skia.Bitmap) -> None
__init__(self: animator.skia.Bitmap, src: animator.skia.Bitmap) -> None
Methods
__init__
(*args, **kwargs)Overloaded function.
allocN32Pixels
(self, width, height[, isOpaque])allocPixels
(*args, **kwargs)Overloaded function.
allocPixelsFlags
(self, info[, flags])alphaType
(self)asImage
(self)bounds
(self)bytesPerPixel
(self)colorSpace
(self)colorType
(self)computeByteSize
(self)computeIsOpaque
(self)Returns
True
if all pixels are opaque.dimensions
(self)drawsNothing
(self)empty
(self)erase
(*args, **kwargs)Overloaded function.
eraseARGB
(self, a, r, g, b)eraseColor
(*args, **kwargs)Overloaded function.
extractAlpha
(self[, paint])Returns a tuple of (bitmap describing the alpha values, top-left position of the alpha values).
extractSubset
(self, subset)getAlphaf
(self, x, y)getBounds
(self)getColor
(self, x, y)getColor4f
(self, x, y)getGenerationID
(self)getPixels
(self)Return a
memoryview
object of the pixel data.getSubset
(self)height
(self)info
(self)installPixels
(*args, **kwargs)Overloaded function.
isImmutable
(self)isNull
(self)isOpaque
(self)makeShader
(self, tmx, tmy, sampling, localMatrix)notifyPixelsChanged
(self)peekPixels
(self)Returns a
Pixmap
describing the pixel data.pixelRefOrigin
(self)pixmap
(self)readPixels
(*args, **kwargs)Overloaded function.
readyToDraw
(self)refColorSpace
(self)reset
(self)rowBytes
(self)rowBytesAsPixels
(self)setAlphaType
(self, alphaType)setImmutable
(self)setInfo
(self, imageInfo[, rowBytes])setPixels
(self, pixels)Sets pixel data from the buffer pixels.
shiftPerPixel
(self)swap
(self, other)tobytes
(self)Convert
Bitmap
to bytes.tryAllocN32Pixels
(self, width, height[, ...])tryAllocPixels
(*args, **kwargs)Overloaded function.
tryAllocPixelsFlags
(self, info[, flags])width
(self)writePixels
(self, src[, dstX, dstY])- class AllocFlags¶
Bases:
pybind11_builtins.pybind11_object
Members:
kZeroPixels_AllocFlag
- property name¶
- allocPixels(*args, **kwargs)¶
Overloaded function.
allocPixels(self: animator.skia.Bitmap, info: animator.skia.ImageInfo, rowBytes: int) -> None
allocPixels(self: animator.skia.Bitmap, info: animator.skia.ImageInfo) -> None
allocPixels(self: animator.skia.Bitmap) -> None
- allocPixelsFlags(self: animator.skia.Bitmap, info: animator.skia.ImageInfo, flags: int = 0) None ¶
- alphaType(self: animator.skia.Bitmap) animator.skia.AlphaType ¶
- asImage(self: animator.skia.Bitmap) animator.skia.Image ¶
- bounds(self: animator.skia.Bitmap) animator.skia.IRect ¶
- bytesPerPixel(self: animator.skia.Bitmap) int ¶
- colorSpace(self: animator.skia.Bitmap) animator.skia.ColorSpace ¶
- colorType(self: animator.skia.Bitmap) animator.skia.ColorType ¶
- computeByteSize(self: animator.skia.Bitmap) int ¶
- computeIsOpaque(self: animator.skia.Bitmap) bool ¶
Returns
True
if all pixels are opaque.
- dimensions(self: animator.skia.Bitmap) animator.skia.ISize ¶
- drawsNothing(self: animator.skia.Bitmap) bool ¶
- empty(self: animator.skia.Bitmap) bool ¶
- erase(*args, **kwargs)¶
Overloaded function.
erase(self: animator.skia.Bitmap, c: animator.skia.Color4f, area: animator.skia.IRect) -> None
erase(self: animator.skia.Bitmap, c: int, area: animator.skia.IRect) -> None
- eraseColor(*args, **kwargs)¶
Overloaded function.
eraseColor(self: animator.skia.Bitmap, c: animator.skia.Color4f) -> None
eraseColor(self: animator.skia.Bitmap, c: int) -> None
- extractAlpha(self: animator.skia.Bitmap, paint: animator.skia.Paint = None) Tuple[animator.skia.Bitmap, animator.skia.IPoint] ¶
Returns a tuple of (bitmap describing the alpha values, top-left position of the alpha values).
- extractSubset(self: animator.skia.Bitmap, subset: animator.skia.IRect) animator.skia.Bitmap ¶
- getAlphaf(self: animator.skia.Bitmap, x: int, y: int) float ¶
- getBounds(self: animator.skia.Bitmap) animator.skia.IRect ¶
- getColor(self: animator.skia.Bitmap, x: int, y: int) int ¶
- getColor4f(self: animator.skia.Bitmap, x: int, y: int) animator.skia.Color4f ¶
- getGenerationID(self: animator.skia.Bitmap) int ¶
- getPixels(self: animator.skia.Bitmap) memoryview ¶
Return a
memoryview
object of the pixel data.
- getSubset(self: animator.skia.Bitmap) animator.skia.IRect ¶
- height(self: animator.skia.Bitmap) int ¶
- info(self: animator.skia.Bitmap) animator.skia.ImageInfo ¶
- installPixels(*args, **kwargs)¶
Overloaded function.
installPixels(self: animator.skia.Bitmap, info: animator.skia.ImageInfo, pixels: Optional[buffer], rowBytes: int = 0) -> bool
Sets
ImageInfo
info and pixel data from the buffer pixels.- warning
Keep a reference to the buffer until the bitmap is no longer needed.
installPixels(self: animator.skia.Bitmap, pixmap: animator.skia.Pixmap) -> bool
- isImmutable(self: animator.skia.Bitmap) bool ¶
- isNull(self: animator.skia.Bitmap) bool ¶
- isOpaque(self: animator.skia.Bitmap) bool ¶
- makeShader(self: animator.skia.Bitmap, tmx: animator.skia.TileMode = <TileMode.kClamp: 0>, tmy: animator.skia.TileMode = <TileMode.kClamp: 0>, sampling: animator.skia.SamplingOptions = <animator.skia.SamplingOptions object at 0x7f2053650b70>, localMatrix: animator.skia.Matrix = None) animator.skia.Shader ¶
- notifyPixelsChanged(self: animator.skia.Bitmap) None ¶
- peekPixels(self: animator.skia.Bitmap) animator.skia.Pixmap ¶
Returns a
Pixmap
describing the pixel data.
- pixelRefOrigin(self: animator.skia.Bitmap) animator.skia.IPoint ¶
- pixmap(self: animator.skia.Bitmap) animator.skia.Pixmap ¶
- readPixels(*args, **kwargs)¶
Overloaded function.
readPixels(self: animator.skia.Bitmap, dstInfo: animator.skia.ImageInfo, dstPixels: buffer, dstRowBytes: int = 0, srcX: int = 0, srcY: int = 0) -> bool
Copies dstInfo pixels starting from (srcX, srcY) to dstPixels buffer.
readPixels(self: animator.skia.Bitmap, dst: animator.skia.Pixmap, srcX: int = 0, srcY: int = 0) -> bool
- readyToDraw(self: animator.skia.Bitmap) bool ¶
- refColorSpace(self: animator.skia.Bitmap) animator.skia.ColorSpace ¶
- reset(self: animator.skia.Bitmap) None ¶
- rowBytes(self: animator.skia.Bitmap) int ¶
- rowBytesAsPixels(self: animator.skia.Bitmap) int ¶
- setAlphaType(self: animator.skia.Bitmap, alphaType: animator.skia.AlphaType) bool ¶
- setImmutable(self: animator.skia.Bitmap) None ¶
- setInfo(self: animator.skia.Bitmap, imageInfo: animator.skia.ImageInfo, rowBytes: int = 0) bool ¶
- setPixels(self: animator.skia.Bitmap, pixels: Optional[buffer]) None ¶
Sets pixel data from the buffer pixels.
- Warning
Keep a reference to the buffer until the bitmap is no longer needed.
- shiftPerPixel(self: animator.skia.Bitmap) int ¶
- swap(self: animator.skia.Bitmap, other: animator.skia.Bitmap) None ¶
- tobytes(self: animator.skia.Bitmap) bytes ¶
Convert
Bitmap
to bytes.
- tryAllocN32Pixels(self: animator.skia.Bitmap, width: int, height: int, isOpaque: bool = False) bool ¶
- tryAllocPixels(*args, **kwargs)¶
Overloaded function.
tryAllocPixels(self: animator.skia.Bitmap, info: animator.skia.ImageInfo, rowBytes: int) -> bool
tryAllocPixels(self: animator.skia.Bitmap, info: animator.skia.ImageInfo) -> bool
tryAllocPixels(self: animator.skia.Bitmap) -> bool
- tryAllocPixelsFlags(self: animator.skia.Bitmap, info: animator.skia.ImageInfo, flags: int = 0) bool ¶
- width(self: animator.skia.Bitmap) int ¶
- writePixels(self: animator.skia.Bitmap, src: animator.skia.Pixmap, dstX: int = 0, dstY: int = 0) bool ¶