diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/helloworld.lua | 8 | ||||
-rw-r--r-- | apps/plugins/lua/rocklib.c | 29 |
2 files changed, 36 insertions, 1 deletions
diff --git a/apps/plugins/helloworld.lua b/apps/plugins/helloworld.lua index 047e31a644..c0e75540c7 100644 --- a/apps/plugins/helloworld.lua +++ b/apps/plugins/helloworld.lua | |||
@@ -35,7 +35,10 @@ function draw_image(img) | |||
35 | 35 | ||
36 | local func = rb.lcd_bitmap_transparent_part | 36 | local func = rb.lcd_bitmap_transparent_part |
37 | if(func == nil) then | 37 | if(func == nil) then |
38 | func = rb.lcd_bitmap_part -- Fallback version for mono targets | 38 | func = rb.lcd_bitmap_part -- Fallback version for grayscale targets |
39 | if(func == nil) then | ||
40 | func = rb.lcd_mono_bitmap_part -- Fallback version for mono targets | ||
41 | end | ||
39 | end | 42 | end |
40 | func(img, 0, 0, img:width(), x, y, img:width(), img:height()) | 43 | func(img, 0, 0, img:width(), x, y, img:width(), img:height()) |
41 | rb.lcd_update() | 44 | rb.lcd_update() |
@@ -120,6 +123,9 @@ end | |||
120 | local backdrop = rb.read_bmp_file("/.rockbox/icons/tango_small_viewers.bmp") -- This image should always be present? | 123 | local backdrop = rb.read_bmp_file("/.rockbox/icons/tango_small_viewers.bmp") -- This image should always be present? |
121 | if(backdrop == nil) then | 124 | if(backdrop == nil) then |
122 | backdrop = rb.read_bmp_file("/.rockbox/icons/tango_small_viewers_mono.bmp") -- Try using the mono version | 125 | backdrop = rb.read_bmp_file("/.rockbox/icons/tango_small_viewers_mono.bmp") -- Try using the mono version |
126 | if(backdrop == nil) then | ||
127 | backdrop = rb.read_bmp_file("/.rockbox/icons/viewers.bmp") -- Try using the builtin version | ||
128 | end | ||
123 | end | 129 | end |
124 | -- Draws the image using our own draw_image() function; see up | 130 | -- Draws the image using our own draw_image() function; see up |
125 | draw_image(backdrop) | 131 | draw_image(backdrop) |
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index d501694b46..c64275c5b6 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c | |||
@@ -414,6 +414,33 @@ RB_WRAP(lcd_fillrect) | |||
414 | return 0; | 414 | return 0; |
415 | } | 415 | } |
416 | 416 | ||
417 | RB_WRAP(lcd_mono_bitmap_part) | ||
418 | { | ||
419 | struct rocklua_image *src = rli_checktype(L, 1); | ||
420 | int src_x = luaL_checkint(L, 2); | ||
421 | int src_y = luaL_checkint(L, 3); | ||
422 | int stride = luaL_checkint(L, 4); | ||
423 | int x = luaL_checkint(L, 5); | ||
424 | int y = luaL_checkint(L, 6); | ||
425 | int width = luaL_checkint(L, 7); | ||
426 | int height = luaL_checkint(L, 8); | ||
427 | |||
428 | rb->lcd_mono_bitmap_part(src->data, src_x, src_y, stride, x, y, width, height); | ||
429 | return 0; | ||
430 | } | ||
431 | |||
432 | RB_WRAP(lcd_mono_bitmap) | ||
433 | { | ||
434 | struct rocklua_image *src = rli_checktype(L, 1); | ||
435 | int x = luaL_checkint(L, 2); | ||
436 | int y = luaL_checkint(L, 3); | ||
437 | int width = luaL_checkint(L, 4); | ||
438 | int height = luaL_checkint(L, 5); | ||
439 | |||
440 | rb->lcd_mono_bitmap(src->data, x, y, width, height); | ||
441 | return 0; | ||
442 | } | ||
443 | |||
417 | #if LCD_DEPTH > 1 | 444 | #if LCD_DEPTH > 1 |
418 | RB_WRAP(lcd_set_foreground) | 445 | RB_WRAP(lcd_set_foreground) |
419 | { | 446 | { |
@@ -871,6 +898,8 @@ static const luaL_Reg rocklib[] = | |||
871 | R(lcd_vline), | 898 | R(lcd_vline), |
872 | R(lcd_drawrect), | 899 | R(lcd_drawrect), |
873 | R(lcd_fillrect), | 900 | R(lcd_fillrect), |
901 | R(lcd_mono_bitmap_part), | ||
902 | R(lcd_mono_bitmap), | ||
874 | #if LCD_DEPTH > 1 | 903 | #if LCD_DEPTH > 1 |
875 | R(lcd_set_foreground), | 904 | R(lcd_set_foreground), |
876 | R(lcd_get_foreground), | 905 | R(lcd_get_foreground), |