aboutsummaryrefslogtreecommitdiff
path: root/src/syslua/lx/tk.lua
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2017-05-04 12:33:41 +0200
committerAlex Auvolat <alex@adnab.me>2017-05-04 12:33:41 +0200
commit7a3ab21a27c34033fbe478d68957be8e31f983a2 (patch)
tree373ae85054fbfe1b71dc6b269d78f89dacbffe35 /src/syslua/lx/tk.lua
parent9bb1c5371affb2ff0b83256470dec7461b404264 (diff)
downloadkogata-7a3ab21a27c34033fbe478d68957be8e31f983a2.tar.gz
kogata-7a3ab21a27c34033fbe478d68957be8e31f983a2.zip
Drawing in subregion
Diffstat (limited to 'src/syslua/lx/tk.lua')
-rw-r--r--src/syslua/lx/tk.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/syslua/lx/tk.lua b/src/syslua/lx/tk.lua
index 0b0c69c..3771748 100644
--- a/src/syslua/lx/tk.lua
+++ b/src/syslua/lx/tk.lua
@@ -79,12 +79,14 @@ function tk.image_widget(img)
local buf = self:get_draw_buffer(x0, y0, w, h)
if buf == nil then return end
- for x = x0 - (x0 % 32), x0 + w, 32 do
- for y = y0 - (y0 % 32), y0 + h, 32 do
- buf:fillrect(x - x0, y - y0, 16, 16, buf:rgb(150, 150, 150))
- buf:fillrect(x - x0 + 16, y - y0 + 16, 16, 16, buf:rgb(150, 150, 150))
- buf:fillrect(x - x0 + 16, y - y0, 16, 16, buf:rgb(200, 200, 200))
- buf:fillrect(x - x0, y - y0 + 16, 16, 16, buf:rgb(200, 200, 200))
+ local step = 20
+ local halfstep = 10
+ for x = x0 - (x0 % step), x0 + w, step do
+ for y = y0 - (y0 % step), y0 + h, step do
+ buf:fillrect(x - x0, y - y0, halfstep, halfstep, buf:rgb(150, 150, 150))
+ buf:fillrect(x - x0 + halfstep, y - y0 + halfstep, halfstep, halfstep, buf:rgb(150, 150, 150))
+ buf:fillrect(x - x0 + halfstep, y - y0, halfstep, halfstep, buf:rgb(170, 170, 170))
+ buf:fillrect(x - x0, y - y0 + halfstep, halfstep, halfstep, buf:rgb(170, 170, 170))
end
end
buf:blit(0, 0, self.img:sub(x0, y0, self.img:width(), self.img:height()))