]> git.kernelconcepts.de Git - metawatch.git/blob - mw_utility.h
Makefile cleanup, start implementation of nval commands (not working yet)
[metawatch.git] / mw_utility.h
1 /*
2  * (c) 2011 Siegen, Germany by Nils Faerber <nils.faerber@kernelconcepts.de>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef _MW_UTILITY_H
21 #define _MW_UTILITY_H
22
23 typedef struct {
24         unsigned int res_x;
25         unsigned int res_y;
26         unsigned char bpp;
27         void *pbuf;
28 } mw_buffer;
29
30 typedef enum {
31         MW_BLACK = 0,
32         MW_WHITE,
33         MW_TRANSPARENT
34 } mw_color;
35
36 mw_buffer *mw_alloc_pbuffer(unsigned int res_x, unsigned int res_y, unsigned int bpp);
37
38 void mw_free_pbuffer(mw_buffer *mwbuf);
39
40 /* makes a buffer for sending to the watch from the drawing buffer */
41 unsigned char *mw_make_mw_buffer(mw_buffer *mwbuf, int *buflen);
42 unsigned char *mw_make_mw_oled_buffer(mw_buffer *mwbuf, int *buflen);
43
44 void mw_dump_mw_buffer(mw_buffer *mwbuf);
45
46
47 /* clear/fill entire buffer with color */
48 void mw_buf_clear(mw_buffer *mwbuf, mw_color clr);
49
50 /* draw a single pixel */
51 void mw_buf_draw_pixel(mw_buffer *mwbuf, unsigned int x, unsigned int y, mw_color clr);
52
53 void mw_buf_print(mw_buffer *mwbuf, unsigned int x, unsigned int y, char *text, unsigned char fsize, mw_color fgclr, mw_color bgclr);
54
55 void mw_buf_draw_line_bresenham(mw_buffer *mwbuf, unsigned int xstart, unsigned int ystart, unsigned int xend, unsigned int yend, mw_color clr);
56
57
58 void mw_do_notification(mwdevice_t *mwdevice, char *title, char *text, unsigned char vibrate);
59
60 #endif
61