1 #ifndef VNC_H
2 #define VNC_H
3 
4 #define BOOL rfb_BOOL
5 #include <rfb/rfb.h>
6 #undef BOOL
7 
8 typedef unsigned int vncPixel;
9 
10 typedef struct
11 {
12 	uint16_t w, h;
13 	uint16_t linew;
14 	rfbPixelFormat *format;
15 	char *data;
16 	BOOL owner;
17 }
18 vncBuffer;
19 
20 extern int vncPreparedClientSocket;
21 extern int vncPreparedServerSocket;
22 
23 /* - Buffer management */
24 extern vncBuffer *vncNewBuffer(int w, int h, int depth);
25 extern vncBuffer *vncDupBuffer(vncBuffer * b);
26 extern void vncDeleteBuffer(vncBuffer * b);
27 
28 /* - Colourmaps */
29 typedef struct
30 {
31 	uint8_t r, g, b;
32 }
33 vncColour;
34 
35 extern void vncSetColourMap(rfbScreenInfoPtr s, rfbColourMap * m);
36 extern rfbColourMap *vncNewColourMap(rfbScreenInfoPtr s, int n);
37 extern void vncSetColourMapEntry(rfbColourMap * m, int i, vncPixel r, vncPixel g, vncPixel b);
38 extern void vncDeleteColourMap(rfbColourMap * m);
39 
40 /* - Simple pixel manipulation */
41 extern vncPixel vncGetPixel(vncBuffer * b, int x, int y);
42 extern void vncSetPixel(vncBuffer * b, int x, int y, vncPixel c);
43 
44 /* - Drawing primitives */
45 extern void vncSetRect(rfbScreenInfoPtr s, int x, int y, int w, int h, vncPixel c);
46 extern void vncCopyBlit(rfbScreenInfoPtr s, int x, int y, int w, int h, int srcx, int srcy);
47 extern void vncCopyBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h,
48 			    vncBuffer * b, int srcx, int srcy);
49 extern void vncTransBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h,
50 			     vncBuffer * b, int srcx, int srcy, int bg);
51 extern void vncXorBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h,
52 			   vncBuffer * b, int srcx, int srcy);
53 extern void vncAndBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h,
54 			   vncBuffer * b, int srcx, int srcy);
55 extern vncBuffer *vncGetRect(rfbScreenInfoPtr s, int x, int y, int w, int h);
56 
57 // - Low level VNC update primitives upon which the rest are based
58 extern void vncQueueCopyRect(rfbScreenInfoPtr s, int x, int y, int w, int h, int src_x, int src_y);
59 extern void vncQueueUpdate(rfbScreenInfoPtr s, int x, int y, int w, int h);
60 
61 /* cursor */
62 extern rfbCursorPtr vncNewCursor(vncBuffer * mask, vncBuffer * pointer, int hotx, int hoty);
63 extern void vncSetCursor(rfbScreenInfoPtr s, rfbCursorPtr c);
64 
65 int vncListenAtTcpAddr(unsigned short port);
66 void vncPrintStats();
67 
68 #endif
69