Extracting paint operations from KisPainter

Boudewijn Rempt boud at valdyas.org
Fri Aug 27 13:09:49 CEST 2004


On Friday 27 August 2004 12:30, Cyrille Berger wrote:
> > Worse, KisPaintOp needs KisPainter, and KisPainter needs KisPaintOp.
> > Apparently, #including each other in each others header is something that
> > doesn't work.
>
> I think we should have made a different schema :
>
> class KisPaintBase
> {
>  bitBlt, cancel, begin, end, beginTransaction, endTransaction...
> }
> class KisPaintOp : KisPaintBase

I considered this, but I didn't want to make each paint operation inherit 
KisPainter. I'm satisfied for now -- I only want to add a factory and 
registry so paint operations can be implemented as plugins and it becomes 
possible to present all possible paint operations in a combobox in line, 
ellipse etc.

Ultimately, my goal is to separate the ui for tools (freehand, line, ellipse, 
etc.), 'brushes' (brush, pen, airbrush, eraser) and brush shapes (the current 
Gimp brushes). Perhaps better names would be 'actions', 'tools' and 
'brushes'. It's done this way in Corel Painter, and it allows easy extension 
with new paint op types.


> {
>  paintPolyline, paintLine, paintBezierCurve...
>  other functions you already have put in it
> }
> class KisPaintFilter : KisPaintOp
> {
>  implementation of paintAt
>  + stuff dependant of KisPaintFilter : filter() and setFilter()
> }

I'm considering doing that.

<...>

> And with that scheme, I am not sure we need a factory. When you want to do
> a painting operation, you just have to create the class you need.

But paint op become another modality of the tool. What I mean is -- every 
paint op is potentially useful in many tools, from freehand (the only 
specialization of brush, pen etc. of freehand is their op) to polyline, line, 
ellipse etc. A registry allows for an extensible selection mechanism in those 
tools. A factory is needed because the paint ops cannot become singletons.

-- 
Boudewijn Rempt | http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20040827/7021f73c/attachment.pgp


More information about the kimageshop mailing list