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

List:       kde-kimageshop
Subject:    Re: Patch for smudge
From:       Cyrille Berger <cberger () cberger ! net>
Date:       2010-09-23 8:54:49
Message-ID: 201009231054.49932.cberger () cberger ! net
[Download RAW message or body]

On Wednesday 22 September 2010, LukasT.dev@gmail.com wrote:
> Have you got ideas for different solution or what should I test?
> I'm thinking about changing the opacity of the mask pixels maybe?
> I did not managed to test it yet though.
Rereading your patch, I notice you did not exactly followed my suggestion on 
IRC :) To make things clear, I have made a patch that does what I suggested.

It has decent smudging (I didn't compare it with previous code), it smudges 
transparent pixels. But there is a square block bug, when drawing on 
transparent pixels (as can be seen in [1]).

I let you investigate the block stuff :)

[1] http://cyrille.diwi.org/tmp/krita/smudgetest.png

-- 
Cyrille Berger

["smudgeop.diff" (text/x-patch)]

Index: smudge/kis_smudgeop.cpp
===================================================================
--- smudge/kis_smudgeop.cpp	(revision 1178453)
+++ smudge/kis_smudgeop.cpp	(working copy)
@@ -153,22 +153,7 @@
         /* Without those limits, the smudge brush doesn't smudge anymore, it either \
                makes a single
         dropplet of color, or drags a frame indefinitely over the canvas. */
         opacity = qBound(MIXABLE_LOWER_LIMIT, opacity, MIXABLE_UPPER_LIMIT);
-        
-        // Update the whole temporary data area, only grow it, don't shrink it. \
                TODO: Shrink it when relevant
-        QRect currentTempDataRect = QRect(extractionTopLeft, \
                maskDab->bounds().size());
-        if (currentTempDataRect.contains(m_wholeTempData)) {
-            m_wholeTempData = currentTempDataRect;
-        }
-        
-        // Reduce the opacity of all the data contained therein
-        KisRectIterator it = m_tempDev->createRectIterator(m_wholeTempData.x(), \
                m_wholeTempData.y(),
-                                                           m_wholeTempData.width(), \
                m_wholeTempData.height());
-        KoColorSpace* cs = m_tempDev->colorSpace();
-        while (!it.isDone()) {
-            cs->setOpacity(it.rawData(), quint8(cs->opacityF(it.rawData()) * \
                opacity), 1);
-            ++it;
-        }
-        
+                
         // Invert the opacity value for color absorption in the next lines \
(copyPainter)  opacity = OPACITY_OPAQUE_U8 - opacity;
     }
@@ -181,6 +166,7 @@
     it extracts a simple unmasked rectangle and adds it to what was extracted before \
                in this same block of code,
     this sometimes shows artifacts when the brush is used with stylus and high \
spacing */  KisPainter copyPainter(m_tempDev);
+    copyPainter.setCompositeOp(COMPOSITE_COPY);
     copyPainter.setOpacity(opacity);
     copyPainter.bitBlt(extractionTopLeft.x(), extractionTopLeft.y(), \
painter()->device(), x, y, sw, sh);  copyPainter.end();



_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop


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

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