mirror of
https://github.com/drewcassidy/quicktex.git
synced 2024-09-13 06:37:34 +00:00
enable buffer protocol
This commit is contained in:
parent
0b3e3b5cb0
commit
0965f3958d
@ -88,14 +88,14 @@ PYBIND11_MODULE(_quicktex, m) {
|
|||||||
|
|
||||||
py::options options;
|
py::options options;
|
||||||
|
|
||||||
py::class_<Texture> texture(m, "Texture");
|
py::class_<Texture> texture(m, "Texture", py::buffer_protocol());
|
||||||
|
|
||||||
texture.def_property_readonly("size", &Texture::Size);
|
texture.def_property_readonly("size", &Texture::Size);
|
||||||
texture.def_property_readonly("dimensions", &Texture::Dimensions);
|
texture.def_property_readonly("dimensions", &Texture::Dimensions);
|
||||||
texture.def_property_readonly("width", &Texture::Width);
|
texture.def_property_readonly("width", &Texture::Width);
|
||||||
texture.def_property_readonly("height", &Texture::Height);
|
texture.def_property_readonly("height", &Texture::Height);
|
||||||
|
|
||||||
// texture.def_buffer([](Texture &t) { return py::buffer_info(t.Data(), t.Size()); });
|
texture.def_buffer([](Texture &t) { return py::buffer_info(t.Data(), t.Size()); });
|
||||||
texture.def("to_bytes", [](const Texture &t) { return py::bytes(reinterpret_cast<const char *>(t.Data()), t.Size()); });
|
texture.def("to_bytes", [](const Texture &t) { return py::bytes(reinterpret_cast<const char *>(t.Data()), t.Size()); });
|
||||||
|
|
||||||
py::class_<RawTexture> raw_texture(m, "RawTexture", texture);
|
py::class_<RawTexture> raw_texture(m, "RawTexture", texture);
|
||||||
|
Loading…
Reference in New Issue
Block a user