diff options
| author | Manolo Gouy <Manolo> | 2010-04-14 20:12:06 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2010-04-14 20:12:06 +0000 |
| commit | 79b2c201a0d36651e97140ddff215a3b1bbde93e (patch) | |
| tree | 70800b2c14172c41843b84cd2652227019f48d9d /src/Fl_Pixmap.cxx | |
| parent | f4a08a367239178a1768b46927e2d96016ebc127 (diff) | |
Fl_Pixmap: improved algorithm for WIN32 printing
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7503 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Pixmap.cxx')
| -rw-r--r-- | src/Fl_Pixmap.cxx | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx index 0bb602e8e..d20132a35 100644 --- a/src/Fl_Pixmap.cxx +++ b/src/Fl_Pixmap.cxx @@ -152,37 +152,20 @@ void Fl_Pixmap::generic_device_draw(int XP, int YP, int WP, int HP, int cx, int if(hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod, "TransparentBlt"); } if (hMod) { -# define UNLIKELY_RGB_COLOR 2,3,4 // a nearly black color unlikely to occur in pixmaps -# define WIN_COLOR RGB(2,3,4) Fl_Offscreen tmp_id = fl_create_offscreen(w(), h()); fl_begin_offscreen(tmp_id); uchar *bitmap = 0; fl_mask_bitmap = &bitmap; - // draw pixmap to offscreen using the unlikely color for background - fl_draw_pixmap(data(), 0, 0, fl_rgb_color(UNLIKELY_RGB_COLOR) ); + // draw pixmap to offscreen + fl_draw_pixmap(data(), 0, 0); fl_end_offscreen(); HDC new_gc = CreateCompatibleDC(fl_gc); int save = SaveDC(new_gc); SelectObject(new_gc, (void*)tmp_id); - // print all of offscreen but its parts using unlikely color - fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, w(), h(), WIN_COLOR ); + // print all of offscreen but its parts in background color + extern UINT win_pixmap_bg_color; // computed by fl_draw_pixmap() + fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, w(), h(), win_pixmap_bg_color ); RestoreDC(new_gc,save); - // This is an approximate algorithm that fails to print pixmap pixels that would use the unlikely color. - // It can be transformed into an exact algorithm by adding the following commented out statements - // that print pixmap one more time hiding another color (any color would fit) - /* -# define UNLIKELY_RGB_COLOR2 4,3,2 -# define WIN_COLOR2 RGB(4,3,2) - { - fl_begin_offscreen(tmp_id); - fl_draw_pixmap(data(), 0, 0, fl_rgb_color(UNLIKELY_RGB_COLOR2) ); - fl_end_offscreen(); - } - save = SaveDC(new_gc); - SelectObject(new_gc, (void*)tmp_id); - fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, w(), h(), WIN_COLOR2 ); - RestoreDC(new_gc,save); - */ DeleteDC(new_gc); fl_delete_offscreen(tmp_id); } |
