[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/graphics/krita-plugins/lib
From:       Cyrille Berger <cyb () lepi ! org>
Date:       2007-05-17 18:39:54
Message-ID: 1179427194.575200.26904.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 665727 by berger:

implement the mixColors operation, which fix resizing of images

 M  +16 -1     kis_generic_colorspace.h  


--- trunk/playground/graphics/krita-plugins/lib/kis_generic_colorspace.h \
#665726:665727 @@ -117,7 +117,22 @@
 
         virtual Q_UINT8 difference(const Q_UINT8* /*src1*/, const Q_UINT8* /*src2*/) \
{ return 255; }  
-        virtual void mixColors(const Q_UINT8 **/*colors*/, const Q_UINT8 \
*/*weights*/, Q_UINT32 /*nColors*/, Q_UINT8 */*dst*/) const { } +        virtual void \
mixColors(const Q_UINT8 **colors, const Q_UINT8 *weights, Q_UINT32 nColors, Q_UINT8 \
*dst) const +        {
+            const _type** colorsT = reinterpret_cast<const _type**>( colors );
+            _type* dstT = reinterpret_cast<_type*>( dst );
+            for(int j = 0; j < _nbchannels; j++)
+            {    dstT[j] = 0.0; }
+            for(int i = 0; i <nColors; i++)
+            {
+                for(int j = 0; j < _nbchannels; j++)
+                {
+                    dstT[j] += colorsT[i][j] * weights[i];
+                }
+            }
+            for(int j = 0; j < _nbchannels; j++)
+            {    dstT[j] /= 255; }
+        }
 
         virtual void convolveColors(Q_UINT8** colors, Q_INT32* kernelValues, \
KisChannelInfo::enumChannelFlags /*channelFlags*/, Q_UINT8 *dst, Q_INT32 factor, \
Q_INT32 offset, Q_INT32 nColors) const  {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic