High-level pixel access methods

Patrick Julien freak at codepimps.org
Mon Feb 16 00:06:45 CET 2004


On February 15, 2004 12:04 pm, Boudewijn Rempt wrote:
> 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.

This has the issues... I still thnkt that an iterator is the way to go


More information about the kimageshop mailing list