Albrecht Schlosser wrote:

Mac: looks as if only the checker board background is drawn
and outputs to stderr:

"... <Error>: CGImageCreate: invalid image bits/pixel: 16."

I think that the attached file alpha_mac.diff will fix
the above error on MacOS, but I can't test it right now.

I copied this from fl_draw_image_mac.cxx.

To test it, you need to apply the unittest_images.diff file
from my previous post as well. Anybody, who likes to test it?

These combined patches should solve the alpha drawing issue
for all platforms except the Windows "gray+alpha" case
(STR 2105).

My current opinion is that fl_draw_image() is *not* designed
to draw images with alpha, but this may change again...

http://www.fltk.org/doc-1.1/drawing.html#fl_draw_image

Maybe we could extend the API to achieve correct alpha
drawing as well.

Albrecht
Index: src/Fl_Image.cxx
===================================================================
--- src/Fl_Image.cxx    (revision 6771)
+++ src/Fl_Image.cxx    (working copy)
@@ -452,7 +452,11 @@
   if (H <= 0) return;
   if (!id) {
 #ifdef __APPLE_QUARTZ__
-    CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
+    CGColorSpaceRef lut = 0;
+    if (d()<=2)
+      lut = CGColorSpaceCreateDeviceGray();
+    else
+      lut = CGColorSpaceCreateDeviceRGB();
     CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, 
w()*h()*d(), 0L);
     id = CGImageCreate( w(), h(), 8, d()*8, ld()?ld():w()*d(),
         lut, (d()&1)?kCGImageAlphaNone:kCGImageAlphaLast,
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to