Easy layer access for rgb8 filters.

Boudewijn Rempt boud at valdyas.org
Mon Jan 17 10:05:27 CET 2005


On Sunday 16 January 2005 22:34, Michael Thaler wrote:

> 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?

Hm... That's certainly a change in the meaning of this function. I'm in rather 
a mess currently with the color strategies, so I cannot checkin without 
breaking even more stuff, but try to replace 
KisPaintDevice::convertToQImage() with:

QImage KisPaintDevice::convertToQImage(KisProfileSP dstProfile, Q_INT32 x1, 
Q_INT32 y1, Q_INT32 w, Q_INT32 h)
{
	QImage image;
	QUANTUM * data = new QUANTUM[depth() * w * h];
	QUANTUM * ptr = data;

	if (w < 0)
		w = image() -> widht();

	if (h < 0)
		h = image() -> height();

	// XXX: Isn't this a very slow copy?
        for(Q_INT32 y=y1; y <y1+h;y++)
        {
                KisHLineIterator hiter = createHLineIterator(x1, w, y, false);
                while(! hiter.isDone())
                {
                        memcpy(ptr, (Q_UINT8 *)hiter, depth());

                        ptr += depth();
                        hiter++;
                }
        }

	// XXX: determine whether to apply the monitor profile or based on the copy 
setting
	image = colorStrategy() -> convertToQImage(data, w, h, m_profile, 
dstProfile);
	delete data;
	return image;
}



-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20050117/e6f6090b/attachment.pgp


More information about the kimageshop mailing list