Extracting paint operations from KisPainter

Cyrille Berger cyb at lepi.org
Fri Aug 27 12:30:48 CEST 2004


> 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
{
	paintPolyline, paintLine, paintBezierCurve...
	other functions you already have put in it
}
class KisPaintFilter : KisPaintOp
{
	implementation of paintAt
	+ stuff dependant of KisPaintFilter : filter() and setFilter()
}
class KisPaintDuplicate : KisPaintOp
{
	implementation of paintAt
	+ stuff dependant of KisPaintDuplicate : setDuplicateOffset()
}
...

KisPaintRectOp : KisPaintBase
{
	virtual rectOperation(Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h) =0;
}

class KisPaintEraseRect : KisPaintRectOp
{
	...
}

class KisPaintFillRect : KisPaintRectOp
{
	...
	setColor()
}

class KisPaintConvolution : KisPaintRectOp
{
	setMatrix()
}

class KisPaintGradient : KisPaintOp
{
	...
}

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.

> Ps. I am afraid, Cyrille, that if you were working on the filterAt code,
> you will have a merge conflict... Sorry for that.
I was well inspired, I was working on the tool ;)

-- 
--- Cyrille Berger ---


More information about the kimageshop mailing list