diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/lua/rocklib.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 7daed0c93d..749acc3831 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c | |||
@@ -54,6 +54,7 @@ struct rocklua_image | |||
54 | int width; | 54 | int width; |
55 | int height; | 55 | int height; |
56 | fb_data *data; | 56 | fb_data *data; |
57 | fb_data dummy[1][1]; | ||
57 | }; | 58 | }; |
58 | 59 | ||
59 | static void rli_wrap(lua_State *L, fb_data *src, int width, int height) | 60 | static void rli_wrap(lua_State *L, fb_data *src, int width, int height) |
@@ -80,6 +81,7 @@ static int rli_new(lua_State *L) | |||
80 | 81 | ||
81 | a->width = width; | 82 | a->width = width; |
82 | a->height = height; | 83 | a->height = height; |
84 | a->data = &a->dummy[0][0]; | ||
83 | return 1; | 85 | return 1; |
84 | } | 86 | } |
85 | 87 | ||
@@ -691,6 +693,27 @@ RB_WRAP(font_getstringsize) | |||
691 | return 3; | 693 | return 3; |
692 | } | 694 | } |
693 | 695 | ||
696 | #ifdef HAVE_LCD_COLOR | ||
697 | RB_WRAP(lcd_rgbpack) | ||
698 | { | ||
699 | int r = luaL_checkint(L, 1); | ||
700 | int g = luaL_checkint(L, 2); | ||
701 | int b = luaL_checkint(L, 3); | ||
702 | int result = LCD_RGBPACK(r, g, b); | ||
703 | lua_pushinteger(L, result); | ||
704 | return 1; | ||
705 | } | ||
706 | |||
707 | RB_WRAP(lcd_rgbunpack) | ||
708 | { | ||
709 | int rgb = luaL_checkint(L, 1); | ||
710 | lua_pushinteger(L, RGB_UNPACK_RED(rgb)); | ||
711 | lua_pushinteger(L, RGB_UNPACK_GREEN(rgb)); | ||
712 | lua_pushinteger(L, RGB_UNPACK_BLUE(rgb)); | ||
713 | return 3; | ||
714 | } | ||
715 | #endif | ||
716 | |||
694 | #define R(NAME) {#NAME, rock_##NAME} | 717 | #define R(NAME) {#NAME, rock_##NAME} |
695 | static const luaL_Reg rocklib[] = | 718 | static const luaL_Reg rocklib[] = |
696 | { | 719 | { |
@@ -728,6 +751,10 @@ static const luaL_Reg rocklib[] = | |||
728 | R(lcd_bitmap_transparent), | 751 | R(lcd_bitmap_transparent), |
729 | #endif | 752 | #endif |
730 | #endif | 753 | #endif |
754 | #ifdef HAVE_LCD_COLOR | ||
755 | R(lcd_rgbpack), | ||
756 | R(lcd_rgbunpack), | ||
757 | #endif | ||
731 | 758 | ||
732 | /* File handling */ | 759 | /* File handling */ |
733 | R(open), | 760 | R(open), |