smooth painting (was: Re: Filters "dialog" in 2.0)

Boudewijn Rempt boud at valdyas.org
Thu Jun 21 08:06:50 CEST 2007


On Wednesday 20 June 2007, Cyrille Berger wrote:

> Yes and the problem I have met to get a better result is that currently the
> stroke is rendered on the final canvas without the possibility to know the
> full path. So a few possibility are available :
> - delay the drawing until the next point is available and hope the user
> won't notice (and paint with a null tangent when the cursor don't move for
> more than a second)
> - keep the bezier curve (using for instance Emanuele's last year google
> soc), but the main problem is then performance when rendering the curve (
> maybe some optimization can be done by just rerendering part of the curve
> thought) - the worse is to try to guess the next move of the user (which is
> what we do currently :) ) but that's still give good enought results

The way Inkscape works is by having the line divided into two segments: a 
provisional part and a finished part. The provisional part is shown red, and 
changes as you continue drawing to its final form. The results are nice and 
smooth, but it's disconcerting to see that the line moves to where you 
definitely didn't draw.

What we could try is to keep the control points for the duration of the 
stroke, and on mouse-up render the whole stroke once again  but this time 
smoothed out. Only then would the stroke be composited onto the layer. This 
would mean, though, that we get rid of the direct painting mode, but that's 
not a terrible hardship.

That said, your code indeed gives quite nice results already :-)

-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20070621/1d4d9f60/attachment.pgp 


More information about the kimageshop mailing list