diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-03-15 23:39:47 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-03-15 23:39:47 +0000 |
| commit | 99e9c68215b0bc27a677762b70e69ca608ba00b1 (patch) | |
| tree | ba4fe54e7dd06891f42b3246b28107e34e319e58 /test | |
| parent | 7c018b55c2c38f30a7d8938d2facbf9703486637 (diff) | |
restoring transparency in test/unittest_images.cxx (Windows and X11).
Note: fl_draw_image() supports transparency (alpha channel) currently
only on Mac OS X.
This needs to be fixed for other platforms !
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7272 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
| -rw-r--r-- | test/unittest_images.cxx | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/test/unittest_images.cxx b/test/unittest_images.cxx index a2819a5a3..a5ffb37f9 100644 --- a/test/unittest_images.cxx +++ b/test/unittest_images.cxx @@ -28,6 +28,10 @@ #include <FL/Fl_Box.H> #include <FL/fl_draw.H> +// Note: currently (March 2010) fl_draw_image() supports transparency with +// alpha channel only on Apple (Mac OS X), but Fl_RGB_Image->draw() +// supports transparency on all platforms ! + // //------- test the image drawing capabilities of this implementation ---------- // @@ -69,30 +73,44 @@ public: void draw() { Fl_Box::draw(); + // top left: RGB + int xx = x()+10, yy = y()+10; fl_color(FL_BLACK); fl_rect(xx, yy, 130, 130); fl_draw_image(img_rgb, xx+1, yy+1, 128, 128, 3); fl_draw("RGB", xx+134, yy+64); + // bottom left: RGBA + xx = x()+10; yy = y()+10+134; fl_color(FL_BLACK); fl_rectf(xx, yy, 130, 130); fl_color(FL_WHITE); fl_rectf(xx+1, yy+1, 64, 64); fl_color(FL_WHITE); fl_rectf(xx+65, yy+65, 64, 64); - fl_draw_image(img_rgba, xx+1, yy+1, 128, 128, 4); - //i_rgba->draw(xx+1,yy+1); +#ifdef __APPLE__ + fl_draw_image(img_rgba, xx+1, yy+1, 128, 128, 4); // Apple: okay w/alpha +#else + i_rgba->draw(xx+1,yy+1); // only Fl_RGB_Image->draw() works with alpha +#endif fl_color(FL_BLACK); fl_draw("RGBA", xx+134, yy+64); + + // top right: Gray xx = x()+10+200; yy = y()+10; fl_color(FL_BLACK); fl_rect(xx, yy, 130, 130); fl_draw_image(img_gray, xx+1, yy+1, 128, 128, 1); fl_draw("Gray", xx+134, yy+64); + // bottom right: Gray+Alpha + xx = x()+10+200; yy = y()+10+134; fl_color(FL_BLACK); fl_rectf(xx, yy, 130, 130); fl_color(FL_WHITE); fl_rectf(xx+1, yy+1, 64, 64); fl_color(FL_WHITE); fl_rectf(xx+65, yy+65, 64, 64); - // fl_draw_image(img_gray_a, xx+1, yy+1, 128, 128, 2); - i_ga->draw(xx+1,yy+1); +#ifdef __APPLE__ + fl_draw_image(img_gray_a, xx+1, yy+1, 128, 128, 2); // Apple: okay w/alpha +#else + i_ga->draw(xx+1,yy+1); // only Fl_RGB_Image->draw() works with alpha +#endif fl_color(FL_BLACK); fl_draw("Gray+Alpha", xx+134, yy+64); } }; |
