summaryrefslogtreecommitdiff
path: root/html/en/func/server.html
blob: 6663de502f3266190948afb99bc73d331844fe06 (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
<!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 &quot;server&quot; 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.</p>

<hr>
<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) -&gt; (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>

<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>

<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>

<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>

<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>


</body>

</html>