Author: manolo
Date: 2012-03-28 06:38:18 -0700 (Wed, 28 Mar 2012)
New Revision: 9309
Log:
WIN32: Pixmap printing uses a global variable called win_pixmap_bg_color equal 
to the color
used for the pixmap background, and treats this color as transparent. FLTK 
assigns to this variable
a color unused by the processed pixmap. This variable should be specific to 
each processed
pixmap (In practice, it's very unlikely that several values are needed). A new 
member variable is
added to the fltk3::Pixmap object to hold this value.

Modified:
   branches/branch-3.0/include/fltk3/Pixmap.h
   branches/branch-3.0/src/fltk3/Pixmap.cxx

Modified: branches/branch-3.0/include/fltk3/Pixmap.h
===================================================================
--- branches/branch-3.0/include/fltk3/Pixmap.h  2012-03-28 13:19:33 UTC (rev 
9308)
+++ branches/branch-3.0/include/fltk3/Pixmap.h  2012-03-28 13:38:18 UTC (rev 
9309)
@@ -31,8 +31,10 @@
 #ifndef Fltk3_Pixmap_H
 #define Fltk3_Pixmap_H
 #  include "Image.h"
+#if defined(WIN32)
+#  include "x.h"
+#endif
 
-
 class Fl_Pixmap;
 
 
@@ -79,6 +81,9 @@
     
   private:
     
+#if defined(WIN32)
+    UINT pixmap_bg_color; // RGB color used for pixmap background
+#endif // WIN32
 #if defined(__APPLE__) || defined(WIN32)
     void *id_; // for internal use
     void *mask_; // for internal use (mask bitmap)

Modified: branches/branch-3.0/src/fltk3/Pixmap.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Pixmap.cxx    2012-03-28 13:19:33 UTC (rev 
9308)
+++ branches/branch-3.0/src/fltk3/Pixmap.cxx    2012-03-28 13:38:18 UTC (rev 
9309)
@@ -55,6 +55,7 @@
 
 #ifdef WIN32
 extern void fl_release_dc(HWND, HDC);      // located in Fl_win32.cxx
+extern UINT win_pixmap_bg_color; // computed by fltk3::draw_pixmap()
 #endif
 
 extern uchar **fl_mask_bitmap; // used by fltk3::draw_pixmap.cxx to store mask
@@ -125,6 +126,9 @@
 #endif
     fltk3::draw_pixmap(data(), 0, 0, fltk3::BLACK);
 #ifndef __APPLE__
+#if defined(WIN32)
+    this->pixmap_bg_color = win_pixmap_bg_color;
+#endif
     fl_mask_bitmap = 0;
     if (bitmap) {
       mask_ = fl_create_bitmask(w(), h(), bitmap);
@@ -145,8 +149,6 @@
 
 #elif defined(WIN32)
 
-extern UINT win_pixmap_bg_color; // computed by fltk3::draw_pixmap()
-
 void fltk3::GDIGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int 
WP, int HP, int cx, int cy) {
   int X, Y, W, H;
   if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
@@ -179,7 +181,7 @@
     int save = SaveDC(new_gc);
     SelectObject(new_gc, (void*)pxm->id_);
     // print all of offscreen but its parts in background color
-    fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, pxm->w(), pxm->h(), 
win_pixmap_bg_color );
+    fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, pxm->w(), pxm->h(), 
pxm->pixmap_bg_color );
     RestoreDC(new_gc,save);
     DeleteDC(new_gc);
   }

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to