GNOME Bugzilla – Bug 69773
drawing slim lines with a 1x1 brush has issues
Last modified: 2009-08-15 18:40:50 UTC
I hope to describe the IMHO wrong way GIMP draws lines with a brush. It's not obvious, so I have mockups too. take a default 1x1 picel brush, default spacing set to 25. Draw a straight diagonal line with the pencil tool. Notice the stairs. On each pixel row, there's one extra pixel that makes the line appear thicker. With anti-aliased lines, the result is not so obvious, but you can see the final diagonal lines appear thicker than perfect horizontals or verticals. Please look at the following image to see what I am talking about. http://jimmac.musichall.cz/stuff/brushes.png I have experimented with the spacing value to get rid of the artefact. With the pencil tool, it is possible to get quite good results with setting of 80. However each angle requires a different setting for the line to be perfect. See http://jimmac.musichall.cz/stuff/perfect-brush.png The problem with higher settings is that although they work fine for, say, 60 degrees or so, there are gaps introduced for 0 or 90 degrees. Antialiased lines are even worse in this respect. I have fired up Photoshop to see how things are done there. Photoshop (5.5 trial I tried) was making perfect thin lines with a default 1x1 brush. The important thing is that setting the spacing value to a lower value did not make the lines thicker as it does in GIMP. I consider making thin lines important. One can draw thinner lines either by setting the opacity of the brush to lower value and drawing the same line over and over or by doing it pixel by pixel. Having an alternative way of rendering lines would be of a great help though. Can I beg and cry in a bug report? ;) It'll make me make better icons dudes =)
Created attachment 9122 [details] [review] Proposed fix relative to 1.3.x cvs tree
I like the effect of this patch but I think I've also found a problem. The rounding introduces artefacts for certain spacing values. Try the Paintbrush with the Circle Fuzzy 3x3 brush and set the spacing to 39 pixels. Now draw a straight line. You'll notice that the rounding introduces gaps in the drawn line at regular intervals.
Created attachment 9172 [details] [review] I see the problem. What about this version (which reverts to the usual algorithm for larger brush spacings), then?
Looks good. I've slightly reformatted your change so it conforms to the GIMP coding style and committed it to the HEAD branch. Very nice work! I don't think we want to backport this change to 1.2 so we should probably close the bug-report as FIXED ?!
It would be nice to backport it to 1.2.x, though. It will be a while before 1.4 is ready and many artists working on icons and other small images would probably appreciate having this bug fixed in 1.2 because this is the version that they will use until 1.4 is out. Although the data structures are different, the structure of the code in 1.2 and 1.3 is still similar. Backporting the patch should not be too hard. Do you want me to give it a try?
Created attachment 9382 [details] [review] FWIW, here's a backport to 1.2.4-pre1
For the record, is this bug CLOSEDable? Dave.
The bug has been fixed in the head branch, but apparently a consensus was never reached about whether it ought to be backported to 1.2. There's a backported patch sitting in Bugzilla but it has not been applied to the gimp-1-2 branch of cvs.
I still think we should not apply it and close the report as FIXED. But I could be persuaded to accept it although I don't believe in 1.2.5.
Of course you don't believe in it, it doesn't exist :) Personally I think there will be a 1.2.5 before we get pre-releases for the current 1.3 series going. I'd definitely like to see a stable release around the end of June or start of July if we get bug fixes in the branch. In any case, I think this change is clean enough to go in stable, and would be in favour of having it merged early (like, now) rather than later. Setting a 1.2.5 target milestone, I will merge the fix and close the bug as FIXED. Cheers, Dave.
Would someone else mind merging this? It doesn't look like I will get any computer time to do so before we will be shipping 1.2.5 Cheers, Dave.
The patch against 1.2.4-pre1 worked without problems with 1.2.4. The thin lines look much better now. Closing this bug. 2003-05-23 Raphael Quinet <quinet@gamers.org> * app/paint_core.[ch]: applied a patch (backported from HEAD) from Henning Makholm <henning@makholm.net> that vastly improves the drawing of thin lines. Fixes bug #69773.
The fix is part of the stable release 1.2.5. Closing this bug.