summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--img/better_disp.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/img/better_disp.lua b/img/better_disp.lua
index 4122836..4419b95 100644
--- a/img/better_disp.lua
+++ b/img/better_disp.lua
@@ -22,6 +22,10 @@ local function vlorb(onc,offc, g1,g2,g3,g4,g5,g6)
return textc,bgc,string.char(vlorbchar)
end
+local should_be_on(col)
+ return col[1]+col[2]+col[3] > 1.5
+end
+
-- todo: refactor common stuff into a common file
local function disp(R,img,scrx,scry,w,h,imgx,imgy)
-- w and h are image coords
@@ -43,7 +47,8 @@ local function disp(R,img,scrx,scry,w,h,imgx,imgy)
local gs = {}
for goffy=0,2 do
for goffx=0,1 do
- table.insert(gs,img[imgy+ioffy+goffy][imgx+ioffx+goffx] or {0,0,0})
+ local ic = img[imgy+ioffy+goffy][imgx+ioffx+goffx] or {0,0,0}
+ table.insert(gs,should_be_on(ic))
end
end
local tc,bc,ch = vlorb(colors.white,colors.black,table.unpack(gs))
@@ -58,4 +63,4 @@ end
-return {vlorb=vlorb}
+return {vlorb=vlorb,disp=disp}