diff options
-rw-r--r-- | framebuf.lua | 10 | ||||
-rw-r--r-- | john.lua | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/framebuf.lua b/framebuf.lua index 77f17e6..614f48b 100644 --- a/framebuf.lua +++ b/framebuf.lua @@ -53,6 +53,10 @@ function M:rect(x1, y1, x2, y2, r, g, b) end end +function M:get_size() + return #self, #(self[1] or {}) +end + function M:ppm(data, x, y) if type(data) ~= "string" then local f = data @@ -178,7 +182,7 @@ function M:present(mon, offsx, offsy) local pw, ph = M.resolution(mon) local cols = {} local chars = {} - print("","1") + -- print("","1") for y = offsy + 1, offsy + ph, 3 do for x = offsx + 1, offsx + pw, 2 do local char, fg, bg = get_char(self, x, y) @@ -189,12 +193,12 @@ function M:present(mon, offsx, offsy) end end end - print("","2") + -- print("","2") local palette, map = median_cut(cols, 16) for i, color in ipairs(palette) do mon.setPaletteColor(2^(i - 1), color) end - print("","3") + -- print("","3") for i = 1, w * h, w do mon.setCursorPos(1, (i - 1) / w) local blit_char, blit_fg, blit_bg = {}, {}, {} @@ -15,6 +15,7 @@ if monitors == nil or #monitors < 1 then end fb:ppm(fs.open("img/john.pnm","rb")) +print("size!!",fb:get_size()) local xoffs = 0 for ix,iname in ipairs(monitors) do |