title: Alpha Channel Blur
body: <p>I've got this BufferedImage object that's guaranteed to contain only one color. I'm using it to display a sample image to show size, shape &amp; hardness of a brush in a painting tool. I've tried several different blur implementations for hardness... the latest, that seems to work fairly well is this <a href="http://www.java2s.com/Open-Source/Java-Document/Swing-Library/swingx/org/jdesktop/swingx/image/StackBlurFilter.java.htm" rel="nofollow">Stack Filter</a> written by Romain Guy. </p>
  
  <p>I've got 2 problems. </p>
  
  <ol>
  <li><p><strong>Faster on 1 channel than 4?:</strong> None of the blur filters I've tried seem to be quite fast enough... I realize this question has been asked before (and I'm not quite ready to try pulling in <a href="http://fftw.org" rel="nofollow">FFTW</a> from C), but I'm wondering if there's a way to perform the blur using ONLY the alpha channel bits? The image only contains one color, so none of the other bits will change across points anyway and my thought is that this would cut the number of calculations for the blur to about 25% of the whole blur operation and I figure that's likely to result in a noticeable improvement in performance? I've not been able to find any information about this being tried via web search. </p></li>
  <li><p><strong>Eliminating the Dark Halo:</strong> Every time I try a different blur algorithm I end up having to rewrite it to get rid of the dark shadow around the shape caused by blurring in "black" from colorless pixels where nothing has been painted in yet. I've read about this and I'm using (as far as I know) INT_ARGB_PRE image types, which I remember reading as a solution to this problem. Am I missing something in that solution? Do I need to preformat the image in some way to make it interpret all the empty pixels as white instead of black? </p></li>
  </ol>
  
  <p>Thanks!</p>