]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/net/vnc_server/v2_0/doc/vnc-server.html
Initial revision
[karo-tx-redboot.git] / packages / net / vnc_server / v2_0 / doc / vnc-server.html
1 <html>
2 <head>
3 <title>VNC server for eCos</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5 </head>
6
7 <body bgcolor="#FFFFFF">
8 <h1>VNC server for eCos</h1>
9 <h2>Introduction</h2>
10 <p>VNC stands for Virtual Network Computing. It is in essence, a remote display 
11   system which allows you to view a computing 'desktop' environment not only on 
12   the machine where it is running, but from anywhere on the Internet and from 
13   a wide variety of machine architectures. For full details of VNC, and to get 
14   the vncviewer program see: <a href="http://www.uk.research.att.com/vnc/" target="VNC_PAGE">http://www.uk.research.att.com/vnc/</a>. 
15 </p>
16 <p>The VNC server for eCos runs on the target platform and waits for a client 
17   (vncviewer program running on a PC) to connect via an ethernet connection (port 
18   5900). Once a client has connected, the target platform has a virtual screen, 
19   keyboard and mouse.</p>
20 <p>&nbsp;</p>
21 <h2>Limitations</h2>
22 <p>The eCos port of the VNC server has been designed with some limitations in 
23   order to keep memory and processor power requirements to a minimum.</p>
24 <ol>
25   <li>The VNC client must accept the settings that the VNC server suggests (bits-per-pixel, 
26     number-of-colours and so on as specified at build time with the eCos configuration 
27     tool) or the VNC server will just disconnect.</li>
28   <li>The VNC server only supports CoRRE encoding and RAW encoding for sending 
29     display data to the client.</li>
30   <li>The VNC server does not support password authentication, the client is able 
31     to connect without the user typing in a password.</li>
32   <li>Only one VNC client may connect to the VNC server at a time.</li>
33 </ol>
34 <p>In reality these limitations are not a problem.</p>
35 <p>&nbsp;</p>
36 <h2>VNC server API</h2>
37 <p>If the VNC server is to be used with the eCos port of MicroWindows, then VNC 
38   server API may be ignored and the application should just use one of the API 
39   supplied by MicroWindows.</p>
40 <h3>VNC server display API</h3>
41 <p>To use the VNC server display API the application should include the VNC server 
42   header file by adding the following line to their C application:</p>
43 <p><font face="Courier New, Courier, mono"><font size="-1">#include &lt;vnc-server.h&gt; 
44   &nbsp;&nbsp;/* VNC server header file *</font></font></p>
45 <p>This file specifies several function to manipulate the display.</p>
46 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
47   <tr> 
48     <td> 
49       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"><b>vnc_frame_forma</b></font><b><font face="Courier New, Courier, mono">t_t* 
50         VncGetInfo(void)</font></b></font></p>
51       <p>The VNC get info function returns a pointer to a 'vnc_frame_format_t' 
52         type structure and is used to get information about the VNC display. 'vnc_frame_format_t' 
53         is defined in the vnc-server.h file as:</p>
54       <p><font face="Courier New, Courier, mono" size="-1">typedef struct<br>
55         {<br>
56         &nbsp;&nbsp;&nbsp;&nbsp;cyg_uint16 frame_width;<br>
57         &nbsp;&nbsp;&nbsp;&nbsp;cyg_uint16 frame_height;<br>
58         &nbsp;&nbsp;&nbsp;&nbsp;void * frame_buffer;<br>
59         &nbsp;&nbsp;&nbsp;&nbsp;bool rgb332;<br>
60         &nbsp;&nbsp;&nbsp;&nbsp;</font><font face="Courier New, Courier, mono" size="-1">bool 
61         rgb555;<br>
62         &nbsp;&nbsp;&nbsp;&nbsp;bool rgb565;<br>
63         &nbsp;&nbsp;&nbsp;&nbsp;</font><font face="Courier New, Courier, mono" size="-1">bool 
64         bgr233;<br>
65         } vnc_frame_format_t;</font></p>
66       <p>The frame_width and frame height fields contain the VNC server display 
67         size in pixels.</p>
68       <p>The * frame_buffer pointer contains the address of the actual frame buffer 
69         the VNC server uses, though the application should never write to this 
70         buffer directly.</p>
71       <p>The final 4 (bool) fields specifiy the pixel format - only one of them 
72         will be set to true.</p>
73       </td>
74   </tr>
75 </table>
76 <p>&nbsp;</p><table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
77   <tr> 
78     <td> 
79       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"></font><b><font face="Courier New, Courier, mono">void 
80         VncInit(vnc_colour_t colour)</font></b></font></p>
81       <p>The VNC initialise function, initialises the VNC server and paints the 
82         display with the specified colour. This funcftion must be called before 
83         any of the other VNC server display functions are used, except for VncGetInfo() 
84         - which may be called at any time.</p>
85       <p>The type 'vnc_colour_t' is defined in the vnc-server.h file - and is 
86         used to represent a colour. If the VNC server is built to support 8-bit 
87         pixel data then 'vnc_colour_t' will be type cyg_uint8, but if 16-bit pixel 
88         data is being used then 'vnc_colour_t' will be type cyg_uint16.</p>
89       </td>
90   </tr>
91 </table>
92 <p>&nbsp;</p>
93 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
94   <tr> 
95     <td> 
96       <p><font face="Courier New, Courier, mono"><b><font face="Courier New, Courier, mono">void 
97         VncDrawPixel(cyg_uint16 x,<br>
98         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cyg_uint16 
99         y, <br>
100         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
101         vnc_colour_t colour)</font></b><font face="Courier New, Courier, mono"></font></font></p>
102       <p>The VNC draw pixel function simply draws a pixel of colour, 'colour', 
103         at position ('x', 'y') on the VNC server display. Note that pixel (0, 
104         0) is the top-left pixel in the display.</p>
105       </td>
106   </tr>
107 </table>
108 <p>&nbsp;</p>
109 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
110   <tr> 
111     <td> 
112       <p><font face="Courier New, Courier, mono"><b><font face="Courier New, Courier, mono">vnc_colour_t 
113         VncReadPixel(cyg_uint16 x<br>
114         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
115         cyg_uint16 y)</font></b></font></p>
116       <p>The VNC read pixel function simply returns the colour of the pixel at 
117         position ('x', 'y') on the VNC server display. Note that pixel (0, 0) 
118         is the top-left pixel in the display.</p>
119       </td>
120   </tr>
121 </table>
122 <p>&nbsp;</p><table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
123   <tr> 
124     <td> 
125       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"></font><b>void 
126         VncDrawHorzLine(cyg_uint16 x1,<br>
127         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
128         cyg_uint16 x2, <br>
129         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
130         cyg_uint16 y, <br>
131         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
132         vnc_colour_t colour)</b></font></p>
133       <p>The VNC draw horizontal line function simply draws a line of pixels of 
134         colour, 'colour', from position ('x1', 'y') to position ('x2', 'y') (inclusive) 
135         on the VNC server display. Note that pixel (0, 0) is the top-left pixel 
136         in the display.</p>
137     </td>
138   </tr>
139 </table>
140 <p>&nbsp;</p>
141 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
142   <tr> 
143     <td> 
144       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"></font><b><font face="Courier New, Courier, mono">void 
145         VncDrawVertLine(cyg_uint16 x,<br>
146         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
147         cyg_uint16 y1,<br>
148         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
149         cyg_uint16 y2, <br>
150         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
151         vnc_colour_t colour)</font></b></font></p>
152       <p>The VNC draw vertical line function simply draws a line of pixels of 
153         colour, 'colour', from position ('x', 'y1') to position ('x', 'y2') (inclusive) 
154         on the VNC server display. Note that pixel (0, 0) is the top-left pixel 
155         in the display.</p>
156     </td>
157   </tr>
158 </table>
159 <p>&nbsp;</p>
160 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
161   <tr> 
162     <td> 
163       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"></font><b><font face="Courier New, Courier, mono">void 
164         VncFillRect(cyg_uint16 x1,<br>
165         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
166         cyg_uint16 y1,<br>
167         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
168         cyg_uint16 x2, <br>
169         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
170         cyg_uint16 y2, <br>
171         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
172         vnc_colour_t colour)</font></b></font></p>
173       <p>The VNC fill rectangle function draws a solid rectangle of colour, 'colour', 
174         with top-left corner at ('x1', 'y1') and bottom right corner at ('x2', 
175         'y2') (inclusive) on the VNC server display. Note that pixel (0, 0) is 
176         the top-left pixel in the display.</p>
177     </td>
178   </tr>
179 </table>
180 <p>&nbsp;</p>
181 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
182   <tr> 
183     <td> 
184       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"></font><b>void 
185         VncCopyRect(cyg_uint16 x1,<br>
186         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
187         cyg_uint16 y1, <br>
188         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
189         cyg_uint16 width, <br>
190         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
191         cyg_uint16 height,<br>
192         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
193         cyg_uint16 x2,<br>
194         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
195         cyg_uint16 y2)</b></font></p>
196       <p>The VNC copy rectangle function copies a rectangle from one part of the 
197         VNC display to another. The source rectangle is of width 'width', and 
198         height 'height', with its top-left corner at ('x1', 'y1'). The destination 
199         rectangle is the same size with its top-left corner at ('x2', 'y2'). Note 
200         that pixel (0, 0) is the top-left pixel in the display.</p>
201       </td>
202   </tr>
203 </table>
204 <p>&nbsp;</p>
205 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
206   <tr> 
207     <td> 
208       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"></font><b>void 
209         VncCopyRect2Buffer(cyg_uint16 x,<br>
210         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
211         cyg_uint16 y,<br>
212         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
213         cyg_uint16 width,<br>
214         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
215         cyg_uint16 height,<br>
216         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
217         void *buffer,<br>
218         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
219         cyg_uint16 buff_w,<br>
220         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
221         cyg_uint16 buff_h,<br>
222         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
223         cyg_uint16 x_off,<br>
224         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
225         cyg_uint16 y_off)</b></font></p>
226       <p>The VNC copy rectangle to buffer function copies a rectangle of the VNC 
227         server display to a buffer supplied by the application. This function 
228         is useful for saving areas of the display which will need to be restored 
229         later, such as the area under a mouse cursor.</p>
230       <p>The rectangle of the display to be copied is of width 'width' and height 
231         'height' with its top-left corner at position ('x', 'y'). The address 
232         of the buffer supplied to copy the image data is specified by '*buffer'. 
233         This buffer is of width 'buff_w' and height 'buff_height'. If the buffer 
234         width and height is larger than the rectangle being copied from the display, 
235         an x and y offset may be supplied ('x_off' and 'y_off' respectively) to 
236         offset where the rectangle of display data in the buffer.</p>
237       <p>For example a buffer of width = 50 and height = 40 could be defined with:</p>
238       <p><font face="Courier New, Courier, mono"><font size="-1">vnc_colour_t 
239         my_buffer[40][50];</font></font></p>
240       <p>Then VncCopyRect2Buffer() could be called with:</p>
241       <p><font face="Courier New, Courier, mono"><font size="-1">VncCopyRect2Buffer(10, 
242         &nbsp;/* x-pos on display */<br>
243         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10, 
244         &nbsp;/* y-pos on display */</font></font><br>
245         <font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;30, 
246         &nbsp;/* rectangle width on display */</font></font> <br>
247         <font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20, 
248         &nbsp;/* rectangle heigth on display */</font></font> <br>
249         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face="Courier New, Courier, mono"><font size="-1">(void 
250         *)my_buffer, /* Address of buffer */<br>
251         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;50, 
252         &nbsp;/* buffer width */</font></font> <font size="-1"> <br>
253         </font><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40, 
254         &nbsp;/* buffer height */</font></font> <br>
255         </font></font><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5, 
256         &nbsp;&nbsp;/* buffer x-offset */</font></font> <font size="-1"> <br>
257         </font><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6); 
258         &nbsp;/* buffer y-offset */</font></font> <font size="-1"> </font></font><font size="-1"> 
259         <br>
260         </font></font></font></p>
261       <p>This would copy a 30 pixel wide, 20 pixel high rectangle from (10, 10) 
262         of the VNC server display to the buffer 'my_buffer'. Inside the buffer 
263         there would by an x-offset of 5 and a y offset of 6. Thus pixel (10, 10) 
264         from the VNC server display would now be copied to my_buffer[6][5] - and 
265         so on for the rest of the rectangle.</p>
266       </td>
267   </tr>
268 </table>
269 <p>&nbsp; </p>
270 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
271   <tr> 
272     <td> 
273       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"></font><b>void 
274         VncCopyBuffer2Rect(void *buffer,<br>
275         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
276         cyg_uint16 buff_w,<br>
277         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
278         cyg_uint16 buff_h, <br>
279         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
280         cyg_uint16 x_off,<br>
281         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
282         cyg_uint16 y_off,<br>
283         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
284         cyg_uint16 x, <br>
285         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
286         cyg_uint16 y,<br>
287         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
288         cyg_uint16 width,<br>
289         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
290         cyg_uint16 height)</b></font></p>
291       <p>The VNC copy buffer to rectangle function copies a rectangle from a buffer 
292         supplied by the application to the VNC server display. This function is 
293         usefull for restoring previously saved areas of the display.</p>
294       <p>For example, to restore the rectangle saved in the previous example use 
295         of the VncCopyRect2Buffer() function above, the VncCopyBuff2Rect() would 
296         be called with:</p>
297       <p><font face="Courier New, Courier, mono"><font size="-1">VncCopyBuffer2Rect(</font><font face="Courier New, Courier, mono"><font size="-1">(void 
298         *)my_buffer, /* Address of buffer */</font></font><font size="-1"><br>
299         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;50, 
300         &nbsp;/* buffer width */</font></font> <font size="-1"> <br>
301         </font><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40, 
302         &nbsp;/* buffer height */</font></font> <br>
303         </font></font><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5, 
304         &nbsp;&nbsp;/* buffer x-offset */</font></font> <font size="-1"> <br>
305         </font><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6, 
306         &nbsp;&nbsp;/* buffer y-offset */</font></font> <font size="-1"> </font></font><br>
307         </font></font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10, 
308         &nbsp;/* x-pos on display */<br>
309         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10, 
310         &nbsp;/* y-pos on display */</font></font><br>
311         <font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;30, 
312         &nbsp;/* rectangle width on display */</font></font> <br>
313         <font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20); 
314         /* rectangle heigth on display */</font></font> </p>
315       <p>Note that in most uses of the VncCopyBuff2Rect() and VncCopyRect2Buffer() 
316         functions would be called with:<br>
317         &nbsp;&nbsp;&nbsp;&nbsp;width = buff_w<br>
318         &nbsp;&nbsp;&nbsp;&nbsp;heigth = buff_h<br>
319         &nbsp;&nbsp;&nbsp;&nbsp;x_off = 0<br>
320         &nbsp;&nbsp;&nbsp;&nbsp;y_off = 0.</p>
321       <p>In this case there is no offset into the buffer and the buffer is used 
322         100% to store the rectangle from the display. <font face="Courier New, Courier, mono"><font size="-1"> 
323         </font></font></p>
324       </td>
325   </tr>
326 </table>
327 <p>&nbsp;</p><table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
328   <tr> 
329     <td> 
330       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"></font><b>void 
331         VncCopyBuffer2RectMask(void *buffer,<br>
332         &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
333         cyg_uint16 buff_w,<br>
334         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
335         cyg_uint16 buff_h, <br>
336         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
337         cyg_uint16 x_off,<br>
338         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
339         cyg_uint16 y_off,<br>
340         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
341         cyg_uint16 x, <br>
342         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
343         cyg_uint16 y,<br>
344         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
345         cyg_uint16 width,<br>
346         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
347         cyg_uint16 height,<br>
348         <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vnc_colour_t 
349         mask_colour</font> )</b></font></p>
350       <p>The VNC copy buffer to rectangle with mask function works exactly like 
351         VncCopyRect2Buffer(), except that a mask colour is also specified. Any 
352         pixels in the buffer that have the value mask_colour, will not be copied 
353         to the frame buffer - leaving the original pixels untouched.<font face="Courier New, Courier, mono"><font size="-1"> 
354         </font></font></p>
355     </td>
356   </tr>
357 </table>
358 <p>&nbsp;</p>
359 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
360   <tr> 
361     <td> 
362       <p><font face="Courier New, Courier, mono"><font face="Courier New, Courier, mono"></font><b>vnc_printf_return_t 
363         VncPrintf(MWCFONT* font,<br>
364         </b></font><font face="Courier New, Courier, mono"><b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int 
365         do_print,<br>
366         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vnc_colour_t 
367         colour,<br>
368         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int 
369         x,<br>
370         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int 
371         y,<br>
372         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const 
373         char *fmt, ... );)</b></font></p>
374       <p>The VNC printf function writes test to a specified position in the VNC 
375         frame buffer, using the specified font and colour.</p>
376       <p>The '* font' argument is a pointer to a MWCFONT font structure. This 
377         is the same font structure as used by MicroWindows, though the VNC server 
378         has its own copy of the font description files. The available fonts are:</p>
379       <p>&nbsp;&nbsp;&nbsp;&nbsp;font_rom8x16<br>
380         &nbsp;&nbsp;&nbsp;&nbsp;font_rom8x8<br>
381         &nbsp;&nbsp;&nbsp;&nbsp;font_winFreeSansSerif11x13<br>
382         &nbsp;&nbsp;&nbsp;&nbsp;font_winFreeSystem14x16<br>
383         &nbsp;&nbsp;&nbsp;&nbsp;font_helvB10<br>
384         &nbsp;&nbsp;&nbsp;&nbsp;font_helvB12<br>
385         &nbsp;&nbsp;&nbsp;&nbsp;font_helvR10<br>
386         &nbsp;&nbsp;&nbsp;&nbsp;font_X5x7<br>
387         &nbsp;&nbsp;&nbsp;&nbsp;font_X6x13</p>
388       <p>If the font argument is set to '0', then the default font (winFreeSystem14x16) 
389         is used.</p>
390       <p>The 'do_print' argument is used to specify whether the function should 
391         actually write the text to the frame buffer. If do_print is non-zero, 
392         then the text will be written to the frame buffer. If do_print is zero, 
393         then no text will be written, but the return value from the function will 
394         sill be valid.</p>
395       <p>The 'colour' argument specifies the colour to use to write the text.</p>
396       <p>The 'x' and 'y' arguments specify the pixel position (x, y) in the frame 
397         buffer of the top left pixel of the first character to be printed.</p>
398       <p>The 'const char *fmt, ...' argumets are used as in a normal printf statement.</p>
399       <p>The function returns a data structure of type vnc_printf_return_t, this 
400         is defined as:</p>
401       <p>&nbsp;&nbsp;&nbsp;&nbsp;typedef struct<br>
402         &nbsp;&nbsp;&nbsp;&nbsp;{<br>
403         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int chars;<br>
404         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cyg_uint16 width;<br>
405         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cyg_uint16 height;<br>
406         &nbsp;&nbsp;&nbsp;&nbsp;} vnc_printf_return_t;</p>
407       <p>The 'chars' values is exactly as would have been returned by the printf() 
408         function.</p>
409       <p>The width and height attributes specify the width and height of a rectangle 
410         surrounding the text written to the screen. This data can be used to know 
411         how much of the frame buffer needs to be painted to delete the text, or 
412         (used together with the 'do_print' argument set to 0) to calculate how 
413         much of the screen should be saved before printing to it so that it may 
414         be restored later.</p>
415       <p>An example of writing some text to position (250, 200) of the frame buffer, 
416         using the colout cyan and the font, winFreeSansSerif11x13:</p>
417       <p><font face="Courier New, Courier, mono"></font><font face="Courier New, Courier, mono"><font size="-1">vnc_printf_return_t 
418         print_area;</font></font></p>
419       <p><font face="Courier New, Courier, mono"><font size="-1">print_area = 
420         VncPrintf(&font_winFreeSansSerif11x13,<br>
421         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1,<br>
422         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font><font size="-1"> 
423         VNC_CYAN, <br>
424         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font><font size="-1"> 
425         250,<br>
426         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font><font size="-1"> 
427         200,<br>
428         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font><font size="-1"> 
429         </font></font><font face="Courier New, Courier, mono"><font size="-1">"Hello 
430         World!\nUsing winFreeSansSerif11x13 font");</font></font></p>
431       <p>Note: 'print_area.width' and 'print_area.height' will be set to indicate 
432         how much of the frame buffer was used to print this text.</p>
433       <p>Another example, using the default font this time:</p>
434       <p><font face="Courier New, Courier, mono"><font size="-1">print_area = 
435         VncPrintf(0,<br>
436         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1,<br>
437         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font><font size="-1">VNC_BLACK, 
438         <br>
439         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font><font size="-1">250,<br>
440         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font><font size="-1">200,<br>
441         </font><font face="Courier New, Courier, mono"><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></font></font><font face="Courier New, Courier, mono"><font size="-1">"50 
442         * 34 = %d", 50*34);</font></font></p>
443       <p></p>
444       </td>
445   </tr>
446 </table>
447 <p>Also included in the vnc-server.h header file are 16 predefined colours:</p>
448 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
449   <tr> 
450     <td><font face="Courier New, Courier, mono"><b>VNC_BLACK<br>
451       VNC_BLUE<br>
452       VNC_GREEN<br>
453       VNC_CYAN<br>
454       VNC_RED<br>
455       VNC_MAGENTA<br>
456       VNC_BROWN<br>
457       VNC_LTGRAY<br>
458       VNC_LTGREY&nbsp; /* Same as VNC_LTGRAY */<br>
459       VNC_GRAY<br>
460       VNC_GREY&nbsp; /* Same as VNC_GRAY */<br>
461       VNC_LTBLUE<br>
462       VNC_LTGREEN<br>
463       VNC_LTCYAN<br>
464       VNC_LTRED<br>
465       VNC_LTMAGENTA<br>
466       VNC_YELLOW<br>
467       VNC_WHITE</b></font> 
468       <p>These colours are all of type vnc_colour_t and are always correct for the selected 
469         pixel type.</p>
470       </td>
471   </tr>
472 </table>
473 <p>Also contained in the vnc-server.h header file is a macro to convert from a 
474   full RGB colour value to the nearest colour that the type vnc_colour_t can represent. 
475   This macro is:</p>
476 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
477   <tr> 
478     <td>
479       <p><font face="Courier New, Courier, mono"><b>VNC_RGB2COL(red, green, blue)</b></font></p>
480       <p>The arguments red, green and blue each have a value from 0 to 255.</p>
481       <p>For example, to initialise the VNC server display with a colour as close 
482         to a very specific shade of green [red=156, green=229, blue=91] - the 
483         VncInit() function could be called as follows:</p>
484       <p><font face="Courier New, Courier, mono" size="-1">VncInit( VNC_RGB2COL(156, 
485         229, 91) );</font></p>
486       <p>Obviously the colour match will be better if the VNC server had been 
487         built with 16 bits per pixel rather than with 8 bits per pixel, but in 
488         each case the best available colour will be used.</p>
489     </td>
490   </tr>
491 </table>
492 <p>Though not strictly a display function, a function to sound a bell on the client 
493   is available.</p>
494 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
495   <tr> 
496     <td> 
497       <p><font face="Courier New, Courier, mono"><b><font face="Courier New, Courier, mono">void 
498         VncSoundBell(void)</font></b></font></p>
499       <p>The VNC Sound Bell function simply sounds a bell on the client - if the 
500         client supports this.</p>
501     </td>
502   </tr>
503 </table>
504 <p>&nbsp; </p>
505 <h3>VNC server mouse API</h3>
506 <p>The VNC server mouse device driver is a standard eCos IO device driver. The 
507   device name is &quot;/dev/vnc_mouse&quot; by default, but this may be modified 
508   with the configuration tool. The first step in using the mouse device driver 
509   is to use the cyg_io_lookup() function:</p>
510 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
511   <tr> 
512     <td> 
513       <p> <font face="Courier New, Courier, mono" size="-1">Cyg_ErrNo mouse_err;<br>
514         cyg_io_handle_t mouse_handle;<br>
515         cyg_uint8 mouse_data[8];<br>
516         cyg_uint32 mouse_len;</font><br>
517         <br>
518         <font face="Courier New, Courier, mono" size="-1">mouse_err = cyg_io_lookup("/dev/vnc_mouse", 
519         &mouse_handle); /* Open mouse device */ if (mouse_err == -ENOENT)<br>
520         { <br>
521         &nbsp;&nbsp;&nbsp;&nbsp;diag_printf("Could not open mouse device\n"); 
522         <br>
523         } </font></p>
524       </td>
525   </tr>
526 </table>
527 <p>Once the cyg_io_lookup() function has found the mouse device driver, the driver 
528   is active and should be read regularly to prevent the receive buffer from overflowing 
529   with data. Data is read using the cyg_io_read() function:</p>
530 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
531   <tr> 
532     <td> 
533       <p><font face="Courier New, Courier, mono" size="-1">mouse_len = 8;&nbsp;&nbsp;/* 
534         Try to read 8 bytes from mouse */ <br>
535         cyg_io_read(mouse_handle, mouse_data, &mouse_len ); <br>
536         if (mouse_len == 0)<br>
537         {<br>
538         &nbsp;&nbsp;&nbsp;&nbsp;diag_printf(&quot;Mouse has no new data\n&quot;);<br>
539         }<br>
540         else<br>
541         { <br>
542         &nbsp;&nbsp;&nbsp;&nbsp;diag_printf(&quot;Have New mouse data:\n&quot;);</font><br>
543         <font face="Courier New, Courier, mono" size="-1">&nbsp;&nbsp;&nbsp;&nbsp;<font face="Courier New, Courier, mono" size="-1">diag_printf(&quot;&nbsp;&nbsp;Mouse 
544         button data: 0x%x\n&quot;, mouse_data[1]);</font> </font> <br>
545         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face="Courier New, Courier, mono" size="-1">diag_printf(&quot;&nbsp;&nbsp;Mouse 
546         x-coord: %d\n&quot;, mouse_data[2]*256 + mouse_data[3]);</font><br>
547         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face="Courier New, Courier, mono" size="-1">diag_printf(&quot;&nbsp;&nbsp;Mouse 
548         y-coord: %d\n&quot;, mouse_data[4]*256 + mouse_data[5]);<br>
549         }</font> </p>
550       </td>
551   </tr>
552 </table>
553 <p>The cyg_io_read() function is a non-blocking function and each mouse event 
554   generates 8 bytes of data:</p>
555 <p>Byte 0: Padding - always zero<br>
556   Byte 1: Button data (bit 0 = 1 if the left button is pressed, bit 2 = 1 if the 
557   right button is pressed)<br>
558   Byte 2: Mose position x-coord MSB<br>
559   Byte 3: Mose position x-coord LSB<br>
560   Byte 4: Mose position y-coord MSB<br>
561   Byte 5: Mose position y-coord LSB<br>
562   Byte 6: Padding - always zero<br>
563   Byte 7: Padding - always zero </p>
564 <p>&nbsp;</p>
565 <h3>VNC server keyboard API</h3>
566 <p>The VNC server keyboard device driver is a standard eCos IO device driver. 
567   The device name is &quot;/dev/vnc_kbd&quot; by default, but this may be modified 
568   with the configuration tool. The first step in using the keyboard device driver 
569   is to use the cyg_io_lookup() function:</p>
570 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
571   <tr> 
572     <td> 
573       <p> <font face="Courier New, Courier, mono" size="-1">Cyg_ErrNo kdb_err;<br>
574         cyg_io_handle_t kbd_handle;<br>
575         cyg_uint8 kbd_data[8];<br>
576         cyg_uint32 kbd_len;</font><br>
577         <br>
578         <font face="Courier New, Courier, mono" size="-1">kbd_err = cyg_io_lookup("/dev/vnc_kbd", 
579         &kbd_handle); /* Open kbd device */ <br>
580         if (kbd_err == -ENOENT)<br>
581         { <br>
582         &nbsp;&nbsp;&nbsp;&nbsp;diag_printf("Could not open kbd device\n"); <br>
583         } </font></p>
584     </td>
585   </tr>
586 </table>
587 <p>Once the cyg_io_lookup() function has found the keyboard device driver, the 
588   driver is active and should be read regularly to prevent the receive buffer 
589   from overflowing with data. Data is read using the cyg_io_read() function:</p>
590 <table width="91%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
591   <tr> 
592     <td> 
593       <p><font face="Courier New, Courier, mono" size="-1">kbd_len = 4;&nbsp;&nbsp;/* 
594         Try to read 4 bytes from keyboard */ <br>
595         cyg_io_read(kbd_handle, kbd_data, &kbd_len ); <br>
596         if (kbd_len == 0)<br>
597         {<br>
598         &nbsp;&nbsp;&nbsp;&nbsp;diag_printf(&quot;Keyboard has no new data\n&quot;);<br>
599         }<br>
600         else<br>
601         { <br>
602         &nbsp;&nbsp;&nbsp;&nbsp;diag_printf(&quot;Have New keyboard data:\n&quot;);<br>
603         &nbsp;&nbsp;&nbsp;&nbsp;if (kbd_data[1])<br>
604         &nbsp;&nbsp;&nbsp;&nbsp;{ </font><br>
605         <font face="Courier New, Courier, mono" size="-1"><font face="Courier New, Courier, mono" size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;diag_printf(&quot;&nbsp;&nbsp;Keysym 
606         value 0x%x pressed\n&quot;,<br>
607         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kbd_data[2]*256 
608         + kbd_data[3]</font></font><font face="Courier New, Courier, mono" size="-1"><font face="Courier New, Courier, mono" size="-1">);<br>
609         &nbsp;&nbsp;&nbsp;&nbsp;}<br>
610         &nbsp;&nbsp;&nbsp;&nbsp;else<br>
611         &nbsp;&nbsp;&nbsp;&nbsp;{<br>
612         <font face="Courier New, Courier, mono" size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;diag_printf(&quot;&nbsp;&nbsp;Keysym 
613         value 0x%x released\n&quot;,<br>
614         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kbd_data[2]*256 
615         + kbd_data[3]</font></font><font face="Courier New, Courier, mono" size="-1"><font face="Courier New, Courier, mono" size="-1">);</font></font><font face="Courier New, Courier, mono" size="-1"> 
616         <br>
617         &nbsp;&nbsp;&nbsp;&nbsp;} </font></font><br>
618         <font face="Courier New, Courier, mono" size="-1">}</font> </p>
619       </td>
620   </tr>
621 </table>
622 <p>The cyg_io_read() function is a non-blocking function and each keystroke event 
623   generates 4 bytes of data:</p>
624 <p>Byte 0: Padding - always zero<br>
625   Byte 1: Key pressed/released (1 when key pressed)<br>
626   Byte 2: Keysym value for key MSB<br>
627   Byte 3: Keysym value for key LSB<br>
628 </p>
629 <p>The actual key values are specified using the &quot;keysym&quot; values defined 
630   by the X Window System. For most ordinary keys the keysym value is the same 
631   as the corresponding ASCII value. For full details see either the Xlib Reference 
632   Manual, published by O'Reilly &amp; Associates or see the header file &lt;X11/keysymdef.h&gt; 
633   from any X Window System installation (a google search for 'keysymdef.h' should 
634   find it).</p>
635 <p>&nbsp;</p>
636 <h3>&nbsp;</h3>
637 </body>
638 </html>