animator.skia.Surface¶
- class animator.skia.Surface¶
Bases:
pybind11_builtins.pybind11_object
Surface
is responsible for managing the pixels that a canvas draws into. Functions from the SkShaders namespace are also available here as static methods.- Example::
surface = skia.Surface(640, 480) with surface as canvas:
draw(canvas)
image = surface.makeImageSnapshot()
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: animator.skia.Surface, array: numpy.ndarray, colorType: animator.skia.ColorType = <ColorType.kRGBA_8888_ColorType: 4>, alphaType: animator.skia.AlphaType = <AlphaType.kUnpremul_AlphaType: 3>, colorSpace: animator.skia.ColorSpace = None, surfaceProps: animator.skia.SurfaceProps = None) -> None
Creates
Surface
backed by numpy array.__init__(self: animator.skia.Surface, width: int, height: int, surfaceProps: animator.skia.SurfaceProps = None) -> None
Methods
Null
(width, height)Raster
(imageInfo[, rowBytes, surfaceProps])WrapPixels
(*args, **kwargs)Overloaded function.
__init__
(*args, **kwargs)Overloaded function.
draw
(self, canvas, x, y, sampling, paint)generationID
(self)getCanvas
(self)height
(self)imageInfo
(self)makeImageSnapshot
(*args, **kwargs)Overloaded function.
makeSurface
(*args, **kwargs)Overloaded function.
notifyContentWillChange
(self, mode)peekPixels
(self)Returns a
Pixmap
describing the pixel data.props
(self)readPixels
(*args, **kwargs)Overloaded function.
toarray
(self, srcX, srcY, colorType, ...)Returns a
ndarray
of the image's pixels.width
(self)writePixels
(*args, **kwargs)Overloaded function.
- class ContentChangeMode¶
Bases:
pybind11_builtins.pybind11_object
Members:
kDiscard_ContentChangeMode
kRetain_ContentChangeMode
- property name¶
- static Null(width: int, height: int) animator.skia.Surface ¶
- static Raster(imageInfo: animator.skia.ImageInfo, rowBytes: int = 0, surfaceProps: animator.skia.SurfaceProps = None) animator.skia.Surface ¶
- static WrapPixels(*args, **kwargs)¶
Overloaded function.
WrapPixels(imageInfo: animator.skia.ImageInfo, pixels: buffer, rowBytes: int = 0, surfaceProps: animator.skia.SurfaceProps = None) -> animator.skia.Surface
Allocates raster
Surface
with the specified pixels.WrapPixels(pixmap: animator.skia.Pixmap, props: animator.skia.SurfaceProps = None) -> animator.skia.Surface
- draw(self: animator.skia.Surface, canvas: SkCanvas, x: float, y: float, sampling: animator.skia.SamplingOptions = <animator.skia.SamplingOptions object at 0x7f20500e51f0>, paint: animator.skia.Paint = None) None ¶
- generationID(self: animator.skia.Surface) int ¶
- getCanvas(self: animator.skia.Surface) SkCanvas ¶
- height(self: animator.skia.Surface) int ¶
- imageInfo(self: animator.skia.Surface) animator.skia.ImageInfo ¶
- makeImageSnapshot(*args, **kwargs)¶
Overloaded function.
makeImageSnapshot(self: animator.skia.Surface) -> animator.skia.Image
makeImageSnapshot(self: animator.skia.Surface, bounds: animator.skia.IRect) -> animator.skia.Image
- makeSurface(*args, **kwargs)¶
Overloaded function.
makeSurface(self: animator.skia.Surface, imageInfo: animator.skia.ImageInfo) -> animator.skia.Surface
makeSurface(self: animator.skia.Surface, width: int, height: int) -> animator.skia.Surface
- notifyContentWillChange(self: animator.skia.Surface, mode: animator.skia.Surface.ContentChangeMode) None ¶
- peekPixels(self: animator.skia.Surface) animator.skia.Pixmap ¶
Returns a
Pixmap
describing the pixel data.
- props(self: animator.skia.Surface) animator.skia.SurfaceProps ¶
- readPixels(*args, **kwargs)¶
Overloaded function.
readPixels(self: animator.skia.Surface, dst: animator.skia.Pixmap, srcX: int = 0, srcY: int = 0) -> bool
readPixels(self: animator.skia.Surface, 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.Surface, dst: animator.skia.Bitmap, srcX: int = 0, srcY: int = 0) -> bool
- toarray(self: animator.skia.Surface, srcX: int = 0, srcY: int = 0, colorType: animator.skia.ColorType = <ColorType.kRGBA_8888_ColorType: 4>, alphaType: animator.skia.AlphaType = <AlphaType.kUnpremul_AlphaType: 3>, colorSpace: animator.skia.ColorSpace = None) numpy.ndarray ¶
Returns a
ndarray
of the image’s pixels.
- width(self: animator.skia.Surface) int ¶
- writePixels(*args, **kwargs)¶
Overloaded function.
writePixels(self: animator.skia.Surface, src: animator.skia.Pixmap, dstX: int = 0, dstY: int = 0) -> None
writePixels(self: animator.skia.Surface, src: animator.skia.Bitmap, dstX: int = 0, dstY: int = 0) -> None