<div class="gmail_quote">On Mon, Jul 27, 2009 at 1:02 PM, Lukast dev <span dir="ltr"><<a href="mailto:lukast.dev@gmail.com">lukast.dev@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
today I explored the posibilities and I would like to ask you questions.<br>
<br>
I modified the Line tool , so that it draws preview of the tool<br>
according the canvas widget.<br>
So there is code in paint like this:<br>
<br>
void KisToolLine::paintLine(QPainter& gc, const QRect&)<br>
{<br>
if (m_canvas->canvasController()->isCanvasOpenGL()){<br>
OpenGL code here...<br>
}else ... {<br>
QPainter stuff<br>
}<br>
}<br>
<br>
I'm asking you, should I use if's or make some interface with method<br>
paintOpenGL stuff and then<br>
call this paintOpenGL preview in OpenGL based canvas on every tool<br>
that will inherite from that interface?<br>
<br>
Or rather keep the style consistent with gradient tool preview and use<br>
#ifdefs (HAVE_OPENGL) etc. etc.?</blockquote><div><br>You need both without #if you can't compile it without the opengl libs installed and the isCanvasOpenGL as runtime switch.<br>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.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What can be a problem:<br>
some tools also need code in mouseMoveEvent etc. so I doin't know how<br>
to implement it nicely.<br>
There can be some math needed for painting previews specific for OpenGL canvas.</blockquote><div> <br>The tools don't have drawing code in the mouse move event. Actually you should only need to add code in the freehand tool.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Then I have plan to add support for every paintop. Tool freehand will<br>
ask for model from paintop and it will paint that model if the OpenGL<br>
canvas is used.<br>
Every paintop will have it's obj file and user will set up in settings<br>
whether he wants to use brush outline or brush model or tool icon.</blockquote><div><br>I think it would be better to leave that to the paintop. Paintop need to have a model representation e.g. duplicate or deform.<br>Paintops could also override to provide custom stuff like bristle simulation.<br>
</div></div><br>