High-level pixel access methods

Boudewijn Rempt boud at calcifer.valdyas.org
Sun Feb 15 18:04:43 CET 2004


On Sunday 15 February 2004 17:02, Patrick Julien wrote:

>
> Well, the problem with that is that it will almost certainly fail with
> medium/large images has you need one large buffer to hold all the pixels.
>

How about a producer/consumer kind of thing. That is, define an interface that 
KisPaintDevice can use to fill its KisPixelData, and pass that to 
KisPaintDevice:

class PixelProducer {
	imageType() = 0;
	depth() = 0;
	boolean nextPixel(Pixel & p) = 0;
}


KisPaintDevice::fillWithPixels(PixelProducer source) {
	if source -> depth == depth() && source -> imageType() == imageType() {
		Pixel p;
		int i = 0;
		KisPixelData data;
		while (nextPixel( &p)) {
			data[i] = p;
			i++;
		}
	}
}

Or something like that, but proper C++, and not an unholy mixture of C++ and 
Python, but anyway, that kind of idea.
-- 
Boudewijn Rempt | http://www.valdyas.org/fading/index.cgi


More information about the kimageshop mailing list