summaryrefslogtreecommitdiff
path: root/html/en/func/attributes.html
blob: 60768e4ffded7dd077754c49d24acc3c67e03436 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!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) -&gt; (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,255) (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) -&gt; (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,255) (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) -&gt; (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>