Iterator requirements

Boudewijn Rempt boud at
Mon Jul 5 21:38:37 CEST 2004

The current implementation of iterators shows the way forward, and perform
quite surprisingly well, but we'll need to extend and refine the 
implementation, and carry forward the use of iterators throughout Krita so 
that it becomes the only way to access image data. Direct tile manager access 
should be discouraged, if not made impossible (can C++ do that? no package 
private classes, are there?).

So... Here's what I think is a fair summary of recent discussions:

* Tile manager 

	(or any other image data manager, like a framebuffer,
    a banded raster or whatever)

	The tile manager loads image data on demand from Krita's file format,
	and, where possible, from other image types that allow on demand loading
	of portions of the image.

	The tile manager manages undo data (currently it's KisPainter that does this,
    but it makes sense to push this responsibility down).

	The tile manager does not allow direct access to its pixel data, except to 
	the Iterators.

* Iterators

	Iterators offer random and linear read/write access to channels, pixels and 
    2 dimensional arrays of pixels.
	Iterators return pixel data as a vector/array (whatever, but preferably not
	a pointer to a amorphous chunk of bytes*) of bytes which can be interpreted
	by the colour strategy as a colour.

	Iterators can skip pixels according to selection status, with a degree of 

	Iterators and single pixel values are passed to the colour strategies for 
	colour model specific handling.

* Colour strategies

	The colour strategies interpret pixel data delivered by the iterators
	in terms of channels.

	The colour strategies can compose pixel data.

	The colour strategies can convert pixel data from a foreign format
    to their own format (with helpers).

	XXX: common operations like increasing brightness, contrast, adjusting
	channels are often colour model specific. We need to make an inventory 
	of these colour model specific operations or come up with a clean plugin 
	mechanism to extend them.

	XXX: we need to make an inventory of places in Krita where the colour
	strategies are not yet used, but should be.

	Colour strategies can render their pixels to display RGB format (i.e. a 

* KisPaintDevice

   KisPaintDevice offers access to iterators and colour strategies for
   KisPainter and plugins to mess with images.

* KisPainter

	KisPainter offers a high-level painting API, with brushes, geometric
	shapes, hard and soft lines, gradients and patterns.


*) Although I can probably be talked out of that by showing me some real 
perfomance measurements. Always having to check boundaries will soon become a 
real pain.

Boudewijn Rempt |

More information about the kimageshop mailing list