guide to autosizing paintdevices
Boudewijn Rempt
boud at valdyas.org
Sun Jan 16 09:24:25 CET 2005
On Sunday 16 January 2005 01:27, Michael Thaler wrote:
> I would really like to see an easy way to get the image data in a QUANTUM
> array, because many of the filters in other applications like digikam and
> also gimp work on an QUANTUM array. What I did with the filters I ported
> from digikam was, to copy the image to a QUANTUM array using iterators,
> then passing the pointer to the QUANTUM array to actual filter function (in
> this way, I could reuse the filters from digikam without changing anything)
> and then I read the modified array back again using iterators. I know that
> this is quite clumsy and in principle we should rewrite all the filters to
> directly use the iterators and I plan to do this in the long run, but I
> think it is important to get some filters working now. We can rework them
> later.
I think copying them into an array is the right thing because that way you can
use the conversion methods to QColor in the color strategies to fill the
array with rgb8 values, and then use the from QColor methods to copy the data
in the right format to the paint device. That way, no matter how simplistic
the filter, it will always work with all color strategies.
So, I would:
create an array that will be as wide as the image
iterate over the layer data
convert each pixel to a QColor
copy the QColor to the array
execute the filter for that line
loop over the array
convert the QColor to a KisPixel
copy the KisPixel using an iterator to the layer data
> So I either need an extent function that gives the real width and height of
> the image data or a method that returns a pointer to a QUANTUM array with
> the image data. I think this would also make it much easier for other
> people to work on plugins.
>
> I also need the width and the height of the actual image data for progress
> info.
>
> Using the image width and height works if you only have one layer. But
> since the filters work on layers and not the image, using image width and
> height will not work for an image composed of several layers with different
> sizes.
I think, from playing a bit with an old version of Photoshop, that you can
safely use the image size. The layer will extend to cover the entire image
and Photoshop filters seldom work outside image boundaries anyway.
--
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/20050116/ccb28408/attachment.pgp
More information about the kimageshop
mailing list