mirror of
https://github.com/kepler155c/opus
synced 2024-12-31 19:00:27 +00:00
ntf transparency
This commit is contained in:
parent
8f17657263
commit
0e1b712adc
@ -50,9 +50,10 @@ function NFT.parse(imageText)
|
||||
currFG = getColourOf(nextChar)
|
||||
fgNext = false
|
||||
else
|
||||
if nextChar ~= " " and currFG == nil then
|
||||
currFG = _G.colors.white
|
||||
end
|
||||
--if nextChar ~= " " and currFG == nil then
|
||||
-- any color not in range is considered transparent
|
||||
-- currFG = _G.colors.white
|
||||
--end
|
||||
image.bg[num][writeIndex] = currBG
|
||||
image.fg[num][writeIndex] = currFG
|
||||
image.text[num][writeIndex] = nextChar
|
||||
|
@ -912,10 +912,12 @@ function UI.Window:emit(event)
|
||||
end
|
||||
end
|
||||
|
||||
function UI.Window:getProperty(property)
|
||||
return self[property] or self.parent and self.parent:getProperty(property)
|
||||
end
|
||||
|
||||
function UI.Window:find(uid)
|
||||
if self.children then
|
||||
return Util.find(self.children, 'uid', uid)
|
||||
end
|
||||
return self.children and Util.find(self.children, 'uid', uid)
|
||||
end
|
||||
|
||||
function UI.Window:eventHandler()
|
||||
|
@ -17,9 +17,12 @@ end
|
||||
|
||||
function UI.NftImage:draw()
|
||||
if self.image then
|
||||
-- due to blittle, the background and foreground transparent
|
||||
-- color is the same as the background color
|
||||
local bg = self:getProperty('backgroundColor')
|
||||
for y = 1, self.image.height do
|
||||
for x = 1, #self.image.text[y] do
|
||||
self:write(x, y, self.image.text[y][x], self.image.bg[y][x], self.image.fg[y][x])
|
||||
self:write(x, y, self.image.text[y][x], self.image.bg[y][x], self.image.fg[y][x] or bg)
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -412,8 +412,8 @@ function Util.first(t, order)
|
||||
end
|
||||
|
||||
--[[ File functions ]]--
|
||||
function Util.readFile(fname)
|
||||
local f = fs.open(fname, "r")
|
||||
function Util.readFile(fname, flags)
|
||||
local f = fs.open(fname, flags or "r")
|
||||
if f then
|
||||
local t = f.readAll()
|
||||
f.close()
|
||||
|
Loading…
Reference in New Issue
Block a user