1 |
786 |
skrzyp |
//==========================================================================
|
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 Free Software Foundation, 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
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//==========================================================================
|
40 |
|
|
//#####DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): Chris Garry <cgarry@sweeneydesign.co.uk>
|
43 |
|
|
// Contributors:
|
44 |
|
|
// Date: 2003-08-22
|
45 |
|
|
// Purpose:
|
46 |
|
|
// Description: Header file for VNC Server
|
47 |
|
|
//
|
48 |
|
|
//####DESCRIPTIONEND####
|
49 |
|
|
//
|
50 |
|
|
//========================================================================*/
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
#include <cyg/kernel/kapi.h> /* Kernel API */
|
54 |
|
|
#include <pkgconf/vnc_server.h>
|
55 |
|
|
|
56 |
|
|
/* Type to hold the frame format details */
|
57 |
|
|
typedef struct
|
58 |
|
|
{
|
59 |
|
|
cyg_uint16 frame_width;
|
60 |
|
|
cyg_uint16 frame_height;
|
61 |
|
|
void * frame_buffer;
|
62 |
|
|
bool rgb332;
|
63 |
|
|
bool rgb555;
|
64 |
|
|
bool rgb565;
|
65 |
|
|
bool bgr233;
|
66 |
|
|
bool truecolor0888;
|
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 |
|
|
cyg_uint16 width;
|
92 |
|
|
cyg_uint16 height;
|
93 |
|
|
} vnc_printf_return_t;
|
94 |
|
|
#endif
|
95 |
|
|
|
96 |
|
|
/* Type for colour values */
|
97 |
|
|
#if defined(CYGNUM_VNC_SERVER_PIXEL_RGB332) || defined(CYGNUM_VNC_SERVER_PIXEL_BGR233)
|
98 |
|
|
typedef cyg_uint8 vnc_color_t;
|
99 |
|
|
typedef cyg_uint8 vnc_colour_t;
|
100 |
|
|
#elif defined(CYGNUM_VNC_SERVER_PIXEL_RGB555) || defined(CYGNUM_VNC_SERVER_PIXEL_RGB565)
|
101 |
|
|
typedef cyg_uint16 vnc_color_t;
|
102 |
|
|
typedef cyg_uint16 vnc_colour_t;
|
103 |
|
|
#elif defined(CYGNUM_VNC_SERVER_PIXEL_TRUECOLOR0888)
|
104 |
|
|
typedef cyg_uint32 vnc_color_t;
|
105 |
|
|
typedef cyg_uint32 vnc_colour_t;
|
106 |
|
|
#else
|
107 |
|
|
#error "Unsupported color model"
|
108 |
|
|
#endif
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
/* Driver function prototypes */
|
112 |
|
|
vnc_frame_format_t* VncGetInfo(void);
|
113 |
|
|
void VncInit(vnc_colour_t colour);
|
114 |
|
|
void VncDrawPixel(cyg_uint16 x, cyg_uint16 y, vnc_colour_t colour);
|
115 |
|
|
vnc_colour_t VncReadPixel(cyg_uint16 x, cyg_uint16 y);
|
116 |
|
|
void VncDrawHorzLine(cyg_uint16 x1, cyg_uint16 x2, cyg_uint16 y, vnc_colour_t colour);
|
117 |
|
|
void VncDrawVertLine(cyg_uint16 x, cyg_uint16 y1, cyg_uint16 y2, vnc_colour_t colour);
|
118 |
|
|
void VncFillRect(cyg_uint16 x1, cyg_uint16 y1, cyg_uint16 x2, cyg_uint16 y2, vnc_colour_t colour);
|
119 |
|
|
void VncCopyRect(cyg_uint16 x1, cyg_uint16 y1, cyg_uint16 width, cyg_uint16 height, cyg_uint16 x2, cyg_uint16 y2);
|
120 |
|
|
void VncCopyRect2Buffer(cyg_uint16 x, cyg_uint16 y, cyg_uint16 width, cyg_uint16 height,
|
121 |
|
|
void *buffer, cyg_uint16 buff_w, cyg_uint16 buff_h, cyg_uint16 x_off, cyg_uint16 y_off);
|
122 |
|
|
void VncCopyBuffer2Rect(void *buffer, cyg_uint16 buff_w, cyg_uint16 buff_h, cyg_uint16 x_off, cyg_uint16 y_off,
|
123 |
|
|
cyg_uint16 x, cyg_uint16 y, cyg_uint16 width, cyg_uint16 height);
|
124 |
|
|
void VncCopyBuffer2RectMask( void *buffer, cyg_uint16 buff_w, cyg_uint16 buff_h ,cyg_uint16 x_off, cyg_uint16 y_off,
|
125 |
|
|
cyg_uint16 x, cyg_uint16 y, cyg_uint16 width, cyg_uint16 height, vnc_colour_t col);
|
126 |
|
|
void VncSoundBell(void);
|
127 |
|
|
#ifdef CYGNUM_VNC_SERVER_INCLUDE_VNC_PRINTF
|
128 |
|
|
vnc_printf_return_t VncPrintf(MWCFONT* font, int do_print, vnc_colour_t colour, int x, int y, const char *fmt, ... );
|
129 |
|
|
#endif
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
/* Macros to convert from RGB to colour values */
|
133 |
|
|
#ifdef CYGNUM_VNC_SERVER_PIXEL_RGB332
|
134 |
|
|
#define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xE0) >> 0) \
|
135 |
|
|
|((((cyg_uint8)g)&0xE0) >> 3) \
|
136 |
|
|
|((((cyg_uint8)b)&0xC0) >> 6))
|
137 |
|
|
#endif
|
138 |
|
|
#ifdef CYGNUM_VNC_SERVER_PIXEL_BGR233
|
139 |
|
|
#define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xE0) >> 5) \
|
140 |
|
|
|((((cyg_uint8)g)&0xE0) >> 2) \
|
141 |
|
|
|((((cyg_uint8)b)&0xC0) >> 0))
|
142 |
|
|
#endif
|
143 |
|
|
#ifdef CYGNUM_VNC_SERVER_PIXEL_RGB555
|
144 |
|
|
#define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xF8) << 7) \
|
145 |
|
|
|((((cyg_uint8)g)&0xF8) << 2) \
|
146 |
|
|
|((((cyg_uint8)b)&0xF8) >> 3))
|
147 |
|
|
#endif
|
148 |
|
|
#ifdef CYGNUM_VNC_SERVER_PIXEL_RGB565
|
149 |
|
|
#define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xF8) << 8) \
|
150 |
|
|
|((((cyg_uint8)g)&0xFC) << 3) \
|
151 |
|
|
|((((cyg_uint8)b)&0xF8) >> 3))
|
152 |
|
|
#endif
|
153 |
|
|
#ifdef CYGNUM_VNC_SERVER_PIXEL_TRUECOLOR0888
|
154 |
|
|
#define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xFF) << 16) \
|
155 |
|
|
|((((cyg_uint8)g)&0xFF) << 8) \
|
156 |
|
|
|((((cyg_uint8)b)&0xFF) << 0))
|
157 |
|
|
#endif
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
/* 16 defined colours for application use */
|
161 |
|
|
#define VNC_BLACK VNC_RGB2COL( 0 , 0 , 0 )
|
162 |
|
|
#define VNC_BLUE VNC_RGB2COL( 0 , 0 , 128 )
|
163 |
|
|
#define VNC_GREEN VNC_RGB2COL( 0 , 128, 0 )
|
164 |
|
|
#define VNC_CYAN VNC_RGB2COL( 0 , 128, 128 )
|
165 |
|
|
#define VNC_RED VNC_RGB2COL( 128, 0 , 0 )
|
166 |
|
|
#define VNC_MAGENTA VNC_RGB2COL( 128, 0 , 128 )
|
167 |
|
|
#define VNC_BROWN VNC_RGB2COL( 128, 64 , 0 )
|
168 |
|
|
#define VNC_LTGRAY VNC_RGB2COL( 192, 192, 192 )
|
169 |
|
|
#define VNC_LTGREY VNC_RGB2COL( 192, 192, 192 )
|
170 |
|
|
#define VNC_GRAY VNC_RGB2COL( 128, 128, 128 )
|
171 |
|
|
#define VNC_GREY VNC_RGB2COL( 128, 128, 128 )
|
172 |
|
|
#define VNC_LTBLUE VNC_RGB2COL( 0 , 0 , 255 )
|
173 |
|
|
#define VNC_LTGREEN VNC_RGB2COL( 0 , 255, 0 )
|
174 |
|
|
#define VNC_LTCYAN VNC_RGB2COL( 0 , 255, 255 )
|
175 |
|
|
#define VNC_LTRED VNC_RGB2COL( 255, 0 , 0 )
|
176 |
|
|
#define VNC_LTMAGENTA VNC_RGB2COL( 255, 0 , 255 )
|
177 |
|
|
#define VNC_YELLOW VNC_RGB2COL( 255, 255, 0 )
|
178 |
|
|
#define VNC_WHITE VNC_RGB2COL( 255, 255, 255 )
|
179 |
|
|
|
180 |
|
|
#ifdef CYGNUM_VNC_SERVER_INCLUDE_VNC_PRINTF
|
181 |
|
|
/* Compiled in fonts*/
|
182 |
|
|
extern MWCFONT font_rom8x16, font_rom8x8;
|
183 |
|
|
extern MWCFONT font_winFreeSansSerif11x13;
|
184 |
|
|
extern MWCFONT font_winFreeSystem14x16; /* Default font */
|
185 |
|
|
extern MWCFONT font_helvB10, font_helvB12, font_helvR10;
|
186 |
|
|
extern MWCFONT font_X5x7, font_X6x13;
|
187 |
|
|
#endif
|