diff Gui/wm/ws.c @ 1814:9c674dc76ff3

add wsSetForegroundRGB
author pontscho
date Fri, 31 Aug 2001 22:06:28 +0000
parents d44b0ce32791
children a6c67352ccac
line wrap: on
line diff
--- a/Gui/wm/ws.c	Fri Aug 31 21:23:55 2001 +0000
+++ b/Gui/wm/ws.c	Fri Aug 31 22:06:28 2001 +0000
@@ -434,8 +434,7 @@
 //  win->wGCV.background=wsBlack;
 
  win->wGC=XCreateGC( wsDisplay,win->WindowID,
-//  GCForeground | GCBackground,
-  0,
+  GCForeground | GCBackground,
   &win->wGCV );
 
  win->Visible=0;
@@ -881,6 +880,23 @@
  XSetWindowBackground( wsDisplay,win->WindowID,color );
 }
 
+void wsSetForegroundRGB( wsTWindow * win,int r,int g,int b )
+{
+ int color = 0;
+ switch ( wsOutMask )
+  {
+   case wsRGB32:
+   case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b;  break;
+   case wsBGR32:
+   case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r;  break;
+   case wsRGB16: PACK_RGB16( r,g,b,color ); break;
+   case wsBGR16: PACK_RGB16( b,g,r,color ); break;
+   case wsRGB15: PACK_RGB15( r,g,b,color ); break;
+   case wsBGR15: PACK_RGB15( b,g,r,color ); break;
+  }
+ XSetForeground( wsDisplay,win->wGC,color );
+// XSetWindowBackground( wsDisplay,win->WindowID,color );
+}
 
 // ----------------------------------------------------------------------------------------------
 //    Draw string at x,y with fc ( foreground color ) and bc ( background color ).