DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Pending]

Link: http://www.fltk.org/str.php?L2606
Version: 1.3-current


Does the attached patch file fltk_alpha_blend_3.patch work better?


Link: http://www.fltk.org/str.php?L2606
Version: 1.3-current
Index: src/Fl_Image.cxx
===================================================================
--- src/Fl_Image.cxx    (revision 8592)
+++ src/Fl_Image.cxx    (working copy)
@@ -379,8 +379,12 @@
 // Composite an image with alpha on systems that don't have accelerated
 // alpha compositing...
 static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, 
int cy) {
-  uchar *srcptr = (uchar*)img->array + img->d() * (img->w() * cy + cx);
-  int srcskip = img->d() * (img->w() - W);
+  int ld = img->ld();
+  if (ld == 0)
+    ld = img->w() * img->d();
+  uchar *srcptr = (uchar*)img->array;
+  srcptr += cy * ld + cx * img->d();
+  int srcskip = ld - img->d() * W;
 
   uchar *dst = new uchar[W * H * 3];
   uchar *dstptr = dst;
@@ -392,7 +396,6 @@
 
   if (img->d() == 2) {
     // Composite grayscale + alpha over RGB...
-    // Composite RGBA over RGB...
     for (int y = H; y > 0; y--, srcptr+=srcskip)
       for (int x = W; x > 0; x--) {
        srcg = *srcptr++;
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to