summaryrefslogtreecommitdiff
path: root/img
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-08-06 01:22:46 +0100
committerubq323 <ubq323@ubq323.website>2022-08-06 01:22:46 +0100
commit8ab550f8a6fe476fc03a26cf9bba59da4f2b1ce5 (patch)
tree02e8a1563b26802a7122e283856464bd2ab269e1 /img
parentcb630d5580174ffe9640fcb23f23a24b376ae9b2 (diff)
vlorb
Diffstat (limited to 'img')
-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}