diff options
author | ubq323 <ubq323@ubq323.website> | 2022-08-05 02:42:05 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2022-08-05 02:42:05 +0100 |
commit | e45c59e99a46bf0c9a8a1d75d8c4736f8269b7c1 (patch) | |
tree | 59892cd7ba06705b5e25008f37dd4ca056a8c299 | |
parent | 5f18e965711a4656bfbfdd278ef8fea3d96f95a5 (diff) |
pallettete????
-rw-r--r-- | img/shitty_disp.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/img/shitty_disp.lua b/img/shitty_disp.lua index 3f060d9..625e646 100644 --- a/img/shitty_disp.lua +++ b/img/shitty_disp.lua @@ -73,13 +73,18 @@ local function median_cut(pxlist,remaining) local hcount = math.floor(count/2) local lhalf,uhalf = {},{} - table.move(pxlist, 1,hcount, 1, lhalf) - table.move(pxlist, hcount+1,count, 1, uhalf) - + for i=1,hcount do + lhalf[i] = pxlist[i] + end + for i=hcount+1,count do + uhalf[i-hcount] = pxlist[i] + end + local lcols = median_cut(lhalf,remaining-1) local ucols = median_cut(uhalf,remaining-1) - - return table.move(ucols,1,#ucols,#lcols+1,lcols) + + for i=1,#ucols do table.insert(lcols,ucols[i]) end + return lcols end local function reset_palette(R) |