2022-08-01 16:05:39 +00:00
|
|
|
-- Color Map Graphics Element
|
|
|
|
|
|
|
|
local util = require("scada-common.util")
|
|
|
|
|
|
|
|
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
|
2023-05-25 21:40:16 +00:00
|
|
|
---@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 = util.spaces(32)
|
|
|
|
|
|
|
|
args.width = 32
|
|
|
|
args.height = 1
|
|
|
|
|
|
|
|
-- create new graphics element base object
|
|
|
|
local e = element.new(args)
|
|
|
|
|
|
|
|
-- draw color map
|
|
|
|
e.window.setCursorPos(1, 1)
|
|
|
|
e.window.blit(spaces, bkg, bkg)
|
|
|
|
|
2023-05-30 23:51:10 +00:00
|
|
|
return e.complete()
|
2022-08-01 16:05:39 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return colormap
|