blob: 5ee1d4e7445311bb01dd4d7b18303de666583ce9 [file] [log] [blame]
Tomi Valkeinenfa91e512016-05-22 23:14:38 +03001#include <pybind11/pybind11.h>
2#include <pybind11/stl.h>
Tomi Valkeinen99167122016-06-11 21:46:24 +03003#include <kms++/kms++.h>
Tomi Valkeinen3c6ea252016-06-11 22:39:24 +03004#include <kms++util/kms++util.h>
Tomi Valkeinenfa91e512016-05-22 23:14:38 +03005
6namespace py = pybind11;
7
8using namespace kms;
9using namespace std;
10
11void 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 Valkeinen0bc5bbd2016-05-23 09:31:08 +030017 .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 Valkeinenfa91e512016-05-22 23:14:38 +030021 ;
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}