paintop brush model

LukasT lukast.dev at gmail.com
Wed Jul 29 11:12:39 CEST 2009


On Tuesday 28 July 2009 05:24:44 Sven Langkamp wrote:
> On Mon, Jul 27, 2009 at 1:02 PM, Lukast dev <lukast.dev at gmail.com> 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.
I see. I was thinking and testing the preview of the tool in general and line 
tool seems to be nice for testing.

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

They don't have drawing code there but code that is related to drawing like 
e.g. openGL program for gradient tool or some computation of positions for 
drawing line in line tool. It is never drawing code, just related code to 
drawing..

>
> 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
> simulation.
Yep, I will implement it that way.


More information about the kimageshop mailing list