Grzegorz Borowiak <[EMAIL PROTECTED]> writes:

> Thank You guys. It seems drawing a good thin non-antialiased line is so
> foar not implemented, I hope it will be. I could do it, but it would take
> a long time for me to understand code and the whole conception of GIMP. 

right now pencil and paintbrush are exactly the same tool with the 
slight difference that the paintbrush calls gimp_paint_tool_paste_canvas()
with BrushApplicationMode == SOFT (or PRESSURE for pressure-sensitive 
painting) while the pencil uses HARD here. This leads to different ways
how the brush_mask is prepared. For SOFT mode the brush mask is subsampled
to the brush position using a 5x5 subsampling kernel while HARD mode
solidifies the brush by setting all pixels to full opacity that are 
non-NULL in the brush pixmap. 

The relevant code for painting can be found in app/tools/gimppainttool.c.

> There could be problem if brush size is big and line has to be
> half-transparent. E.g. brush radius is 10 and intensity is 0.5. There
> would be 1-pixel-close overlapping brush hits, whose intensities would
> accumulate. But this problem can easily be compensated if we use more
> sophiscated tool_t function, which would reasonably decrease its intensity
> (simply dividing nominal intensity by radius size and then by sine/cosine
> value of line angle) for all pixels except two ends, and these two ends
> would be painted with full nominal intensity, but only half of brush would
> be painted (this half which does not overlap with any mid-line brush hit).

I don't think this would work well. Instead I'd suggest to draw the
brush totally opaque to intermediate tiles, then blend these with the
choosen brush opacity onto the drawable. Might be more memory-intensive
but should give perfect results. On the other hand it would diverge a 
lot from what happens if you draw a line by hand. Would it make sense
to consider a line-drawing tool? I think it would be especially useful
to stroke selections and paths. Our current approaches to stamp the
brush at equidistant positions along the outline does not give pleasant
results and all attempts to improve this will most probably only mess up
the (already weird) code. 

Such a line-drawing tool wouldn't work with brushes but would have 
configurable line-width and cap settings. I might be wrong, but I think 
the ink tool might be suited reasonably good for proper line drawing. 
If it would have support for drawing straight lines using the Shift 
key, we could test it and this should be easy to implement.

Salut, Sven
Gimp-developer mailing list

Reply via email to