summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-02-01 14:24:24 +0000
committerManolo Gouy <Manolo>2016-02-01 14:24:24 +0000
commit6f799cb6486bb3b71ae60f09b7ca1cd0a668c6a0 (patch)
tree86d286fe72d38f7882820ecc53b820fc3fec0e53 /examples
parent2b36a14d10855ec88b975321791cf70fc6c7bc50 (diff)
Fix shapedwindow test program.
same commit as in 1.3 branch git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11107 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'examples')
-rw-r--r--examples/shapedwindow.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/shapedwindow.cxx b/examples/shapedwindow.cxx
index f614f98da..a7ffe8f13 100644
--- a/examples/shapedwindow.cxx
+++ b/examples/shapedwindow.cxx
@@ -86,7 +86,13 @@ Fl_RGB_Image* prepare_shape(int w)
Fl_RGB_Image* img = surf->image();
delete surf;
current->set_current();
- return img; // return depth-3 white image on black background
+ if (img->d() == 4) { // if RGBA image, set its A component equal to its R component
+ for (int i = 0; i < img->h(); i ++) {
+ uchar *q = (uchar*)img->array + i * img->ld();
+ for (int j = 0; j < img->w(); j++, q += 4) *(q+3) = *q;
+ }
+ }
+ return img; // return white image on black background
}
int main(int argc, char **argv) {