1 #include <pybind11/pybind11.h>
2 #include <pybind11/stl.h>
3 #include <kms++.h>
4 #include "kmstest.h"
6 namespace py = pybind11;
8 using namespace kms;
9 using namespace std;
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&>())
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)
21 ;
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 }