paintop brush model

Sven Langkamp sven.langkamp at
Tue Jul 28 05:24:44 CEST 2009

On Mon, Jul 27, 2009 at 1:02 PM, Lukast dev < at> wrote:

> Hi,
> today I explored the posibilities and I would like to ask you questions.
> I modified the Line tool , so that it draws preview of the tool
> according the canvas widget.
> So there is code in paint like this:
> void KisToolLine::paintLine(QPainter& gc, const QRect&)
> {
>    if (m_canvas->canvasController()->isCanvasOpenGL()){
>        OpenGL code here...
>    }else ... {
>       QPainter stuff
>    }
> }
> I'm asking you, should I use if's or make some interface with method
> paintOpenGL stuff and then
> call this paintOpenGL preview in OpenGL based canvas on every tool
> that will inherite from that interface?
> Or rather keep the style consistent with gradient tool preview and use
> #ifdefs (HAVE_OPENGL) etc. etc.?

You need both without #if you can't compile it without the opengl libs
installed and the isCanvasOpenGL as runtime switch.
I'm wondering why you are changing the line tool. What preview do you mean?
The brush for your gsoc shouldn't be needed in the line tool.

What can be a problem:
> some tools also need code in mouseMoveEvent etc. so I doin't know how
> to implement it nicely.
> There can be some math needed for painting previews specific for OpenGL
> canvas.

The tools don't have drawing code in the mouse move event. Actually you
should only need to add code in the freehand tool.

Then I have plan to add support for every paintop. Tool freehand will
> ask for model from paintop and it will paint that model if the OpenGL
> canvas is used.
> Every paintop will have it's obj file and user will set up in settings
> whether he wants to use brush outline or brush model or tool icon.

I think it would be better to leave that to the paintop. Paintop need to
have a model representation e.g. duplicate or deform.
Paintops could also override to provide custom stuff like bristle
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the kimageshop mailing list