This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

VNC - BGR233 pixel mode


I had a really hard time matching VNC servers to my 
various displays.  However, I found that the newer VNC 
clients (I have 3.3.7 from realvnc.com) support BGR233 
mode no matter what the native display mode is.  Adding 
this makes it easier to bang out a program that will 
work with all displays.

Of course one may still want to tune the server to different 
parameters for a better look (i.e. more than 256 colors!)

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: net/vnc_server/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/vnc_server/current/ChangeLog,v
retrieving revision 1.2
diff -u -5 -p -r1.2 ChangeLog
--- net/vnc_server/current/ChangeLog	31 Aug 2003 15:22:15 -0000	1.2
+++ net/vnc_server/current/ChangeLog	2 Sep 2003 01:43:04 -0000
@@ -1,5 +1,12 @@
+2003-09-01  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/vnc-server.c: 
+	* include/vnc-server.h: 
+	* cdl/vnc-server.cdl: Add support for BGR233 (8 bit) mode, since
+	newer viewers support this on all displays.
+
 2003-08-31  Chris Garry  <cgarry@sweeneydesign.co.uk>
 
     * src/vnc-server.c:
     Always send colour data to client in big endian format.
     When doing frame updates, do not call send command until there
Index: net/vnc_server/current/cdl/vnc-server.cdl
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/vnc_server/current/cdl/vnc-server.cdl,v
retrieving revision 1.1
diff -u -5 -p -r1.1 vnc-server.cdl
--- net/vnc_server/current/cdl/vnc-server.cdl	27 Aug 2003 18:46:05 -0000	1.1
+++ net/vnc_server/current/cdl/vnc-server.cdl	2 Sep 2003 01:28:56 -0000
@@ -166,13 +166,21 @@ cdl_package CYGPKG_VNC_SERVER {
         }
     
         cdl_option CYGNUM_VNC_SERVER_PIXEL_RGB332 {
             display     "RGB332 pixel format (8-bit)"
             flavor bool
-            default_value 1
+            default_value 0
             implements CYGNUM_VNC_SERVER_PIXEL_SELECTED
             description "This selects 8-bit, RGB332 pixel format."
+        }
+
+        cdl_option CYGNUM_VNC_SERVER_PIXEL_BGR233 {
+            display     "BGR233 pixel format (8-bit)"
+            flavor bool
+            default_value 1
+            implements CYGNUM_VNC_SERVER_PIXEL_SELECTED
+            description "This selects 8-bit, BGR233 pixel format."
         }
 
         cdl_option CYGNUM_VNC_SERVER_PIXEL_RGB555 {
             display     "RGB555 pixel format (16-bit)"
             flavor bool
Index: net/vnc_server/current/include/vnc-server.h
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/vnc_server/current/include/vnc-server.h,v
retrieving revision 1.1
diff -u -5 -p -r1.1 vnc-server.h
--- net/vnc_server/current/include/vnc-server.h	27 Aug 2003 18:46:05 -0000	1.1
+++ net/vnc_server/current/include/vnc-server.h	2 Sep 2003 01:33:47 -0000
@@ -61,10 +61,11 @@ typedef struct
     cyg_uint16 frame_height;
     void *     frame_buffer;
     bool       rgb332;
     bool       rgb555;
     bool       rgb565;
+    bool       bgr233;
 } vnc_frame_format_t;
 
 
 #ifdef CYGNUM_VNC_SERVER_INCLUDE_VNC_PRINTF
 /* The typedefs for MWIMAGEBITS and MWCFONT and required to use  */
@@ -92,21 +93,18 @@ typedef struct
     cyg_uint16 height;
 } vnc_printf_return_t;
 #endif
 
 /* Type for colour values */
-#ifdef CYGNUM_VNC_SERVER_PIXEL_RGB332
+#if defined(CYGNUM_VNC_SERVER_PIXEL_RGB332) || defined(CYGNUM_VNC_SERVER_PIXEL_BGR233)
 typedef cyg_uint8 vnc_color_t;
 typedef cyg_uint8 vnc_colour_t;
-#endif
-#ifdef CYGNUM_VNC_SERVER_PIXEL_RGB555
-typedef cyg_uint16 vnc_color_t;
-typedef cyg_uint16 vnc_colour_t;
-#endif
-#ifdef CYGNUM_VNC_SERVER_PIXEL_RGB565
+#elif defined(CYGNUM_VNC_SERVER_PIXEL_RGB555) || defined(CYGNUM_VNC_SERVER_PIXEL_RGB565)
 typedef cyg_uint16 vnc_color_t;
 typedef cyg_uint16 vnc_colour_t;
+#else
+#error "Unsupported color model"
 #endif
 
 
 /* Driver function prototypes */
 vnc_frame_format_t* VncGetInfo(void);
@@ -130,10 +128,15 @@ vnc_printf_return_t VncPrintf(MWCFONT* f
 /* Macros to convert from RGB to colour values */
 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB332
 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xE0) >> 0)  \
                                       |((((cyg_uint8)g)&0xE0) >> 3)  \
                                       |((((cyg_uint8)b)&0xC0) >> 6))
+#endif
+#ifdef CYGNUM_VNC_SERVER_PIXEL_BGR233
+#define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xE0) >> 5)  \
+                                      |((((cyg_uint8)g)&0xE0) >> 2)  \
+                                      |((((cyg_uint8)b)&0xC0) >> 0))
 #endif
 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB555
 #define VNC_RGB2COL(r,g,b) (vnc_colour_t)(((((cyg_uint8)r)&0xF8) << 7)  \
                                        |((((cyg_uint8)g)&0xF8) << 2)  \
                                        |((((cyg_uint8)b)&0xF8) >> 3))
Index: net/vnc_server/current/src/vnc-server.c
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/vnc_server/current/src/vnc-server.c,v
retrieving revision 1.2
diff -u -5 -p -r1.2 vnc-server.c
--- net/vnc_server/current/src/vnc-server.c	31 Aug 2003 15:22:15 -0000	1.2
+++ net/vnc_server/current/src/vnc-server.c	2 Sep 2003 01:28:47 -0000
@@ -92,10 +92,21 @@ void lwip_init(void);
 #define RED_SHIFT           5
 #define GREEN_SHIFT         2
 #define BLUE_SHIFT          0
 #endif
 
+#ifdef CYGNUM_VNC_SERVER_PIXEL_BGR233
+#define BITS_PER_PIXEL      8      /* Bits per pixel */
+#define PIXEL_DEPTH         8      /* Usefull bits per pixel */
+#define RED_MAX             7
+#define GREEN_MAX           7
+#define BLUE_MAX            3
+#define RED_SHIFT           0
+#define GREEN_SHIFT         3
+#define BLUE_SHIFT          6
+#endif
+
 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB555
 #define BITS_PER_PIXEL      16     /* Bits per pixel */
 #define PIXEL_DEPTH         15     /* Usefull bits per pixel */
 #define RED_MAX             31
 #define GREEN_MAX           31
@@ -224,10 +235,15 @@ vnc_frame_format_t frame_format = {CYGNU
                                    1,
 #else
                                    0,
 #endif
 #ifdef CYGNUM_VNC_SERVER_PIXEL_RGB565
+                                   1,
+#else
+                                   0,
+#endif
+#ifdef CYGNUM_VNC_SERVER_PIXEL_BGR233
                                    1};
 #else
                                    0};
 #endif
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]