finalizing the Iterator API

Roger Larsson roger.larsson at norran.net
Fri Jul 9 01:09:33 CEST 2004


On Wednesday 07 July 2004 08.54, Boudewijn Rempt wrote:
> On Wednesday 07 July 2004 01:49, Cyrille Berger wrote:
> > for instance in interlacing, or you may want to write a filter in which
> > you do not change the pixel value the same way line after line, let say
> > you want to draw a brick wall on your picture, you need to do something
> > like : while
> > 	for 10 lines
> > 		every 20 pixels put a black pixel
> > 	for 1 line
> > 		make the entire line black
> > That's simple but it may be usefull.
>
> I see -- it might indeed be useful, but these are rather specialized
> use-cases, and I would prefer something simpler for the general case.

for it in selection
	Pixel color = red;
	if (it.y() % 10 == 0 ||
	    it.x() % 20 == 0)
		color = black;

	*it = color;

Added bonus: Works for all strange type of selections.
Maybe there should also be a it.dy() and it.dx() for selection
relative drawing.

/RogerL

-- 
Roger Larsson
Skellefteå
Sweden


More information about the kimageshop mailing list