Footprint algorithms: in the stamp, or in the paintop?

Emanuele Tamponi emanuele at valinor.it
Wed Mar 26 09:13:24 CET 2008


To make things a little clearer, I'll make here the point that we are come 
to - if I got it correctly. I'll try to use pseudo-code since it looks like 
it's the better way to explain things :)

!."A line of code is worth one thousand words".!

1) Stamp calculation is separated from paintops (this is true for natural 
brushes too):

KisBrushManipulator::createStamp(stampObject,colorSource,pointerData)
{
   [ manipulate the stampObject to obtain the final brush stamp ];
   return manipulatedStampObject;
}

KisPencilManipulator::createStamp(stampObject,colorSource,pointerData)
{
   [ manipulate the stampObject to obtain the final pencil stamp ];
   return manipulatedStampObject;
}

KisNaturalManipulator::createStamp(stampObject,colorSource,pointerData)
{
   [ manipulate the stampObject to obtain the final natural-looking stamp ];
   return manipulatedStampObject;
}

2) A nice UI will let the user select the "current" manipulator: being it a 
brush, a pencil, a natural brush or an image of a pepper.

...
somewhere->something->setCurrentManipulator = 
someotherthing->manipulatorById("brushmanipulator")
...

3) KisPaintOps can - *if they want* - use the current stamp (but there will be 
paintops that don't need a stamp at all, if you can imagine them):

KisDrawingOp::paintAt(info)
{
    ...
    stamp = currManipulator->createStamp(stampObject,colorSource,info);

    bitBlt(stamp to canvasDevice);
}

...

KisCloneOp::paintAt(info)
{
    ... [here you can, for example, set an area
         of the canvas as "colorSource"]

    stamp = currManipulator->createStamp(stampObject,colorSource,info);

    bitBlt(stamp to canvasDevice);
}

4) I'd like to point out that this integrates perfectly both with current code 
and with boud's work (if I understand correctly), because we can use preset 
to have a "currentManipulator" depending on the paintop preset used.

5) Another thing I want to point out is what I mean as "stamp": this can be 
what we currently call in krita tree a "KisBrush", but it could eventually 
come to another set of classes: the important thing is that this "stamp" is 
the footprint upon which the paintop will behave. It has a shape, a size, a 
position, an hotspot, can have color(s) on it, whatever: but the shape, size 
and position of the stamp has to be "retrieved" by the paintop, using 
a "current" manipulator, so it's not dependant on the paintop (except for the 
use of paintop presets).

In my very honest opinion, I don't think this is a great difference from what 
we have currently, nor it's is from what you have planned.

Emanuele


More information about the kimageshop mailing list