Easy layer access for rgb8 filters.

Michael Thaler michael.thaler at ph.tum.de
Sun Jan 16 22:34:28 CET 2005


On Sunday 16 January 2005 16:40, Boudewijn Rempt wrote:
> Actually, the easiest way to prepare a line of data for the
> ported filters would be to use the convertToQImage method
> from KisPaintDevice for a block one pixel high and as wide
> as the image, filter that, and use the fromQImage method to
> create a paint device and bitBlt that back onto the original
> layer. And it might well be the fastest way, too.
>
> QImage offers a pointer to its image data, so that's easy, too.

I just tried to use convertToQImage method, but it does not seem to work 
correctly. I did the following:

void KisRainDropsFilter::process(KisPaintDeviceSP src, KisPaintDeviceSP dst, 
KisFilterConfiguration* configuration, const QRect& rect, KisTileCommand* 
ktc)
{
 kdDebug() << "Raindropsfilter 2 called!\n";

        QImage img = src->convertToQImage(0);
        
        Q_INT32 width = img.width();
        Q_INT32 height = img.height();
        
        kdDebug() << "width:" << width << " heigth:" << height << "\n"; 

 ...
}

When I call the raindrop filter, I get the following output:

krita: no color strategy
krita: no color strategy
krita: Raindropsfilter 2 called!
krita: width:0 heigth:0

Changing 

QImage img = src->convertToQImage(0) ;

to 

QImage img = src->convertToQImage(0,0,0,500,500);

gives

krita: no color strategy
krita: no color strategy
krita: Raindropsfilter 2 called!
krita: width:500 heigth:500

So in principle the function seems to work. However, I think 

QImage img = src->convertToQImage(0) ;

should really return a QImage with the contents of the whole layer and not an 
empty QImage. Can someone fix that?

Michael


More information about the kimageshop mailing list