]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/net/vnc_server/v2_0/include/vnc-server.h
Initial revision
[karo-tx-redboot.git] / packages / net / vnc_server / v2_0 / include / vnc-server.h
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;
66     bool       bgr233;
67     bool       truecolor0888;
68 } vnc_frame_format_t;
69
70
71 #ifdef CYGNUM_VNC_SERVER_INCLUDE_VNC_PRINTF
72 /* The typedefs for MWIMAGEBITS and MWCFONT and required to use  */
73 /* the font definition files in the src/fonts/ directory.  These */
74 /* typedefs are repeated in the device.h file also in the        */
75 /* src/fonts/ directory                                          */
76 typedef unsigned short  MWIMAGEBITS;    /* bitmap image unit size*/
77 typedef struct {
78     char *      name;       /* font name*/
79     int     maxwidth;   /* max width in pixels*/
80     int     height;     /* height in pixels*/
81     int     ascent;     /* ascent (baseline) height*/
82     int     firstchar;  /* first character in bitmap*/
83     int     size;       /* font size in characters*/
84     MWIMAGEBITS *   bits;       /* 16-bit right-padded bitmap data*/
85     unsigned short *offset;     /* 256 offsets into bitmap data*/
86     unsigned char * width;      /* 256 character widths or 0 if fixed*/
87 } MWCFONT;
88
89 /* Type to hold rectangle size details */
90 typedef struct
91 {
92     cyg_uint16 width;
93     cyg_uint16 height;
94 } vnc_printf_return_t;
95 #endif
96
97 /* Type for colour values */
98 #if defined(CYGNUM_VNC_SERVER_PIXEL_RGB332) || defined(CYGNUM_VNC_SERVER_PIXEL_BGR233)
99 typedef cyg_uint8 vnc_color_t;
100 typedef cyg_uint8 vnc_colour_t;
101 #elif defined(CYGNUM_VNC_SERVER_PIXEL_RGB555) || defined(CYGNUM_VNC_SERVER_PIXEL_RGB565)
102 typedef cyg_uint16 vnc_color_t;
103 typedef cyg_uint16 vnc_colour_t;
104 #elif defined(CYGNUM_VNC_SERVER_PIXEL_TRUECOLOR0888)
105 typedef cyg_uint32 vnc_color_t;
106 typedef cyg_uint32 vnc_colour_t;
107 #else
108 #error "Unsupported color model"
109 #endif
110
111
112 /* Driver function prototypes */
113 vnc_frame_format_t* VncGetInfo(void);
114 void  VncInit(vnc_colour_t colour);
115 void VncDrawPixel(cyg_uint16 x, cyg_uint16 y, vnc_colour_t colour);
116 vnc_colour_t VncReadPixel(cyg_uint16 x, cyg_uint16 y);
117 void VncDrawHorzLine(cyg_uint16 x1, cyg_uint16 x2, cyg_uint16 y, vnc_colour_t colour);
118 void VncDrawVertLine(cyg_uint16 x, cyg_uint16 y1, cyg_uint16 y2, vnc_colour_t colour);
119 void VncFillRect(cyg_uint16 x1, cyg_uint16 y1, cyg_uint16 x2, cyg_uint16 y2, vnc_colour_t colour);
120 void VncCopyRect(cyg_uint16 x1, cyg_uint16 y1, cyg_uint16 width, cyg_uint16 height, cyg_uint16 x2, cyg_uint16 y2);
121 void VncCopyRect2Buffer(cyg_uint16 x, cyg_uint16 y, cyg_uint16 width, cyg_uint16 height,
122                         void *buffer, cyg_uint16 buff_w, cyg_uint16 buff_h, cyg_uint16 x_off, cyg_uint16 y_off);
123 void VncCopyBuffer2Rect(void *buffer, cyg_uint16 buff_w, cyg_uint16 buff_h, cyg_uint16 x_off, cyg_uint16 y_off,
124                          cyg_uint16 x, cyg_uint16 y, cyg_uint16 width, cyg_uint16 height);
125 void VncCopyBuffer2RectMask( void *buffer, cyg_uint16 buff_w, cyg_uint16 buff_h ,cyg_uint16 x_off, cyg_uint16 y_off,
126                              cyg_uint16 x, cyg_uint16 y, cyg_uint16 width, cyg_uint16 height, vnc_colour_t col);
127 void VncSoundBell(void);
128 #ifdef CYGNUM_VNC_SERVER_INCLUDE_VNC_PRINTF
129 vnc_printf_return_t VncPrintf(MWCFONT* font, int do_print, vnc_colour_t colour, int x, int y, const char *fmt, ... );
130 #endif
131
132
133 /* Macros to convert from RGB to colour values */
134 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB332
135 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xE0) >> 0)  \
136                                       |((((cyg_uint8)g)&0xE0) >> 3)  \
137                                       |((((cyg_uint8)b)&0xC0) >> 6))
138 #endif
139 #ifdef CYGNUM_VNC_SERVER_PIXEL_BGR233
140 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xE0) >> 5)  \
141                                       |((((cyg_uint8)g)&0xE0) >> 2)  \
142                                       |((((cyg_uint8)b)&0xC0) >> 0))
143 #endif
144 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB555
145 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xF8) << 7)  \
146                                        |((((cyg_uint8)g)&0xF8) << 2)  \
147                                        |((((cyg_uint8)b)&0xF8) >> 3))
148 #endif
149 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB565
150 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xF8) << 8)  \
151                                        |((((cyg_uint8)g)&0xFC) << 3)  \
152                                        |((((cyg_uint8)b)&0xF8) >> 3))
153 #endif
154 #ifdef CYGNUM_VNC_SERVER_PIXEL_TRUECOLOR0888
155 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xFF) << 16)  \
156                                        |((((cyg_uint8)g)&0xFF) << 8)  \
157                                        |((((cyg_uint8)b)&0xFF) << 0))
158 #endif
159
160
161 /* 16 defined colours for application use */
162 #define VNC_BLACK       VNC_RGB2COL( 0  , 0  , 0   )
163 #define VNC_BLUE        VNC_RGB2COL( 0  , 0  , 128 )
164 #define VNC_GREEN       VNC_RGB2COL( 0  , 128, 0   )
165 #define VNC_CYAN        VNC_RGB2COL( 0  , 128, 128 )
166 #define VNC_RED         VNC_RGB2COL( 128, 0  , 0   )
167 #define VNC_MAGENTA     VNC_RGB2COL( 128, 0  , 128 )
168 #define VNC_BROWN       VNC_RGB2COL( 128, 64 , 0   )
169 #define VNC_LTGRAY      VNC_RGB2COL( 192, 192, 192 )
170 #define VNC_LTGREY      VNC_RGB2COL( 192, 192, 192 )
171 #define VNC_GRAY        VNC_RGB2COL( 128, 128, 128 )
172 #define VNC_GREY        VNC_RGB2COL( 128, 128, 128 )
173 #define VNC_LTBLUE      VNC_RGB2COL( 0  , 0  , 255 )
174 #define VNC_LTGREEN     VNC_RGB2COL( 0  , 255, 0   )
175 #define VNC_LTCYAN      VNC_RGB2COL( 0  , 255, 255 )
176 #define VNC_LTRED       VNC_RGB2COL( 255, 0  , 0   )
177 #define VNC_LTMAGENTA   VNC_RGB2COL( 255, 0  , 255 )
178 #define VNC_YELLOW      VNC_RGB2COL( 255, 255, 0   )
179 #define VNC_WHITE       VNC_RGB2COL( 255, 255, 255 )
180
181 #ifdef CYGNUM_VNC_SERVER_INCLUDE_VNC_PRINTF
182 /* Compiled in fonts*/
183 extern MWCFONT font_rom8x16, font_rom8x8;
184 extern MWCFONT font_winFreeSansSerif11x13;
185 extern MWCFONT font_winFreeSystem14x16;  /* Default font */
186 extern MWCFONT font_helvB10, font_helvB12, font_helvR10;
187 extern MWCFONT font_X5x7, font_X6x13;
188 #endif