added the rgb function to upiwin and started building the demo script

This commit is contained in:
Amy Bowersox
2019-12-11 12:05:53 -07:00
parent 65999084c4
commit 1088f630a0
5 changed files with 77 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ BUILDUTILS=../buildutils
RESOURCES=../resources
SPLASHSCREEN=splash-vmwcblk.png
OBJS=main.o sysinput.o ep_init.o ep_upiwin.o ep_backlight.o ep_msg.o ep_devctxt.o ep_bitmap.o \
OBJS=main.o sysinput.o ep_init.o ep_upiwin.o ep_backlight.o ep_msg.o ep_graphics.o ep_devctxt.o ep_bitmap.o \
ep_upiwin_tmp.o ep_util.o fbinit.o rect.o gfxobj.o devctxt.o dc_screen.o fontengine.o \
bitmap.o fbprimitive.o log.o gpio.o msg_queue.o time_func.o config.o splash.o
LIBS=-lpython3.7m -lcrypt -lfreetype -lbcm2835 -lpthread -ldl -lutil -lm

13
src/ep_graphics.c Executable file
View File

@@ -0,0 +1,13 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "wintype.h"
#include "gfxtype.h"
PyObject *Epython_rgb(PyObject *self, PyObject *args)
{
UINT32 r, g, b;
if (!PyArg_ParseTuple(args, "kkk", &r, &g, &b))
return NULL;
return PyLong_FromUnsignedLong(RGB(r, g, b));
}

View File

@@ -23,6 +23,9 @@ static PyMethodDef UPIWINMethods[] = {
"Retrieves a message from the message queue, blocking if necessary."},
{"post_quit_message", Epython_post_quit_message, METH_VARARGS,
"Posts a WM_QUIT message to the message queue, with an exit code."},
/* Graphics functions */
{"rgb", Epython_rgb, METH_VARARGS,
"Creates a color value from separate red, green, and blue indexes."},
{NULL, NULL, 0, NULL}
};

View File

@@ -22,5 +22,7 @@ extern PyObject *Epython_set_backlight_level(PyObject *self, PyObject *args);
extern PyObject *Epython_get_message(PyObject *self, PyObject *args);
extern PyObject *Epython_post_quit_message(PyObject *self, PyObject *args);
/* ep_graphics.c */
extern PyObject *Epython_rgb(PyObject *self, PyObject *args);
#endif /* __EP_UPIWIN_H_INCLUDED */