Version: svn trunk (using KDE 4.5.1)
When lines are painted slowly and carefully on a tablet, they come out looking smooth and as expected. If painting quickly (even with a small brush) they become more like a set of sraight lines with sharper bends in them.
If this is something like not enough sample data from the driver, then maybe we could increase smoothing with cursor velocity?
Steps to Reproduce:
1. Paint a continuous line rapidly. (Such as a scribble)
A line made of straight parts with bends.
One continuous curvy line.
OS: Linux (i686) release 2.6.32-24-generic-pae
Driver:ATI Foss driver
Kubuntu Lucid (10.04)
Created attachment 51764 [details]
Showing two lines drawn at different speeds, with different smoothness
SVN commit 1190958 by rempt:
add a return statement after fatal to please gcc 4.5.1
M +3 -0 KoCtlCompositeOp.cpp
WebSVN link: http://websvn.kde.org/?view=rev&revision=1190958
Yes, definitely the case.
Here's a patch that changes the smoothing method. It uses cardinal splines (https://secure.wikimedia.org/wikipedia/en/wiki/Cardinal_spline#Cardinal_spline), so at every mouse event, it only knows enough to draw the the curve up to the *previous* mouse event. It does complete the curve on mouse release. I still respect the 'smoothness' parameter, but it seems a bit useless - decreasing it from 1000 makes curves less smooth, which kind of defeats the purpose of the feature...
On a more mundane note, I don't like the name 'm_olderPaintInformation' (which is one step older than 'm_previousPaintInformation') but I couldn't think of anything better.
Created attachment 58072 [details]
Patch to change smoothing
Thanks! Is this in trunk, or does it need to be manually applied?
You'll have to apply it yourself. I hope it works for you :)
Cool stuff, I'll try it today.
Okay. I definitely see an improvement, so it's worth going in, though it's not perfect yet, but that might be my cheap graphire graphics tablet. The whole smoothness setting is something we need to discuss. Cyrille, what do you think?
Since you said it is improveming, please commit.
Geoffry, can you commit yourself or do you want to get a kde committer account?
I don't have commit access. How do I get a committer account?
Follow the instructions on http://techbase.kde.org/Contribute/Get_a_SVN_Account, giving me as your sponsor.
My opinion about this patch was that is should be optional.
It had disadvantage that you see your stroke one dab behind.
It is not always what I want when I paint.
Well, unchecking the 'smooth' checkbox does disable it.
Sure, but the bezier way of smoothing is still useful and does not have the disadvantage of being one dab behind.
So I would like to have no smooth lines, smooth lines with bezier, smooth line with cubics.
I'm curious as to when this is an issue (the stroke being a dab behind). I only notice this effect occasionally, when making a very rapid movement and then immediately stopping, which seems a bit artificial to me. If it really is important, then maybe an extra node should be added if the mouse stops moving for a short while?
I just don't think it makes sense to have an option of "not smooth", "less smooth" or "smooth". In particular, the old code, although it does produce a smooth curve, really creates a series of question-mark shaped curves (bump on one end and a straight line on the other), and I don't think that makes sense in any situation.
btw: a cubic spline is a Bezier curve :)
Created attachment 58265 [details]
Whoops, I hit Enter by accident. That last patch adds a timer to make lag less noticeable by finishing the stroke to the latest mouse position after 100ms of inactivity, creating a 'cusp' (i.e. not smooth) but it should make lag less noticeable.
It applies on top of the previous patch.
Git commit fadd748ee43a830e1e15e577330b8d21e30c9a3f by Geoffry Song.
Committed on 16/03/2011 at 04:43.
Pushed by geoffrysong into branch 'master'.
Smooth freehand tool with cardinal splines
This creates smoother curves when drawing quickly (when there are few mouse
M +21 -12 krita/ui/tool/kis_tool_freehand.cc
M +1 -0 krita/ui/tool/kis_tool_freehand.h
*** Bug 273861 has been marked as a duplicate of this bug. ***
I committed a revert of a56c0ab64ca1290b034e863439319d38daddefab ("Let dirty rect to be a QRegion instead of a QRect") which once again makes the lines buttery smooth for me.
Created attachment 61714 [details]
Image showing line smoothing improvements and remaining issue
At the moment I'd say this looks about 75% better. I checked in mypaint and that have some of this issue as well, although not quite as pronounced as it was in Krita when I filed this bug. Now I'd say we look slightly better. :)
I'm still having circular curves be "flattened" often, but this may well be another issue. I've attached an image that oth shows where things look better, and the issue I'm still having.
On a side note, text shapes are acting very weird for me. As you'll see in the image, they're outputting an image like they're selected *even to the exported image*. No this image is not a screen capture. Anyway, that's *definitely* another issue, but I'm just mentioning it here, in case this image makes you wonder.
I also get that (using a mouse btw), but only when OpenGL is enabled - with it disabled, everything is nice and smooth.
Geoffry -- the two patches attached have been committed, right?
Yes, they have.
Comment on attachment 58072 [details]
Patch to change smoothing
Comment on attachment 58265 [details]
Great, then I'll mark the patches as obsolete so ths doesn't show up when searching for bug reports with patches.
With the new strokes framework, all lines come out smooth and nice for me, even if Krita cannot keep up with my input.