Fix helloworld.lua for mono targets (+ add lcd_mono_bitmap() & lcd_mono_bitmap_part() to Lua API)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21291 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e55bdff350
commit
153ac73c04
2 changed files with 36 additions and 1 deletions
|
@ -35,7 +35,10 @@ function draw_image(img)
|
|||
|
||||
local func = rb.lcd_bitmap_transparent_part
|
||||
if(func == nil) then
|
||||
func = rb.lcd_bitmap_part -- Fallback version for mono targets
|
||||
func = rb.lcd_bitmap_part -- Fallback version for grayscale targets
|
||||
if(func == nil) then
|
||||
func = rb.lcd_mono_bitmap_part -- Fallback version for mono targets
|
||||
end
|
||||
end
|
||||
func(img, 0, 0, img:width(), x, y, img:width(), img:height())
|
||||
rb.lcd_update()
|
||||
|
@ -120,6 +123,9 @@ end
|
|||
local backdrop = rb.read_bmp_file("/.rockbox/icons/tango_small_viewers.bmp") -- This image should always be present?
|
||||
if(backdrop == nil) then
|
||||
backdrop = rb.read_bmp_file("/.rockbox/icons/tango_small_viewers_mono.bmp") -- Try using the mono version
|
||||
if(backdrop == nil) then
|
||||
backdrop = rb.read_bmp_file("/.rockbox/icons/viewers.bmp") -- Try using the builtin version
|
||||
end
|
||||
end
|
||||
-- Draws the image using our own draw_image() function; see up
|
||||
draw_image(backdrop)
|
||||
|
|
|
@ -414,6 +414,33 @@ RB_WRAP(lcd_fillrect)
|
|||
return 0;
|
||||
}
|
||||
|
||||
RB_WRAP(lcd_mono_bitmap_part)
|
||||
{
|
||||
struct rocklua_image *src = rli_checktype(L, 1);
|
||||
int src_x = luaL_checkint(L, 2);
|
||||
int src_y = luaL_checkint(L, 3);
|
||||
int stride = luaL_checkint(L, 4);
|
||||
int x = luaL_checkint(L, 5);
|
||||
int y = luaL_checkint(L, 6);
|
||||
int width = luaL_checkint(L, 7);
|
||||
int height = luaL_checkint(L, 8);
|
||||
|
||||
rb->lcd_mono_bitmap_part(src->data, src_x, src_y, stride, x, y, width, height);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RB_WRAP(lcd_mono_bitmap)
|
||||
{
|
||||
struct rocklua_image *src = rli_checktype(L, 1);
|
||||
int x = luaL_checkint(L, 2);
|
||||
int y = luaL_checkint(L, 3);
|
||||
int width = luaL_checkint(L, 4);
|
||||
int height = luaL_checkint(L, 5);
|
||||
|
||||
rb->lcd_mono_bitmap(src->data, x, y, width, height);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if LCD_DEPTH > 1
|
||||
RB_WRAP(lcd_set_foreground)
|
||||
{
|
||||
|
@ -871,6 +898,8 @@ static const luaL_Reg rocklib[] =
|
|||
R(lcd_vline),
|
||||
R(lcd_drawrect),
|
||||
R(lcd_fillrect),
|
||||
R(lcd_mono_bitmap_part),
|
||||
R(lcd_mono_bitmap),
|
||||
#if LCD_DEPTH > 1
|
||||
R(lcd_set_foreground),
|
||||
R(lcd_get_foreground),
|
||||
|
|
Loading…
Reference in a new issue