Is there a way to specify the paintbrush's hardness via the C API for a
non-generated brush? A plugin I'm developing creates quite a few brushes
from PNGs with alpha layers, and when I use gimp_paintbrush() to 'stamp' a
single instance of the brush on the canvas, any portions of the brush that
have an alpha value less than 255 (i.e. are even partially transparent)
are stamped with a lower alpha value than in the brush itself.
Completely opaque elements of the brush are unaffected. I'm using Gimp
2.4.2 on Ubuntu 7.10 (Gutsy Gibbon).
I can reproduce this in the UI by simply using the paintbrush tool and
clicking once on the canvas. If I check 'hardness' in the pressure
sensitivity portion of the paintbrush's tool options, I get the desired
behavior when painting manually (even though I'm using a normal mouse).
I haven't been able to find a way to reproduce this from a plugin.
Varying the paint application mode and/or the gradient length passed to
gimp_paintbrush() doesn't do the trick.
1. Is this a bug, or a feature?
2. If the latter, is there a way to avoid the fading via the C API?
I've written up a demo -- individual files may be found at
http://www.sellner.org/drop/brush-fader/, while the tarball is at
http://www.sellner.org/drop/brush-fader.tgz. It can be installed via
gimptool, and installs into "<Images>/Filters/Generic/Brush Fader". When
run, it takes the current image (which must be RGB) and generates a brush
from it. The plugin then creates a new (blank) image, draws with the new
brush, and creates a second brush from the result. This is repeated 4
times, creating a total of 6 progressively more transparent brushes.
Finally, an example image is created with one instance of each of the 6
brushes. Since the act of painting onto the example image induces fading,
the example image won't contain an unfaded copy of the brush image.
Running brush-fader against the two image files included in the tarball
illustrates the effects: brush-fader-circle is a single instance of a
standard fuzzy brush, and the outer 'fringe' slowly disappears.
brush-fader-mountains was created with a tablet, doesn't have any
completely opaque portions, and fades away entirely. The images that
result from running brush-fader on the two examples are
brush-fader-circle-results.xcf and brush-fader-mountains-results.xcf.
Gimp-developer mailing list