<!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>"width<strong>x</strong>height [r g b] -<strong>r</strong>[resolution]"</em> in C "<em><strong><tt>%dx%d %p %p %p -r%g" or </tt></strong>"width<strong>x</strong>height [r g b a] -<strong>r</strong>[resolution] -<strong>a</strong>"</em> in C "<em><strong><tt>%dx%d %p %p %p %p -r%g -a"</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 "x" 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 "3.78 pixels/mm" (96 DPI). </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) -> (imagergb: cdImageRGB or cdImageRGBA) [in Lua]<br> cd.ImageRGBBitmap(canvas: cdCanvas) -> (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> & <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>"<strong><font face="Courier">REDIMAGE</font></strong>", "<strong><font face="Courier">GREENIMAGE</font></strong>", "<strong><font face="Courier">BLUEIMAGE</font></strong>", "<span style="font-family: Courier"><strong>ALPHA</strong></span><strong><font face="Courier">IMAGE</font></strong>": return the respective pointers of the canvas image (read-only). Not accessible in Lua.</li> </ul> <ul> <li>"<b><font face="Courier">ANTIALIAS</font></b>": controls the use of anti-aliasing for line primitives. Assumes values "1" (active) and "0" (inactive). Default value: "1". Notice that text is always antialiased.</li> </ul> <ul> <li>"<b><font face="Courier">ROTATE</font></b>": 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 ("%g %d %d" = angle x y). In this driver will change the current transformation matrix, if removed will reset the current transformation matrix.</li> </ul> </body> </html>