- The color is represented by a number, an RGBA value (one byte per primary color and one byte for alpha channel).
- A RGBA color can be represented as an hexadecimal number : 0xRRGGBBAA , RR meaning a 8bit hexadecimal red value, and so on.
Canvas.color read/write property
Get or set the Canvas drawing color.
Example
local ui = require "ui"
require "canvas"
-- create a simple window
local win = ui.Window("canvas.color sample", "fixed", 500, 400)
local canvas = ui.Canvas(win)
canvas.align = "all"
canvas:clear(0x000000FF)
canvas:flip()
-- don't use onPaint()
canvas.sync = false
win:show()
-- update user interface
repeat
canvas:begin()
for i=1,10 do
canvas:fillellipse(math.random(500), math.random(400), 10, 10, math.random(0xFFFFFFFF))
end
canvas:flip()
ui.update()
until not win.visible