Bug 148207

Summary: Pixel Pencil lines are messy
Product: [Applications] krita Reporter: Kai-Steffen Marks <kaisteffenmarks>
Component: Brush enginesAssignee: Adrian Page <adrian>
Status: RESOLVED FIXED    
Severity: normal CC: enkithan, halla, lambdae2
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Slackware   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: lines

Description Kai-Steffen Marks 2007-07-25 21:10:48 UTC
Version:           1.6.3 (using KDE KDE 3.5.7)
Installed from:    Slackware Packages

This problem gets clear when you do some very fine pixel work. I used the pixel pencil with 1 pixel in width and height and draw a straight, diagonal line. 
When you try this, you will see that there are some (or many) unnecessary pixels.
Since I'm not a native english speaker it is hard for me to explain it with words, so I will show you a picture instead.

http://www.maj.com/gallery/Kluf/compare/lines_comparison.png

That picture is very low in resolution of course. 
I compared a line drawn from Krita with one from Gimp. 
I drew the line in Gimp directly over the one I drew in Krita so that this is an exact comparison.
Additionally, I made the unnecessary pixels red from the line I made in Krita.

I think the problem is clear.

I filed this as a bug, because it's the first program I found which had this problem. I also don't think that this behaviour is volitional. That wouldn't make any sense to me.
Comment 1 Halla Rempt 2007-07-26 10:15:56 UTC
That doesn't look to nice indeed. I'll provisionally assign this bug to Adrian Page because he knows most about our line drawing code. Adrian -- if you think this doesn't belong on your plate, please bounce it back to me.
Comment 2 Adrian Page 2007-07-26 22:20:06 UTC
Yes, the line drawing with thin lines could do with some improvement. Will look into it.
Comment 3 Elián Hanisch 2008-10-30 01:11:36 UTC
tested with trunk, seems it still needs some improvement, the lines don't look 'right' while using 1 pixel pencil tool, they look bolder, with unneeded pixels i think, I 'll add a screenshot of one example
Comment 4 Elián Hanisch 2008-10-30 01:14:42 UTC
Created attachment 28228 [details]
lines

the line of the left I did it manually drawing each pixel with the 1px pencil brush, the one of the right with the straight line tool, even though I had the pencil brush set to 1px big, the line of the right looks 2px wide
Comment 5 Halla Rempt 2009-10-17 16:26:29 UTC
Adrian Page isn't really active anymore, so reassign to Lukas Tvrdy, our brush engine guru.
Comment 6 LukasT 2009-10-18 02:18:27 UTC
This problem is present in all paintops. The problem in KisPaintOp::paintLine. Precise algorithm needs to be implemented for the line.
Comment 7 Halla Rempt 2009-10-18 15:50:58 UTC
but for the other paintops it doesn't matter as much -- do you already have an idea about the algorithm needed?
Comment 8 LukasT 2009-10-18 16:53:07 UTC
E.g. setup the spray so that the diameter is 1, particle count is 1 and use aliased pixel. Draw line. You get the same behavior.

I need to find out what the other code is actually doing.
So far I notice we interpolate the pressure and tilt through the line and we compute the distance according the spacing. We need to do that properly and here I don't know what to do. If Bresenham's line algorithm would be solution.
Maybe GIMP could help here.
Comment 9 LukasT 2009-12-01 23:32:20 UTC
Adrian will be happy to look at it again.
Comment 10 Halla Rempt 2009-12-17 13:02:37 UTC
*** Bug 211708 has been marked as a duplicate of this bug. ***
Comment 11 Sven Langkamp 2010-07-14 10:06:24 UTC
SVN commit 1149758 by langkamp:

add special case to draw one pixel lines if the brush is 1x1 pixel, currently uses wu line which needs to be replace
CCBUG:148207


 M  +23 -0     kis_penop.cpp  
 M  +3 -0      kis_penop.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1149758
Comment 12 LukasT 2010-07-15 10:37:37 UTC
SVN commit 1150159 by lukast:

DDA line is now fixed. We can use it for line art with Pen brush.

The bug can be closed, but I would leave that for reportee if he is
available and happy ;)

CCBUG:148207

 M  +1 -1      kis_penop.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1150159