<!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>Server Images</title> <link rel="stylesheet" type="text/css" href="../../style.css"> </head> <body> <h2 align="center">Server Images</h2> <p>It is a high performance image compatible with a specific canvas. It is faster than user image functions, but less flexible. It is commonly used for off-screen drawing in Window Systems. </p> <p>You can make gets and puts on several canvases but they must be created using the same driver. It is possible to specify a part of the image to be drawn, but it is not possible to zoom.</p> <p>It is called "server" images because the data is stored in a system private format, that the application (or the client) does not have access.</p> <p>To create a server image there must be an active canvas of a driver with server image support. Only the base drivers Win32, GDI+, X-Windows, XRender and Cairo, support server images.</p> <hr> <div class="function"><pre class="function"><span class="mainFunction">cdImage* <a name="cdCreateImage">cdCanvasCreateImage</a>(cdCanvas* canvas, int w, int h); [in C]</span> canvas:CreateImage(w, h: number) -> (image: cdImage) [in Lua]</pre> <p>Creates a compatible image with size = <b><tt>w x h</tt></b> pixels. A compatible image has the same color representation (number of bits per pixel) of the active canvas. Once the server image is created it is independent of the active canvas. The server image can only be used with an other canvas of the same type as the canvas that was active when the image was created. The default background is the same as the canvas, <strong><tt>CD_WHITE</tt></strong>.</p> </div><div class="function"><pre class="function"><span class="mainFunction">void <a name="cdKillImage">cdKillImage</a>(cdImage* image); [in C]</span> image:KillImage() [in Lua]</pre> <p>Liberates memory allocated for the image. If this function is not called in Lua, the garbage collector will call it.</p> </div><div class="function"><pre class="function"><span class="mainFunction">void <a name="cdGetImage">cdCanvasGetImage</a>(cdCanvas* canvas, cdImage* image, int x, int y); [in C]</span> canvas:GetImage(image: cdImage; x, y: number) [in Lua]</pre> <p>Copies a rectangular region from the current rectangular context to the memory <strong>(</strong><b><tt>image</tt></b><strong>)</strong>. <b><tt>(x,y)</tt></b> is the coordinate of the bottom left corner of the rectangular region. The width and length of the rectangular region are defined in the image structure (when the image is created).</p> </div><div class="function"><pre class="function"><span class="mainFunction">void <a name="cdPutImageRect">cdCanvasPutImageRect</a>(cdCanvas* canvas, cdImage* image, int x, int y, int xmin, int xmax, int ymin, int ymax); [in C]</span> void wdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax); (WC) [in C] canvas:PutImageRect(image: cdImage; x, y, xmin, xmax, ymin, ymax: number) [in Lua] canvas:wPutImageRect(image: cdImage; x, y, xmin, xmax, ymin, ymax: number) (WC) [in Lua]</pre> <p>Copies an image in a rectangular region of the canvas with the bottom left corner in <tt><b>(x,y)</b></tt>. Allows specifying a rectangle inside the image to be drawn, if <strong><font>xmin</font>, <font>xmax</font>, <font>ymin</font> </strong> and <strong><font>ymax</font></strong> are 0, then the whole image is assumed.</p> </div><div class="function"><pre class="function"><span class="mainFunction">void <a name="cdScrollArea">cdCanvasScrollArea</a>(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax, int dx, int dy); [in C]</span> canvas:ScrollArea(xmin, xmax, ymin, ymax, dx, dy: number) [in Lua]</pre> <p>Copies the rectangle defined by the coordinates <b><tt>(xmin,ymin)</tt></b> and <b><tt>(xmax,ymax)</tt></b> to the rectangle defined by <b><tt> (xmin+dx,ymin+dy)</tt></b> and <b><tt>(xmax+dx,ymax+dy)</tt></b>. It has the same effect as <b><tt>cdGetImage</tt></b> followed by <tt><b>cdPutImage</b></tt>, but it should be faster and does not require the explicit creation of an image to be executed. Note that the region belonging to the first rectangle, but not to the second, remains unchanged (the function does not clean this region). </p> </div> </body> </html>