General Attributes
long int cdCanvasForeground(cdCanvas* canvas, long int color); [in C]
void cdCanvasSetForeground(cdCanvas* canvas, long int color); [in C]
canvas:Foreground(color: lightuserdata) -> (old_color: lightuserdata) [in Lua]
canvas:SetForeground(color: lightuserdata) [in Lua]
Configures a new current foreground color and returns the previous one. This color is used in all primitives (lines, areas, marks and text). Default value: CD_BLACK. Value CD_QUERY simply returns the current value.
Notice that CD_QUERY conflicts with color RGBA=(255,255,255,255) (full transparent white). Use SetForeground to avoid the conflict. See also Color Coding.
long int cdCanvasBackground(cdCanvas* canvas, long int color); [in C]
void cdCanvasSetBackground(cdCanvas* canvas, long int color); [in C]
canvas:Background(color: lightuserdata) -> (old_color: lightuserdata) [in Lua]
canvas:SetBackground(color: lightuserdata) [in Lua]
Configures the new current background color and returns the previous one. However, it does not automatically change the background of a canvas. For such, it is necessary to call the Clear function. The background color only makes sense for Clear and for primitives affected by the background opacity attribute. Default value: CD_WHITE. Value CD_QUERY simply returns the current value.
Notice that CD_QUERY conflicts with color RGBA=(255,255,255,255) (full transparent white). Use SetBackground to avoid the conflict. See also Color Coding.
int cdCanvasWriteMode(cdCanvas* canvas, int mode); [in C]
canvas:WriteMode(mode: number) -> (old_mode: number) [in Lua]
Defines the writing type for all drawing primitives. Values: CD_REPLACE, CD_XOR or CD_NOT_XOR. Returns the previous value. Default value: CD_REPLACE. Value CD_QUERY simply returns the current value.
Note: operation XOR is very useful, because, using white as the foreground color and drawing the same image twice, you can go back to the original color, before the drawing. This is commonly used for mouse selection feedback.