|
1180
|
1 //========================================================================== |
|
|
2 // |
|
|
3 // vnc-server.h |
|
|
4 // |
|
|
5 // |
|
|
6 // |
|
|
7 //========================================================================== |
|
|
8 //####ECOSGPLCOPYRIGHTBEGIN#### |
|
|
9 // ------------------------------------------- |
|
|
10 // This file is part of eCos, the Embedded Configurable Operating System. |
|
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc. |
|
|
12 // |
|
|
13 // eCos is free software; you can redistribute it and/or modify it under |
|
|
14 // the terms of the GNU General Public License as published by the Free |
|
|
15 // Software Foundation; either version 2 or (at your option) any later version. |
|
|
16 // |
|
|
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
|
|
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
|
19 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
|
20 // for more details. |
|
|
21 // |
|
|
22 // You should have received a copy of the GNU General Public License along |
|
|
23 // with eCos; if not, write to the Free Software Foundation, Inc., |
|
|
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
|
25 // |
|
|
26 // As a special exception, if other files instantiate templates or use macros |
|
|
27 // or inline functions from this file, or you compile this file and link it |
|
|
28 // with other works to produce a work based on this file, this file does not |
|
|
29 // by itself cause the resulting work to be covered by the GNU General Public |
|
|
30 // License. However the source code for this file must still be made available |
|
|
31 // in accordance with section (3) of the GNU General Public License. |
|
|
32 // |
|
|
33 // This exception does not invalidate any other reasons why a work based on |
|
|
34 // this file might be covered by the GNU General Public License. |
|
|
35 // |
|
|
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
|
|
37 // at http://sources.redhat.com/ecos/ecos-license/ |
|
|
38 // ------------------------------------------- |
|
|
39 //####ECOSGPLCOPYRIGHTEND#### |
|
|
40 //========================================================================== |
|
|
41 //#####DESCRIPTIONBEGIN#### |
|
|
42 // |
|
|
43 // Author(s): Chris Garry <cgarry@sweeneydesign.co.uk> |
|
|
44 // Contributors: |
|
|
45 // Date: 2003-08-22 |
|
|
46 // Purpose: |
|
|
47 // Description: Header file for VNC Server |
|
|
48 // |
|
|
49 //####DESCRIPTIONEND#### |
|
|
50 // |
|
|
51 //========================================================================*/ |
|
|
52 |
|
|
53 |
|
|
54 #include <cyg/kernel/kapi.h> /* Kernel API */ |
|
|
55 #include <pkgconf/vnc_server.h> |
|
|
56 |
|
|
57 /* Type to hold the frame format details */ |
|
|
58 typedef struct |
|
|
59 { |
|
|
60 cyg_uint16 frame_width; |
|
|
61 cyg_uint16 frame_height; |
|
|
62 void * frame_buffer; |
|
|
63 bool rgb332; |
|
|
64 bool rgb555; |
|
|
65 bool rgb565; |
|
1188
|
66 bool bgr233; |
|
1180
|
67 } vnc_frame_format_t; |
|
|
68 |
|
|
69 |
|
|
70 #ifdef CYGNUM_VNC_SERVER_INCLUDE_VNC_PRINTF |
|
|
71 /* The typedefs for MWIMAGEBITS and MWCFONT and required to use */ |
|
|
72 /* the font definition files in the src/fonts/ directory. These */ |
|
|
73 /* typedefs are repeated in the device.h file also in the */ |
|
|
74 /* src/fonts/ directory */ |
|
|
75 typedef unsigned short MWIMAGEBITS; /* bitmap image unit size*/ |
|
|
76 typedef struct { |
|
|
77 char * name; /* font name*/ |
|
|
78 int maxwidth; /* max width in pixels*/ |
|
|
79 int height; /* height in pixels*/ |
|
|
80 int ascent; /* ascent (baseline) height*/ |
|
|
81 int firstchar; /* first character in bitmap*/ |
|
|
82 int size; /* font size in characters*/ |
|
|
83 MWIMAGEBITS * bits; /* 16-bit right-padded bitmap data*/ |
|
|
84 unsigned short *offset; /* 256 offsets into bitmap data*/ |
|
|
85 unsigned char * width; /* 256 character widths or 0 if fixed*/ |
|
|
86 } MWCFONT; |
|
|
87 |
|
|
88 /* Type to hold rectangle size details */ |
|
|
89 typedef struct |
|
|
90 { |
|
|
91 int chars; |
|
|
92 cyg_uint16 width; |
|
|
93 cyg_uint16 height; |
|
|
94 } vnc_printf_return_t; |
|
|
95 #endif |
|
|
96 |
|
|
97 /* Type for colour values */ |
|
1188
|
98 #if defined(CYGNUM_VNC_SERVER_PIXEL_RGB332) || defined(CYGNUM_VNC_SERVER_PIXEL_BGR233) |
|
1180
|
99 typedef cyg_uint8 vnc_color_t; |
|
|
100 typedef cyg_uint8 vnc_colour_t; |
|
1188
|
101 #elif defined(CYGNUM_VNC_SERVER_PIXEL_RGB555) || defined(CYGNUM_VNC_SERVER_PIXEL_RGB565) |
|
1180
|
102 typedef cyg_uint16 vnc_color_t; |
|
|
103 typedef cyg_uint16 vnc_colour_t; |
|
1188
|
104 #else |
|
|
105 #error "Unsupported color model" |
|
1180
|
106 #endif |
|
|
107 |
|
|
108 |
|
|
109 /* Driver function prototypes */ |
|
|
110 vnc_frame_format_t* VncGetInfo(void); |
|
|
111 void VncInit(vnc_colour_t colour); |
|
|
112 void VncDrawPixel(cyg_uint16 x, cyg_uint16 y, vnc_colour_t colour); |
|
|
113 vnc_colour_t VncReadPixel(cyg_uint16 x, cyg_uint16 y); |
|
|
114 void VncDrawHorzLine(cyg_uint16 x1, cyg_uint16 x2, cyg_uint16 y, vnc_colour_t colour); |
|
|
115 void VncDrawVertLine(cyg_uint16 x, cyg_uint16 y1, cyg_uint16 y2, vnc_colour_t colour); |
|
|
116 void VncFillRect(cyg_uint16 x1, cyg_uint16 y1, cyg_uint16 x2, cyg_uint16 y2, vnc_colour_t colour); |
|
|
117 void VncCopyRect(cyg_uint16 x1, cyg_uint16 y1, cyg_uint16 width, cyg_uint16 height, cyg_uint16 x2, cyg_uint16 y2); |
|
|
118 void VncCopyRect2Buffer(cyg_uint16 x, cyg_uint16 y, cyg_uint16 width, cyg_uint16 height, |
|
|
119 void *buffer, cyg_uint16 buff_w, cyg_uint16 buff_h, cyg_uint16 x_off, cyg_uint16 y_off); |
|
|
120 void VncCopyBuffer2Rect(void *buffer, cyg_uint16 buff_w, cyg_uint16 buff_h, cyg_uint16 x_off, cyg_uint16 y_off, |
|
|
121 cyg_uint16 x, cyg_uint16 y, cyg_uint16 width, cyg_uint16 height); |
|
|
122 void VncSoundBell(void); |
|
|
123 #ifdef CYGNUM_VNC_SERVER_INCLUDE_VNC_PRINTF |
|
|
124 vnc_printf_return_t VncPrintf(MWCFONT* font, int do_print, vnc_colour_t colour, int x, int y, const char *fmt, ... ); |
|
|
125 #endif |
|
|
126 |
|
|
127 |
|
|
128 /* Macros to convert from RGB to colour values */ |
|
|
129 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB332 |
|
|
130 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xE0) >> 0) \ |
|
|
131 |((((cyg_uint8)g)&0xE0) >> 3) \ |
|
|
132 |((((cyg_uint8)b)&0xC0) >> 6)) |
|
|
133 #endif |
|
1188
|
134 #ifdef CYGNUM_VNC_SERVER_PIXEL_BGR233 |
|
|
135 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xE0) >> 5) \ |
|
|
136 |((((cyg_uint8)g)&0xE0) >> 2) \ |
|
|
137 |((((cyg_uint8)b)&0xC0) >> 0)) |
|
|
138 #endif |
|
1180
|
139 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB555 |
|
|
140 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xF8) << 7) \ |
|
|
141 |((((cyg_uint8)g)&0xF8) << 2) \ |
|
|
142 |((((cyg_uint8)b)&0xF8) >> 3)) |
|
|
143 #endif |
|
|
144 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB565 |
|
|
145 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xF8) << 8) \ |
|
|
146 |((((cyg_uint8)g)&0xFC) << 3) \ |
|
|
147 |((((cyg_uint8)b)&0xF8) >> 3)) |
|
|
148 #endif |
|
|
149 |
|
|
150 |
|
|
151 /* 16 defined colours for application use */ |
|
|
152 #define VNC_BLACK VNC_RGB2COL( 0 , 0 , 0 ) |
|
|
153 #define VNC_BLUE VNC_RGB2COL( 0 , 0 , 128 ) |
|
|
154 #define VNC_GREEN VNC_RGB2COL( 0 , 128, 0 ) |
|
|
155 #define VNC_CYAN VNC_RGB2COL( 0 , 128, 128 ) |
|
|
156 #define VNC_RED VNC_RGB2COL( 128, 0 , 0 ) |
|
|
157 #define VNC_MAGENTA VNC_RGB2COL( 128, 0 , 128 ) |
|
|
158 #define VNC_BROWN VNC_RGB2COL( 128, 64 , 0 ) |
|
|
159 #define VNC_LTGRAY VNC_RGB2COL( 192, 192, 192 ) |
|
|
160 #define VNC_LTGREY VNC_RGB2COL( 192, 192, 192 ) |
|
|
161 #define VNC_GRAY VNC_RGB2COL( 128, 128, 128 ) |
|
|
162 #define VNC_GREY VNC_RGB2COL( 128, 128, 128 ) |
|
|
163 #define VNC_LTBLUE VNC_RGB2COL( 0 , 0 , 255 ) |
|
|
164 #define VNC_LTGREEN VNC_RGB2COL( 0 , 255, 0 ) |
|
|
165 #define VNC_LTCYAN VNC_RGB2COL( 0 , 255, 255 ) |
|
|
166 #define VNC_LTRED VNC_RGB2COL( 255, 0 , 0 ) |
|
|
167 #define VNC_LTMAGENTA VNC_RGB2COL( 255, 0 , 255 ) |
|
|
168 #define VNC_YELLOW VNC_RGB2COL( 255, 255, 0 ) |
|
|
169 #define VNC_WHITE VNC_RGB2COL( 255, 255, 255 ) |
|
|
170 |
|
|
171 #ifdef CYGNUM_VNC_SERVER_INCLUDE_VNC_PRINTF |
|
|
172 /* Compiled in fonts*/ |
|
|
173 extern MWCFONT font_rom8x16, font_rom8x8; |
|
|
174 extern MWCFONT font_winFreeSansSerif11x13; |
|
|
175 extern MWCFONT font_winFreeSystem14x16; /* Default font */ |
|
|
176 extern MWCFONT font_helvB10, font_helvB12, font_helvR10; |
|
|
177 extern MWCFONT font_X5x7, font_X6x13; |
|
|
178 #endif |