diff options
author | William Wilgus <wilgus.william@gmail.com> | 2024-04-05 00:38:35 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2024-04-18 13:11:51 -0400 |
commit | a6570b7d378b6236c40d2e2bd983f7d53ad479e3 (patch) | |
tree | 6e1562a78c07a1fe0e05b36cf10542aff5ca7482 /apps/plugins/lua_scripts/rlimg.lua | |
parent | 7f1b49693cd84b6e03e05d8a980fb99f26a781b1 (diff) | |
download | rockbox-a6570b7d378b6236c40d2e2bd983f7d53ad479e3.tar.gz rockbox-a6570b7d378b6236c40d2e2bd983f7d53ad479e3.zip |
lua use lcd_drawline to draw lines inside rliimages
rewrite draw_text to use new viewport buffer
set_viewport now accepts rliimage to allowe interfacing with rb. functions
fix long standing 2-bit bug with text drawing in lua
fix 2-bit img
saving bug (i'm guessing just a one off, just enabled clipping)
fix font_getstringsize bug
fix shape of numbers draw_num.lua also add auto centering
add page scrolling to printtable
add a new demo script 'stars'
Change-Id: I866905cee82ee89ebc0eb020a56a7ecdb101bf5e
Diffstat (limited to 'apps/plugins/lua_scripts/rlimg.lua')
-rwxr-xr-x | apps/plugins/lua_scripts/rlimg.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/plugins/lua_scripts/rlimg.lua b/apps/plugins/lua_scripts/rlimg.lua index c9dde65ed4..c4eefc7aa9 100755 --- a/apps/plugins/lua_scripts/rlimg.lua +++ b/apps/plugins/lua_scripts/rlimg.lua | |||
@@ -76,7 +76,7 @@ local BLUE = _clr.set(WHITE, 0, 0, 255) | |||
76 | ------------------------------------------- | 76 | ------------------------------------------- |
77 | local clrs | 77 | local clrs |
78 | local CANCEL_BUTTON = rb.actions.PLA_CANCEL | 78 | local CANCEL_BUTTON = rb.actions.PLA_CANCEL |
79 | 79 | local LCD_DEPTH = rb.LCD_DEPTH | |
80 | -- EXAMPLES ---------------------------------------------------------------------- EXAMPLES--------------------------------------------------------------------- | 80 | -- EXAMPLES ---------------------------------------------------------------------- EXAMPLES--------------------------------------------------------------------- |
81 | function my_blit(dst_val, dx, dy, src_val, sx, sy) | 81 | function my_blit(dst_val, dx, dy, src_val, sx, sy) |
82 | -- user defined blit operation | 82 | -- user defined blit operation |
@@ -84,7 +84,7 @@ function my_blit(dst_val, dx, dy, src_val, sx, sy) | |||
84 | --you may change pixels in both the source and dest image | 84 | --you may change pixels in both the source and dest image |
85 | --return nil to stop early | 85 | --return nil to stop early |
86 | 86 | ||
87 | if _lcd.DEPTH < 2 then | 87 | if LCD_DEPTH < 2 then |
88 | return src_val | 88 | return src_val |
89 | end | 89 | end |
90 | 90 | ||
@@ -518,7 +518,7 @@ function twist(img) | |||
518 | for ix = 1, _lcd.W, w do | 518 | for ix = 1, _lcd.W, w do |
519 | y_col = y_col + 1 | 519 | y_col = y_col + 1 |
520 | y = ims.y_pos[(y_col % 2) + 1] | 520 | y = ims.y_pos[(y_col % 2) + 1] |
521 | if _lcd.DEPTH > 1 then | 521 | if LCD_DEPTH > 1 then |
522 | _lcd:copy(ims.strip, ix, 1, 1, y, w, h, false, _blit.BDEQC, colors[1]) | 522 | _lcd:copy(ims.strip, ix, 1, 1, y, w, h, false, _blit.BDEQC, colors[1]) |
523 | else | 523 | else |
524 | _lcd:copy(ims.strip, ix, 1, 1, y, w, h, false, _blit.BSAND) | 524 | _lcd:copy(ims.strip, ix, 1, 1, y, w, h, false, _blit.BSAND) |
@@ -767,10 +767,10 @@ function long_text() | |||
767 | local wait = 0 | 767 | local wait = 0 |
768 | w = w + wp * 3 | 768 | w = w + wp * 3 |
769 | h = h + 4 | 769 | h = h + 4 |
770 | local img = _img.new(w + 1, h) | 770 | local img = _img.new(w + 1, h + 1) |
771 | img:clear(BLACK) | 771 | img:clear(BLACK) |
772 | _draw.rounded_rect_filled(img, 1, 1, w, h, 15, WHITE) | 772 | _draw.rounded_rect_filled(img, 1, 1, w, h, 15, WHITE) |
773 | _draw_text(img, 1, 2, nil, nil, nil, BLACK, txt) | 773 | _draw_text(img, 1, 1, nil, nil, nil, BLACK, txt) |
774 | 774 | ||
775 | for p = -w + 1, w - 1 do | 775 | for p = -w + 1, w - 1 do |
776 | wait = 0 | 776 | wait = 0 |
@@ -858,7 +858,7 @@ function main_menu() | |||
858 | [14] = function(EXIT_) return true end | 858 | [14] = function(EXIT_) return true end |
859 | } | 859 | } |
860 | 860 | ||
861 | if _lcd.DEPTH < 2 then | 861 | if LCD_DEPTH < 2 then |
862 | table.remove(mt, 10) | 862 | table.remove(mt, 10) |
863 | table.remove(ft, 10) | 863 | table.remove(ft, 10) |
864 | end | 864 | end |
@@ -880,7 +880,7 @@ _timer("main") -- keep track of how long the program ran | |||
880 | -- Clear the screen | 880 | -- Clear the screen |
881 | _lcd:clear(BLACK) | 881 | _lcd:clear(BLACK) |
882 | 882 | ||
883 | if _lcd.DEPTH > 1 then | 883 | if LCD_DEPTH > 1 then |
884 | --draw a gradient using available colors | 884 | --draw a gradient using available colors |
885 | if IS_COLOR_TARGET == true then | 885 | if IS_COLOR_TARGET == true then |
886 | clrs = { | 886 | clrs = { |