blob: 407330d06ad28368810df86534d17eff62fb0699 [file] [log] [blame]
Tomi Valkeinenfa91e512016-05-22 23:14:38 +03001#include <pybind11/pybind11.h>
2#include <pybind11/stl.h>
3#include <kms++.h>
4#include "kmstest.h"
5
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}