[Digikam-devel] extragear/graphics/digikam/libs/greycstoration

Gilles Caulier caulier.gilles at gmail.com
Sat Mar 24 19:52:12 GMT 2007


SVN commit 646166 by cgilles:

digiKam from trunk : CImg::Greycstoration interface : bugfix : if an image with alpha channel is processed by CImg, handle this channel properlly. The old implementation lost alpha channel. Nota : this problem still exist with the old CImg interface of DigiKamImagePlugins. This patch can be easily backported to 0.9.1 package.
CCMAIL: digikam-devel at kde.org

 M  +5 -1      greycstorationiface.cpp  


--- trunk/extragear/graphics/digikam/libs/greycstoration/greycstorationiface.cpp #646165:646166
@@ -151,7 +151,7 @@
     int imageWidth   = m_orgImage.width();
     int imageHeight  = m_orgImage.height();
 
-    d->img = CImg<>(imageWidth, imageHeight, 1, 3);
+    d->img = CImg<>(imageWidth, imageHeight, 1, 4);
 
     if (!m_orgImage.sixteenBit())           // 8 bits image.
     {
@@ -164,6 +164,7 @@
                 d->img(x, y, 0) = ptr[0];        // blue.
                 d->img(x, y, 1) = ptr[1];        // green.
                 d->img(x, y, 2) = ptr[2];        // red.
+                d->img(x, y, 3) = ptr[3];        // alpha.
                 ptr += 4;
             }
         }
@@ -179,6 +180,7 @@
                 d->img(x, y, 0) = ptr[0];        // blue.
                 d->img(x, y, 1) = ptr[1];        // green.
                 d->img(x, y, 2) = ptr[2];        // red.
+                d->img(x, y, 3) = ptr[3];        // alpha.
                 ptr += 4;
             }
         }
@@ -240,6 +242,7 @@
                 ptr[0] = (uchar) d->img(x, y, 0);        // Blue
                 ptr[1] = (uchar) d->img(x, y, 1);        // Green
                 ptr[2] = (uchar) d->img(x, y, 2);        // Red
+                ptr[3] = (uchar) d->img(x, y, 3);        // Alpha
                 ptr += 4;
             }
         }
@@ -256,6 +259,7 @@
                 ptr[0] = (unsigned short) d->img(x, y, 0);        // Blue
                 ptr[1] = (unsigned short) d->img(x, y, 1);        // Green
                 ptr[2] = (unsigned short) d->img(x, y, 2);        // Red
+                ptr[3] = (unsigned short) d->img(x, y, 3);        // Alpha
                 ptr += 4;
             }
         }



More information about the Digikam-devel mailing list