diff options
| author | Manolo Gouy <Manolo> | 2018-04-18 15:36:45 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-04-18 15:36:45 +0000 |
| commit | 71d23d5574f3f53f10ae50d20b8c67917547eeea (patch) | |
| tree | 00dcde91c7422d076c2b3fa7fa706cae5ce0abc1 /src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | |
| parent | 15e3f4b2d2fca4e501e13a2a303880013955dfcd (diff) | |
Add comments: "Implementation note about how Fl_Pixmap objects get printed under Windows"
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12852 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx index 26439fa7b..e67df4844 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx @@ -654,7 +654,21 @@ void Fl_GDI_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm, int X, int Y, int W, int unscale_clip(r2); } - +/* ===== Implementation note about how Fl_Pixmap objects get printed under Windows ===== + Fl_Pixmap objects are printed with the print-specific Fl_GDI_Printer_Graphics_Driver + which uses the TransparentBlt() system function that can scale the image and treat one + of its colors as transparent. + Fl_GDI_Printer_Graphics_Driver::draw_pixmap(Fl_Pixmap *,...) sets need_pixmap_bg_color, + a static class variable, to 1 and recaches the image. This calls fl_convert_pixmap() + that checks the value of need_pixmap_bg_color. When this value is not 0, fl_convert_pixmap + runs in a way that memorizes the list of all colors in the pixmap, computes + a color absent from this list, uses it for the transparent pixels of the pixmap and puts + this color value in need_pixmap_bg_color. As a result, the transparent areas of the image + are correcty handled by the printing operation. Variable need_pixmap_bg_color is ultimately + reset to 0. + Fl_GDI_Graphics_Driver::make_unused_color_() which does the color computation mentionned + above is implemented in file src/fl_draw_pixmap.cxx + */ void Fl_GDI_Printer_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) { int X, Y, W, H; if (start_image(pxm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) return; @@ -671,7 +685,6 @@ void Fl_GDI_Printer_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, float scaleH = pxm->data_h()/float(pxm->h()); fl_TransparentBlt(gc_, X, Y, W, H, new_gc, cx * scaleW, cy * scaleH, W * scaleW, H * scaleH, need_pixmap_bg_color ); - need_pixmap_bg_color = 0; RestoreDC(new_gc,save); DeleteDC(new_gc); need_pixmap_bg_color = 0; |
