cc-mek-scada/graphics/elements/colormap.lua

38 lines
841 B
Lua
Raw Permalink Normal View History

2022-08-01 16:05:39 +00:00
-- Color Map Graphics Element
local element = require("graphics.element")
---@class colormap_args
---@field parent graphics_element
---@field id? string element id
---@field x? integer 1 if omitted
2023-07-10 03:42:44 +00:00
---@field y? integer auto incremented if omitted
---@field hidden? boolean true to hide on initial draw
2022-08-01 16:05:39 +00:00
-- new color map
---@param args colormap_args
---@return graphics_element element, element_id id
local function colormap(args)
local bkg = "008877FFCCEE114455DD9933BBAA2266"
local spaces = string.rep(" ", 32)
2022-08-01 16:05:39 +00:00
args.width = 32
args.height = 1
-- create new graphics element base object
local e = element.new(args)
-- draw color map
function e.redraw()
e.w_set_cur(1, 1)
e.w_blit(spaces, bkg, bkg)
end
-- initial draw
e.redraw()
2022-08-01 16:05:39 +00:00
return e.complete()
2022-08-01 16:05:39 +00:00
end
return colormap