animator.skia.Data¶
- class animator.skia.Data¶
Bases:
pybind11_builtins.pybind11_object
Data
supports Python buffer protocol, meaning thatData
can be converted to Python buffer types without copy:bytes(data) memoryview(data) np.array(data)
- Note
Remember to keep a reference to
Data
when converting to Python buffer types.
- __init__(self: animator.skia.Data, buf: buffer, copy: bool = False) None ¶
Create a new
Data
.- Parameters
buf (bytes|bytearray|memoryview) – Buffer object
copy (bool) – Whether to copy data, default False.
Methods
MakeFromFileName
(path)MakeSubset
(src, offset, length)MakeUninitialized
(length)MakeWithCString
(cstr)Create a new dataref by copying the specified string or bytes.
MakeWithCopy
(data)Create a new dataref by copying the specified data.
MakeWithoutCopy
(data)MakeZeroInitialized
(length)__init__
(self, buf[, copy])Create a new
Data
.bytes
(self)Like :py:meth:
~Data.data
, returns a read-only ptr into the data, but in this case it is cast tobytes
.copyRange
(self, offset, length, buffer)Helper to copy a range of the data into a caller-provided buffer.
data
(self)Returns the read-only memoryview to the data.
equals
(self, other)isEmpty
(self)size
(self)writable_data
(self)Returns the read-write memoryview to the data.
- static MakeEmpty() animator.skia.Data ¶
- static MakeFromFileName(path: str) animator.skia.Data ¶
- static MakeSubset(src: animator.skia.Data, offset: int, length: int) animator.skia.Data ¶
- static MakeUninitialized(length: int) animator.skia.Data ¶
- static MakeWithCString(cstr: str) animator.skia.Data ¶
Create a new dataref by copying the specified string or bytes.
- static MakeWithCopy(data: buffer) animator.skia.Data ¶
Create a new dataref by copying the specified data.
- static MakeWithoutCopy(data: buffer) animator.skia.Data ¶
- static MakeZeroInitialized(length: int) animator.skia.Data ¶
- bytes(self: animator.skia.Data) bytes ¶
Like :py:meth:
~Data.data
, returns a read-only ptr into the data, but in this case it is cast tobytes
.
- copyRange(self: animator.skia.Data, offset: int, length: int, buffer: Optional[buffer]) int ¶
Helper to copy a range of the data into a caller-provided buffer.
Returns the actual number of bytes copied, after clamping offset and length to the size of the data. If buffer is NULL, it is ignored, and only the computed number of bytes is returned.
- data(self: animator.skia.Data) memoryview ¶
Returns the read-only memoryview to the data.
- equals(self: animator.skia.Data, other: animator.skia.Data) bool ¶
- isEmpty(self: animator.skia.Data) bool ¶
- size(self: animator.skia.Data) int ¶
- writable_data(self: animator.skia.Data) memoryview ¶
Returns the read-write memoryview to the data.