summaryrefslogtreecommitdiff
path: root/html/en/drv/irgb.html
blob: 3ab71f46c057052fab34ff916985727df5b4eb2c (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>CD_IMAGERGB</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<h2>CD_IMAGERGB - RGB Client Image Driver (cdirgb.h)</h2>

  <p>This driver allows access to a Client Image, an imaged based in RGB colors with 24 
  or 32 bits per pixel (8 per channel). 
  It is used to implement high-quality offscreen drawings, but is slower than the Server Image version. In fact, it is a 
  rasterizer, that is, it converts vector primitives into a raster representation. All primitives are implemented by the 
  library and are not system-dependent (the primitives of the Server Image version are system-dependent).</p>

<h3>Use</h3>

  <p>The canvas is created by means of a call to the function <font face="Courier">
  <a href="../func/init.html#cdCreateCanvas"><strong>cdCreateCanvas</strong></a>(CD_IMAGERGB, 
  Data)</font>, after which other functions in the CD library can be called as usual. The function creates an RGB image, 
  and then a CD canvas. The <font face="Courier">Data</font> parameter string has the following format:</p>
  
    <pre><em>&quot;width<strong>x</strong>height [r g b] -<strong>r</strong>[resolution]&quot;</em>      in C &quot;<em><strong><tt>%dx%d %p %p %p -r%g&quot;
or
</tt></strong>&quot;width<strong>x</strong>height [r g b a] -<strong>r</strong>[resolution] -<strong>a</strong>&quot;</em>    in C &quot;<em><strong><tt>%dx%d %p %p %p %p -r%g -a&quot;</tt></strong></em></pre>
  
  <p>It must include the canvas' dimensions.<font face="Courier"> Width</font> and <font face="Courier">height</font> 
  are provided in pixels (note the lowercase &quot;x&quot; between them). As an option, you can specify the buffers to be used by 
  the driver, so that you can draw over an existing image. The resolution can be defined with parameter
  <font face="Courier">-r</font>; its default value is &quot;3.78 pixels/mm&quot; (96 DPI).&nbsp;</p>
<p>When the parameter -a is specified an alpha channel will be added to the 
canvas underlying image. All primitives will be composed using an over operator 
if the foreground or background colors have alpha components. This channel is 
initialized with transparent (0). The other channels are initialized with white 
(255, 255, 255). After drawing in the RGBA image the resulting alpha channel can 
be used to compose the image in another canvas.</p>
<p>All channels are initialized only when allocated internally by the driver. 
They are not initialized when allocated by the application.</p>
  <p>Any amount of such canvases may exist simultaneously. It is important to note that a call to function
  <a href="../func/init.html#cdKillCanvas"><strong>cdKillCanvas</strong></a> is required to 
  release internal allocated memory.</p>
  <p>In Lua, the canvas can be created in two ways: with an already defined image or without it. With an image, an RGB 
  image must be passed as parameter, created by functions <strong>
  <a href="../func/client.html#cdCreateImageRGB">cd.CreateImageRGB</a>,</strong> 
  <strong><a href="../func/client.html#cdCreateImageRGBA">cd.CreateImageRGBA</a></strong> or <strong>
  <a href="../func/client.html#cdCreateBitmap">cd.CreateBitmap</a></strong> 
  in Lua. The resolution must be passed in an extra parameter after the image.</p>

<h3>Exclusive Functions</h3>

<h4><font face="Courier">cd.ImageRGB(canvas: cdCanvas) -&gt; (imagergb: cdImageRGB 
or cdImageRGBA) [in Lua]<br>
cd.ImageRGBBitmap(canvas: cdCanvas) -&gt; (bitmap: cdBitmap) [in Lua]</font></h4>

  <p>Returns the canvas' internal image.</p>

<h3>Behavior of Functions</h3>

  <p>All primitives are from the Simulation driver, see the <a href="sim.html">Simulation</a> driver's documentation for 
  further information.</p>

<h4>Control</h4>
<ul>
  <li><a href="../func/control.html#cdFlush"><font face="Courier"><strong>Flush</strong></font></a>: 
  does nothing.</li>
  <li><a href="../func/other.html#cdPlay"><font face="Courier"><strong>Play</strong></font></a>: 
  does nothing, returns <font face="Courier">CD_ERROR</font>. </li>
</ul>
<h4>Coordinate System and Clipping </h4>
<ul>
  <li><a href="../func/coordinates.html#cdUpdateYAxis"><font face="Courier">
  <strong>UpdateYAxis</strong></font></a>: does nothing. The axis orientation is the same as the CD library's.</li>
</ul>
<h4>Colors </h4>
<ul>
  <li><a href="../func/color.html#cdGetColorPlanes"><font face="Courier">
  <strong>
  GetColorPlanes</strong></font></a>: returns 24 if no alpha, returns 32 if 
  exists an alpha channel.</li>
  <li><a href="../func/color.html#cdPalette"><font face="Courier"><strong>Palette</strong></font></a>: 
  does nothing.</li>
  <li><a href="../func/attributes.html#cdForeground"><font face="Courier">
  <strong>
  Foreground</strong></font></a> &amp;
  <a href="../func/attributes.html#cdBackground">
  <font face="Courier"><strong>Background</strong></font></a>: accepts the transparency information encoded in the 
  color.</li>
</ul>
<h4>Exclusive Attributes</h4>
<ul>
  <li>&quot;<strong><font face="Courier">REDIMAGE</font></strong>&quot;, &quot;<strong><font face="Courier">GREENIMAGE</font></strong>&quot;, 
  &quot;<strong><font face="Courier">BLUEIMAGE</font></strong>&quot;, &quot;<span style="font-family: Courier"><strong>ALPHA</strong></span><strong><font face="Courier">IMAGE</font></strong>&quot;: return the respective pointers of the canvas image (read-only). Not accessible in Lua.</li>
</ul>

<ul>
  <li>&quot;<b><font face="Courier">ANTIALIAS</font></b>&quot;: controls the use of anti-aliasing 
  for line primitives. Assumes values &quot;1&quot; (active) and &quot;0&quot; (inactive). Default value: &quot;1&quot;. 
  Notice that text is always antialiased.</li>
</ul>

<ul>
  <li>&quot;<b><font face="Courier">ROTATE</font></b>&quot;:&nbsp; allows the usage of 1 
  angle and 1 coordinate (x, y), that define a global rotation transformation 
  centered in the specified coordinate. Use 1 real and 2 integer values inside a 
  string (&quot;%g %d %d&quot; = angle x y). In this driver will change the 
  current transformation matrix, if removed will reset the current 
  transformation matrix.</li>
</ul>

</body>

</html>