guide to autosizing paintdevices

Michael Thaler michael.thaler at ph.tum.de
Sun Jan 16 01:27:29 CET 2005


On Sunday 16 January 2005 00:30, Casper Boemann wrote:

> Comments and requests for more details or other areas are most welcome. In
> the end this should go into the docs

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.

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.

Also for resizing/scaling layers, you need the actual image size to compute 
magnification factors. Any you want to display the actual layer size in the 
resize/rescale layer dialog.

The same goes for other things like rotations and so on. And maybe there 
should also be a method to save a layer (as far as I know, gimp does not have 
this, but I guess this would be handy) and then you would also need the 
actual layer size.

I guess, theoretically you can live without knowing the layer size and just 
use iterators. But in practice, I think it would be really convenient to have 
simple functions to get the width/height of a layer (in principle one can of 
course use the iterators to get the actual layer size, but this is really 
stupid if you need the layer size beforehand, e.g. for the scaling code).

Is there a fundamental problem in offering the actual width and height of a 
layer (not the width and the height of the tiles containing a layer). I 
suppouse, the iterators do know them, because otherwise they could not 
iterate over the image data, so it should be possible to have these 
functions, isn't it?

So I think, I should really go to bed now...

Michael


More information about the kimageshop mailing list