Tomi Valkeinen | fa91e51 | 2016-05-22 23:14:38 +0300 | [diff] [blame] | 1 | #include <pybind11/pybind11.h> |
| 2 | #include <pybind11/stl.h> |
| 3 | #include <kms++.h> |
| 4 | #include "kmstest.h" |
| 5 | |
| 6 | namespace py = pybind11; |
| 7 | |
| 8 | using namespace kms; |
| 9 | using namespace std; |
| 10 | |
| 11 | void init_pykmstest(py::module &m) |
| 12 | { |
| 13 | py::class_<RGB>(m, "RGB") |
| 14 | .def(py::init<>()) |
| 15 | .def(py::init<uint8_t, uint8_t, uint8_t&>()) |
| 16 | .def(py::init<uint8_t, uint8_t, uint8_t, uint8_t&>()) |
Tomi Valkeinen | 0bc5bbd | 2016-05-23 09:31:08 +0300 | [diff] [blame^] | 17 | .def_property_readonly("rgb888", &RGB::rgb888) |
| 18 | .def_property_readonly("argb8888", &RGB::argb8888) |
| 19 | .def_property_readonly("abgr8888", &RGB::abgr8888) |
| 20 | .def_property_readonly("rgb565", &RGB::rgb565) |
Tomi Valkeinen | fa91e51 | 2016-05-22 23:14:38 +0300 | [diff] [blame] | 21 | ; |
| 22 | |
| 23 | // Use lambdas to handle IMappedFramebuffer |
| 24 | m.def("draw_test_pattern", [](DumbFramebuffer& fb) { draw_test_pattern(fb); } ); |
| 25 | m.def("draw_color_bar", [](DumbFramebuffer& fb, int old_xpos, int xpos, int width) { |
| 26 | draw_color_bar(fb, old_xpos, xpos, width); |
| 27 | } ); |
| 28 | m.def("draw_rect", [](DumbFramebuffer& fb, uint32_t x, uint32_t y, uint32_t w, uint32_t h, RGB color) { |
| 29 | draw_rect(fb, x, y, w, h, color); |
| 30 | } ); |
| 31 | } |