paintop brush model

Lukast dev lukast.dev at gmail.com
Mon Jul 27 13:02:22 CEST 2009


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.?

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.

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.

What do you think?
Lukas


More information about the kimageshop mailing list