1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-11-23 10:58:06 +11:00

Apparently the previous commit was not enough to sate BMP's hunger for my mind

Take this offering BMP gods, with alpha "support"
This commit is contained in:
20kdc 2018-04-07 11:53:03 +01:00
parent a837148c3b
commit 9caf0115d2

View File

@ -60,7 +60,10 @@ lcWidth = bitmap.dsSpan
local running = true local running = true
local function decodeRGB(rgb) local function decodeRGB(rgb, igp)
if igp and bitmap.bpp > 24 then
rgb = math.floor(rgb / 256)
end
return math.floor(rgb / 65536) % 256, math.floor(rgb / 256) % 256, rgb % 256 return math.floor(rgb / 65536) % 256, math.floor(rgb / 256) % 256, rgb % 256
end end
@ -70,9 +73,9 @@ neoux.create(bW, bH, nil, neoux.tcwindow(bW, bH, {
selectable = true, selectable = true,
get = function (window, x, y, bg, fg, selected, colour) get = function (window, x, y, bg, fg, selected, colour)
if bitmap.ignoresPalette then if bitmap.ignoresPalette then
return decodeRGB(bitmap.getPixel(x - 1, y - 1, 0)) return decodeRGB(bitmap.getPixel(x - 1, y - 1, 0), true)
end end
return decodeRGB(bitmap.getPalette(bitmap.getPixel(x - 1, y - 1, 0))) return decodeRGB(bitmap.getPalette(bitmap.getPixel(x - 1, y - 1, 0)), false)
end end
}, 1) }, 1)
}, function (w) }, function (w)