From 892664ca26ebe8d03c2acd701124a9f8fcbdab5f Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 2 Dec 1998 16:04:03 +0000 Subject: [PATCH] WIN32 RGB color fixes from Vincent. git-svn-id: file:///fltk/svn/fltk/trunk@115 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_color_win32.cxx | 12 ++++++++++-- test/checkers.cxx | 12 ++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/fl_color_win32.cxx b/src/fl_color_win32.cxx index 7b2d0e9cd..d615d2671 100644 --- a/src/fl_color_win32.cxx +++ b/src/fl_color_win32.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_color_win32.cxx,v 1.6 1998/11/08 17:02:40 mike Exp $" +// "$Id: fl_color_win32.cxx,v 1.7 1998/12/02 16:04:02 mike Exp $" // // WIN32 color functions for the Fast Light Tool Kit (FLTK). // @@ -47,9 +47,17 @@ Fl_XMap fl_xmap[256]; Fl_XMap* fl_current_xmap; HPALETTE fl_palette; +HPEN tmppen=0; +HBRUSH tmpbrush=0; static void clear_xmap(Fl_XMap& xmap) { if (xmap.pen) { + if(!tmppen) tmppen = CreatePen(PS_SOLID, 1, 0); + if(!tmpbrush) tmpbrush = CreateSolidBrush(0); + HPEN oldpen = SelectObject(fl_gc, tmppen); // Push out the current pen of the gc + if(oldpen != xmap.pen) SelectObject(fl_gc, oldpen); // Put it back if it is not the one we are about to delete + SelectObject(fl_gc, tmpbrush); // Push out the old pen of the gc + //fl_current_xmap = 0; DeleteObject((HGDIOBJ)(xmap.pen)); xmap.pen = 0; xmap.brush = -1; @@ -225,5 +233,5 @@ fl_select_palette(void) #endif // -// End of "$Id: fl_color_win32.cxx,v 1.6 1998/11/08 17:02:40 mike Exp $". +// End of "$Id: fl_color_win32.cxx,v 1.7 1998/12/02 16:04:02 mike Exp $". // diff --git a/test/checkers.cxx b/test/checkers.cxx index a35e3eb1f..3667cb045 100644 --- a/test/checkers.cxx +++ b/test/checkers.cxx @@ -1,5 +1,5 @@ // -// "$Id: checkers.cxx,v 1.5 1998/10/21 14:21:18 mike Exp $" +// "$Id: checkers.cxx,v 1.6 1998/12/02 16:04:03 mike Exp $" // // Checkers game for the Fast Light Tool Kit (FLTK). // @@ -921,10 +921,10 @@ void draw_piece(int which, int x, int y) { case WHITEKING: which = 3; break; default: return; } - fl_color(FL_BLACK); bm[which][0]->draw(x, y); - fl_color(FL_INACTIVE_COLOR); bm[which][1]->draw(x, y); - fl_color(FL_SELECTION_COLOR);bm[which][2]->draw(x, y); - fl_color(FL_WHITE); bm[which][3]->draw(x, y); + fl_color(0, 1, 0); bm[which][0]->draw(x, y); + fl_color(200, 100, 2000); bm[which][1]->draw(x, y); + fl_color(100, 100, 200);bm[which][2]->draw(x, y); + fl_color(200, 200, 100); bm[which][3]->draw(x, y); } //---------------------------------------------------------------- @@ -1366,5 +1366,5 @@ int main(int argc, char **argv) { } // -// End of "$Id: checkers.cxx,v 1.5 1998/10/21 14:21:18 mike Exp $". +// End of "$Id: checkers.cxx,v 1.6 1998/12/02 16:04:03 mike Exp $". //