static BufferedImage gaussianBlur(BufferedImage src,BufferedImage dst,int radius){
  int width=src.getWidth();
  int height=src.getHeight();
  if (dst == null || dst.getWidth() != width || dst.getHeight() != height || src.getType() != dst.getType()) {
    dst=createColorModelCompatibleImage(src);
  }
  float[] kernel=createGaussianKernel(radius);
  if (src.getType() == BufferedImage.TYPE_INT_ARGB) {
    int[] srcPixels=new int[width * height];
    int[] dstPixels=new int[width * height];
    getPixels(src,0,0,width,height,srcPixels);
    blur(srcPixels,dstPixels,width,height,kernel,radius);
    blur(dstPixels,srcPixels,height,width,kernel,radius);
    setPixels(dst,0,0,width,height,srcPixels);
  }
 else   if (src.getType() == BufferedImage.TYPE_BYTE_GRAY) {
    byte[] srcPixels=new byte[width * height];
    byte[] dstPixels=new byte[width * height];
    getPixels(src,0,0,width,height,srcPixels);
    blur(srcPixels,dstPixels,width,height,kernel,radius);
    blur(dstPixels,srcPixels,height,width,kernel,radius);
    setPixels(dst,0,0,width,height,srcPixels);
  }
 else {
    throw new IllegalArgumentException("EffectUtils.gaussianBlur() src image is not a supported type, type=[" + src.getType() + "]");
  }
  return dst;
}

static BufferedImage gaussianBlur ( BufferedImage src , BufferedImage dst , int radius ) { int width = src . getWidth ( ) ; int height = src . getHeight ( ) ; if ( dst == null || dst . getWidth ( ) != width || dst . getHeight ( ) != height || src . getType ( ) != dst . getType ( ) ) { dst = createColorModelCompatibleImage ( src ) ; } float [ ] kernel = createGaussianKernel ( radius ) ; if ( src . getType ( ) == BufferedImage . TYPE_INT_ARGB ) { int [ ] srcPixels = new int [ width * height ] ; int [ ] dstPixels = new int [ width * height ] ; getPixels ( src , 0 , 0 , width , height , srcPixels ) ; blur ( srcPixels , dstPixels , width , height , kernel , radius ) ; blur ( dstPixels , srcPixels , height , width , kernel , radius ) ; setPixels ( dst , 0 , 0 , width , height , srcPixels ) ; } else if ( src . getType ( ) == BufferedImage . TYPE_BYTE_GRAY ) { byte [ ] srcPixels = new byte [ width * height ] ; byte [ ] dstPixels = new byte [ width * height ] ; getPixels ( src , 0 , 0 , width , height , srcPixels ) ; blur ( srcPixels , dstPixels , width , height , kernel , radius ) ; blur ( dstPixels , srcPixels , height , width , kernel , radius ) ; setPixels ( dst , 0 , 0 , width , height , srcPixels ) ; } else { throw new IllegalArgumentException ( "EffectUtils.gaussianBlur() src image is not a supported type, type=[" + src . getType ( ) + "]" ) ; } return dst ; }
apply gaussian blur to image
