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

emanuele at valinor.it emanuele at valinor.it
Wed Mar 26 16:59:18 CET 2008


But, as said on IRC, this design proposes another thing that should be  
discussed and makes the difference a bit bigger.

Now, we use manipulator to retrieve the "final" stamp that will be  
handled, if needed, by the paintop. The fact is in the current code,  
the "part" of the manipulator is done by single paintops:

1) KisBrushOp "manipulates" the source stamp to get the behavior of a brush
2) KisPenOp "manipulates" it in another way
3) KisBidiOp will manipulate it in still another way
N) Each KisPaintOp manipulates the source stamp as it wants.

This has the drawback that each manipulation algorithm is tied to a  
particular paintop instead of being separate from it, that's why the  
idea of the manipulator has come.

What I propose is this:

1) Make the manipulation, as said before, separate from the paintop  
and just "retrievable" if needed.
2) Introduce a KisDrawingOp, that just takes the manipulated stamp and  
draw it onto the canvas.
3) Keep KisPenOp and KisBrushOp, if needed, to give more control on  
the manipulations (but I think that they can be completely substituted  
by manipulators + KisDrawingOp + eventually KisDynamicOp)
4) From now on, KisPaintOp will not handle manipulations of the stamp,  
it will handle things like bidi operations, colorsource generations  
and so on.

Again, some pseudo-code to explain:

KisDrawingOp::paintAt(info)
{
     stamp = currentManipulator->createStamp(...) <--- this will  
retrieve the stamp modified by the current manipulator, substituting  
current KisBrushOp and KisPenOp code

    bitBlt(stamp to canvas);
}

KisBrushOp::paintAt(info)
{
     stamp = brushManipulator->createStampAdvanced(more advanced options)

     // This adds flexibility and options to the brush manipulator...

     bitBlt(stamp to canvas);
}

KisDynamicOp::paintAt(info)
{
     stamp = very very very advanced and optionful functions

     // This is completely user configurable, differently from  
partially "binded" options for the standard manipulators.

     bitBlt(stamp to canvas);
}

KisBidiOp::paintAt(info)
{
     // Retrieve current stamp shape and color
     stamp = currentManipulator->....

     // Do bidi operations
     ...

     bitBlt(stamp to canvas);
}

Again, I tried to keep ideas compatible with boud work... And they are, right?

Emanuele



More information about the kimageshop mailing list