Improve brush subsampling
Submitted by david gowers
The current subsampling has noticeable quality problems at small sizes and with fully hard-edged brushes -- that is, the antialiasing already around the edges of nominally hard-edged brushes disguises the lack of subsampling quality. GIMP provides less quality than it could, and I think this could be remedied with adaptive behaviour -- depending on the brush size, subsample more or less. Lets say the maximum is 16x16 -- I've tested various SUBSAMPLE values and THRESHOLD values (see kernelgen) and I think normally you would need no more than this, even for completely hard-edged brushes. Then you could subdivide that, like: A really huge brush gets at most only 4x4 subsampled versions A medium sized brush gets 8x8 subsampled versions A really tiny brush gets all 16x16 subsampled versions.
That's a fairly simple improvement. Another possible might be interpolating between two subsampled brushes during painting -- this would easily double the subsampling quality even if only done as a fast ((A+B) >> 1) 50% mix calculation.
Anyway, before any such improvements can be made,
there is a bug in either tools/kernelgen.c or the subsampled-version-generator in app/paint/gimpbrushcore.c;
It causes 1 of the subsampled versions to be wrong, to have all fully opaque pixels become fully transparent, if SUBSAMPLE
<> 4. It seems independent of THRESHOLD value (I've tried several in combination with different SUBSAMPLE values: 0.125, 0.25, 0.33, 0.50; In my opinion, when SUBSAMPLE > 4, 0.33 is the best threshold, that produces a result both crisp and smooth.)
An image showing the bug is attached. Another image, comparing different subsampling settings used with big and tiny (1px) brushes, is attached too. I concluded SUBSAMPLE = 16, THRESHOLD = 0.33 produces the nicest results, though even SUBSAMPLE = 8 produces a significant improvement in clarity over SUBSAMPLE = 4. I haven't tried SUBSAMPLE = 12; It might be worth trying, later.
Version: git master