<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <title>General Attributes</title> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="../../style.css"> </head> <body> <h2 align="center">General Attributes</h2> <pre class="function"><span class="mainFunction">long int <a name="cdForeground">cdCanvasForeground</a>(cdCanvas* canvas, long int color); [in C]</span> void cdCanvasSetForeground(cdCanvas* canvas, long int color); [in C] canvas:Foreground(color: lightuserdata) -> (old_color: lightuserdata) [in Lua] canvas:SetForeground(color: lightuserdata) [in Lua]</pre> <p>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: <b> <tt>CD_BLACK</tt></b>. Value <tt><b>CD_QUERY</b> </tt>simply returns the current value.</p> <p>Notice that CD_QUERY conflicts with color RGBA=(255,255,255,0) (full transparent white). Use <strong>SetForeground</strong> to avoid the conflict. See also <a href="color.html">Color Coding</a>.</p> <pre class="function"><span class="mainFunction">long int <a name="cdBackground">cdCanvasBackground</a>(cdCanvas* canvas, long int color); [in C]</span> void cdCanvasSetBackground(cdCanvas* canvas, long int color); [in C] canvas:Background(color: lightuserdata) -> (old_color: lightuserdata) [in Lua] canvas:SetBackground(color: lightuserdata) [in Lua]</pre> <p>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 <strong>Clear</strong> function. The background color only makes sense for <strong>Clear</strong><tt><font> </font></tt>and for primitives affected by the background opacity attribute. Default value: <b><tt>CD_WHITE</tt></b>. Value <tt><b>CD_QUERY</b> </tt>simply returns the current value.</p> <p>Notice that CD_QUERY conflicts with color RGBA=(255,255,255,0) (full transparent white). Use <strong>SetBackground</strong> to avoid the conflict. See also <a href="color.html">Color Coding</a>.</p> <pre class="function"><span class="mainFunction">int <a name="cdWriteMode">cdCanvasWriteMode</a>(cdCanvas* canvas, int mode); [in C]</span> canvas:WriteMode(mode: number) -> (old_mode: number) [in Lua]</pre> <p>Defines the writing type for all drawing primitives. Values: <b><tt>CD_REPLACE</tt></b>, <b><tt>CD_XOR</tt></b> or <b><tt>CD_NOT_XOR</tt></b>. Returns the previous value. Default value: <b><tt>CD_REPLACE</tt></b>. Value <tt><b>CD_QUERY</b> </tt> simply returns the current value. </p> <p>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.</p> </body> </html>