Consecutive Convolutions

Dmitry Kazakov dimula73 at
Sun Dec 27 12:08:02 CET 2009

Well, i seem to have fixed this. Please update.

There are some crashes when you paint on the mask, i'm investigating this.

A couple of comments about the pacth:
1) There is no need to make a copy of a source device as convolution will do
this for you one more time. I mean first line should be:
KisPaintDeviceSP interm = new KisPaintDevice(src->colorSpace());

2) Shared pointers shouldn't be delete'ed. This may cause a crash =)

Final working version of the 'if':

if ( (horizontalRadius > 0) && (verticalRadius > 0) )
        KisPaintDeviceSP interm = new KisPaintDevice(src->colorSpace());

        KisConvolutionKernelSP kernelHoriz =
KisConvolutionKernel::fromMatrix(horizGaussian, 0, horizGaussian.sum());
        KisConvolutionKernelSP kernelVertical =
KisConvolutionKernel::fromMatrix(verticalGaussian, 0,

        KisConvolutionPainter horizPainter(interm, dstInfo.selection());
        horizPainter.applyMatrix(kernelHoriz, src, srcTopLeft, srcTopLeft,

        KisConvolutionPainter verticalPainter(dst, dstInfo.selection());
        verticalPainter.applyMatrix(kernelVertical, interm, srcTopLeft,
dstTopLeft, size, BORDER_REPEAT);


Dmitry Kazakov
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the kimageshop mailing list