Easy layer access for rgb8 filters.
Michael Thaler
michael.thaler at physik.tu-muenchen.de
Mon Jan 17 10:40:17 CET 2005
On Monday 17 January 2005 10:05, you wrote:
> 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();
I know I repeat myself, but imagine you have a 20x20 pixel photo. Now you
create another layer, say a 20000x20000 pixel landscape. Now you have two
layers, one 20x20 pixels wide, the other one 20000x20000 pixels wide. Now you
want to apply a filter to the 20x20 pixel photo.
With that code, QImage img = src->convertToQImage(0) will give you a
20000x20000 pixel QImage, won't it? Maybe in this case it is really better to
use the extent function, even if it does not give you the true extension of
your photo, but the size of a tile (64x64 pixels).
One could still check if extent is bigger then the image width and image
height and in this case just take the image width and image height. But
somehow this all seems totally broken to me.
Do the iterators know the exact extent of an image? Then one could just use
a QMemArray instead of a QUANTUM array, iterate over the whole image and get
the size and the width from the iterators while iterating.
Michael
More information about the kimageshop
mailing list