|
4 | 4 | #define MAKE_METHOD_0(prefix, func) extern mp_obj_t prefix##_##func(mp_obj_t ); STATIC MP_DEFINE_CONST_FUN_OBJ_1( prefix##_##func##_obj, prefix##_##func );
|
5 | 5 | #define MAKE_METHOD_1(prefix, func) extern mp_obj_t prefix##_##func(mp_obj_t,mp_obj_t ); STATIC MP_DEFINE_CONST_FUN_OBJ_2( prefix##_##func##_obj, prefix##_##func );
|
6 | 6 | #define MAKE_METHOD_2(prefix, func) extern mp_obj_t prefix##_##func(mp_obj_t,mp_obj_t,mp_obj_t); STATIC MP_DEFINE_CONST_FUN_OBJ_3( prefix##_##func##_obj, prefix##_##func );
|
| 7 | +#define MAKE_METHOD_KW(prefix, func, args) extern mp_obj_t prefix##_##func(size_t,const mp_obj_t*,mp_map_t*); STATIC MP_DEFINE_CONST_FUN_OBJ_KW( prefix##_##func##_obj, args, prefix##_##func ); |
7 | 8 |
|
8 | 9 | #define MAKE_TABLE( prefix, func ) \
|
9 | 10 | { MP_ROM_QSTR(MP_QSTR_##func), MP_ROM_PTR(&prefix##_##func##_obj) }
|
10 | 11 |
|
11 | 12 | //-------- GFX common wrapper
|
12 |
| -MAKE_METHOD_0( gfx, width ); |
13 |
| -MAKE_METHOD_0( gfx, height ); |
14 |
| -MAKE_METHOD_0( gfx, getRotation ); |
15 |
| -MAKE_METHOD_0( gfx, getColorDepth ); |
16 |
| -MAKE_METHOD_1( gfx, setRotation ); |
17 |
| -MAKE_METHOD_1( gfx, setColorDepth ); |
18 |
| -MAKE_METHOD_1( gfx, print ); |
19 |
| -MAKE_METHOD_2( gfx, setCursor ); |
20 |
| -MAKE_METHOD_V( gfx, fillScreen , 1, 2 ); |
21 |
| -MAKE_METHOD_V( gfx, drawPixel , 3, 4 ); |
22 |
| -MAKE_METHOD_V( gfx, drawCircle , 4, 5 ); |
23 |
| -MAKE_METHOD_V( gfx, fillCircle , 4, 5 ); |
24 |
| -MAKE_METHOD_V( gfx, drawLine , 5, 6 ); |
25 |
| -MAKE_METHOD_V( gfx, drawRect , 5, 6 ); |
26 |
| -MAKE_METHOD_V( gfx, fillRect , 5, 6 ); |
27 |
| -MAKE_METHOD_V( gfx, printf , 2, 32); |
28 |
| -MAKE_METHOD_V( gfx, newCanvas , 3, 5 ); |
| 13 | +MAKE_METHOD_0( gfx, width ); |
| 14 | +MAKE_METHOD_0( gfx, height ); |
| 15 | +MAKE_METHOD_0( gfx, getRotation ); |
| 16 | +MAKE_METHOD_0( gfx, getColorDepth); |
| 17 | +MAKE_METHOD_0( gfx, getCursor ); |
| 18 | +MAKE_METHOD_1( gfx, setRotation ); |
| 19 | +MAKE_METHOD_1( gfx, setColorDepth); |
| 20 | +MAKE_METHOD_1( gfx, setFont ); |
| 21 | +MAKE_METHOD_1( gfx, print ); |
| 22 | +MAKE_METHOD_2( gfx, setCursor ); |
| 23 | +MAKE_METHOD_V( gfx, clear , 1, 2 ); |
| 24 | +MAKE_METHOD_V( gfx, fillScreen , 1, 2 ); |
| 25 | +MAKE_METHOD_V( gfx, drawPixel , 3, 4 ); |
| 26 | +MAKE_METHOD_V( gfx, drawCircle , 4, 5 ); |
| 27 | +MAKE_METHOD_V( gfx, fillCircle , 4, 5 ); |
| 28 | +MAKE_METHOD_V( gfx, drawLine , 5, 6 ); |
| 29 | +MAKE_METHOD_V( gfx, drawRect , 5, 6 ); |
| 30 | +MAKE_METHOD_V( gfx, fillRect , 5, 6 ); |
| 31 | +MAKE_METHOD_V( gfx, drawRoundRect, 6, 7 ); |
| 32 | +MAKE_METHOD_V( gfx, fillRoundRect, 6, 7 ); |
| 33 | +MAKE_METHOD_V( gfx, printf , 2, 32); |
| 34 | +MAKE_METHOD_V( gfx, newCanvas , 3, 5 ); |
29 | 35 |
|
30 | 36 | #define TABLE_PARTS_GFX_BASE \
|
| 37 | + MAKE_TABLE( gfx, clear ), \ |
31 | 38 | MAKE_TABLE( gfx, drawCircle ), \
|
32 | 39 | MAKE_TABLE( gfx, drawLine ), \
|
33 | 40 | MAKE_TABLE( gfx, drawPixel ), \
|
34 | 41 | MAKE_TABLE( gfx, drawRect ), \
|
| 42 | + MAKE_TABLE( gfx, drawRoundRect), \ |
35 | 43 | MAKE_TABLE( gfx, fillCircle ), \
|
36 | 44 | MAKE_TABLE( gfx, fillRect ), \
|
| 45 | + MAKE_TABLE( gfx, fillRoundRect), \ |
37 | 46 | MAKE_TABLE( gfx, fillScreen ), \
|
38 | 47 | MAKE_TABLE( gfx, getColorDepth), \
|
| 48 | + MAKE_TABLE( gfx, getCursor ), \ |
39 | 49 | MAKE_TABLE( gfx, getRotation ), \
|
40 | 50 | MAKE_TABLE( gfx, height ), \
|
41 | 51 | MAKE_TABLE( gfx, newCanvas ), \
|
42 | 52 | MAKE_TABLE( gfx, print ), \
|
43 | 53 | MAKE_TABLE( gfx, printf ), \
|
44 | 54 | MAKE_TABLE( gfx, setColorDepth), \
|
45 | 55 | MAKE_TABLE( gfx, setCursor ), \
|
| 56 | + MAKE_TABLE( gfx, setFont ), \ |
46 | 57 | MAKE_TABLE( gfx, setRotation ), \
|
47 | 58 | MAKE_TABLE( gfx, width ), \
|
48 |
| - { MP_ROM_QSTR(MP_QSTR_BLACK ), MP_ROM_INT( 0x000000 ) }, \ |
49 |
| - { MP_ROM_QSTR(MP_QSTR_NAVY ), MP_ROM_INT( 0x000080 ) }, \ |
50 |
| - { MP_ROM_QSTR(MP_QSTR_DARKGREEN ), MP_ROM_INT( 0x008000 ) }, \ |
51 |
| - { MP_ROM_QSTR(MP_QSTR_DARKCYAN ), MP_ROM_INT( 0x008080 ) }, \ |
52 |
| - { MP_ROM_QSTR(MP_QSTR_MAROON ), MP_ROM_INT( 0x800000 ) }, \ |
53 |
| - { MP_ROM_QSTR(MP_QSTR_PURPLE ), MP_ROM_INT( 0x800080 ) }, \ |
54 |
| - { MP_ROM_QSTR(MP_QSTR_OLIVE ), MP_ROM_INT( 0x808000 ) }, \ |
55 |
| - { MP_ROM_QSTR(MP_QSTR_LIGHTGREY ), MP_ROM_INT( 0xC0C0C0 ) }, \ |
56 |
| - { MP_ROM_QSTR(MP_QSTR_DARKGREY ), MP_ROM_INT( 0x808080 ) }, \ |
57 |
| - { MP_ROM_QSTR(MP_QSTR_BLUE ), MP_ROM_INT( 0x0000FF ) }, \ |
58 |
| - { MP_ROM_QSTR(MP_QSTR_GREEN ), MP_ROM_INT( 0x00FF00 ) }, \ |
59 |
| - { MP_ROM_QSTR(MP_QSTR_CYAN ), MP_ROM_INT( 0x00FFFF ) }, \ |
60 |
| - { MP_ROM_QSTR(MP_QSTR_RED ), MP_ROM_INT( 0xFF0000 ) }, \ |
61 |
| - { MP_ROM_QSTR(MP_QSTR_MAGENTA ), MP_ROM_INT( 0xFF00FF ) }, \ |
62 |
| - { MP_ROM_QSTR(MP_QSTR_YELLOW ), MP_ROM_INT( 0xFFFF00 ) }, \ |
63 |
| - { MP_ROM_QSTR(MP_QSTR_WHITE ), MP_ROM_INT( 0xFFFFFF ) }, \ |
64 |
| - { MP_ROM_QSTR(MP_QSTR_ORANGE ), MP_ROM_INT( 0xFFA500 ) }, \ |
65 |
| - { MP_ROM_QSTR(MP_QSTR_GREENYELLOW), MP_ROM_INT( 0xADFF2F ) }, \ |
66 |
| - { MP_ROM_QSTR(MP_QSTR_PINK ), MP_ROM_INT( 0xFFC0CB ) } |
| 59 | + { MP_ROM_QSTR(MP_QSTR_FONT0 ), MP_ROM_PTR(&gfx_font_0_obj) }, \ |
| 60 | + { MP_ROM_QSTR(MP_QSTR_FONT2 ), MP_ROM_PTR(&gfx_font_2_obj) }, \ |
| 61 | + { MP_ROM_QSTR(MP_QSTR_FONT4 ), MP_ROM_PTR(&gfx_font_4_obj) }, \ |
| 62 | + { MP_ROM_QSTR(MP_QSTR_FONT6 ), MP_ROM_PTR(&gfx_font_6_obj) }, \ |
| 63 | + { MP_ROM_QSTR(MP_QSTR_FONT7 ), MP_ROM_PTR(&gfx_font_7_obj) }, \ |
| 64 | + { MP_ROM_QSTR(MP_QSTR_FONT8 ), MP_ROM_PTR(&gfx_font_8_obj) }, \ |
| 65 | + { MP_ROM_QSTR(MP_QSTR_FONT_DejaVu9 ), MP_ROM_PTR(&gfx_font_DejaVu9_obj ) }, \ |
| 66 | + { MP_ROM_QSTR(MP_QSTR_FONT_DejaVu12), MP_ROM_PTR(&gfx_font_DejaVu12_obj) }, \ |
| 67 | + { MP_ROM_QSTR(MP_QSTR_FONT_DejaVu18), MP_ROM_PTR(&gfx_font_DejaVu18_obj) }, \ |
| 68 | + { MP_ROM_QSTR(MP_QSTR_FONT_DejaVu24), MP_ROM_PTR(&gfx_font_DejaVu24_obj) }, \ |
| 69 | + { MP_ROM_QSTR(MP_QSTR_BLACK ), MP_ROM_INT( 0x000000 ) }, \ |
| 70 | + { MP_ROM_QSTR(MP_QSTR_NAVY ), MP_ROM_INT( 0x000080 ) }, \ |
| 71 | + { MP_ROM_QSTR(MP_QSTR_DARKGREEN ), MP_ROM_INT( 0x008000 ) }, \ |
| 72 | + { MP_ROM_QSTR(MP_QSTR_DARKCYAN ), MP_ROM_INT( 0x008080 ) }, \ |
| 73 | + { MP_ROM_QSTR(MP_QSTR_MAROON ), MP_ROM_INT( 0x800000 ) }, \ |
| 74 | + { MP_ROM_QSTR(MP_QSTR_PURPLE ), MP_ROM_INT( 0x800080 ) }, \ |
| 75 | + { MP_ROM_QSTR(MP_QSTR_OLIVE ), MP_ROM_INT( 0x808000 ) }, \ |
| 76 | + { MP_ROM_QSTR(MP_QSTR_LIGHTGREY ), MP_ROM_INT( 0xC0C0C0 ) }, \ |
| 77 | + { MP_ROM_QSTR(MP_QSTR_DARKGREY ), MP_ROM_INT( 0x808080 ) }, \ |
| 78 | + { MP_ROM_QSTR(MP_QSTR_BLUE ), MP_ROM_INT( 0x0000FF ) }, \ |
| 79 | + { MP_ROM_QSTR(MP_QSTR_GREEN ), MP_ROM_INT( 0x00FF00 ) }, \ |
| 80 | + { MP_ROM_QSTR(MP_QSTR_CYAN ), MP_ROM_INT( 0x00FFFF ) }, \ |
| 81 | + { MP_ROM_QSTR(MP_QSTR_RED ), MP_ROM_INT( 0xFF0000 ) }, \ |
| 82 | + { MP_ROM_QSTR(MP_QSTR_MAGENTA ), MP_ROM_INT( 0xFF00FF ) }, \ |
| 83 | + { MP_ROM_QSTR(MP_QSTR_YELLOW ), MP_ROM_INT( 0xFFFF00 ) }, \ |
| 84 | + { MP_ROM_QSTR(MP_QSTR_WHITE ), MP_ROM_INT( 0xFFFFFF ) }, \ |
| 85 | + { MP_ROM_QSTR(MP_QSTR_ORANGE ), MP_ROM_INT( 0xFFA500 ) }, \ |
| 86 | + { MP_ROM_QSTR(MP_QSTR_GREENYELLOW ), MP_ROM_INT( 0xADFF2F ) }, \ |
| 87 | + { MP_ROM_QSTR(MP_QSTR_PINK ), MP_ROM_INT( 0xFFC0CB ) } |
| 88 | + |
67 | 89 |
|
68 | 90 | //-------- GFX device wrapper
|
69 | 91 | MAKE_METHOD_0( gfx, startWrite );
|
|
0 commit comments