@Override public BufferedImage doTransform(BufferedImage src, BufferedImage dest) { if (filter == null) { filter = new UnsharpFilter(NAME); } filter.setAmount(amount.getValueAsPercentage()); filter.setThreshold(threshold.getValue()); filter.setRadius(radius.getValueAsFloat()); dest = filter.filter(src, dest); return dest; } }
int height = src.getHeight(); pt = createProgressTracker(width + height); dst = createCompatibleDestImage(src, null); int[] outPixels = new int[width * height]; getRGB(src, 0, 0, width, height, inPixels); convolveAndTranspose(kernel, inPixels, outPixels, width, height, alpha, alpha && premultiplyAlpha, false, CLAMP_EDGES, pt); convolveAndTranspose(kernel, outPixels, inPixels, height, width, alpha, false, alpha && premultiplyAlpha, CLAMP_EDGES, pt); getRGB(src, 0, 0, width, height, outPixels); finishProgressTracker();
dst = createCompatibleDestImage( src, null ); convolveAndTranspose(kernel, inPixels, outPixels, width, height, alpha, alpha && premultiplyAlpha, false, CLAMP_EDGES); convolveAndTranspose(kernel, outPixels, inPixels, height, width, alpha, false, alpha && premultiplyAlpha, CLAMP_EDGES);
public final BufferedImage filter(BufferedImage src, BufferedImage dest){ Dimension dstDimension = dimensionConstrain.getDimension(new Dimension(src.getWidth(),src.getHeight())); int dstWidth = dstDimension.width; int dstHeight = dstDimension.height; BufferedImage bufferedImage = doFilter(src, dest, dstWidth, dstHeight); if (unsharpenMask!= UnsharpenMask.None){ UnsharpFilter unsharpFilter= new UnsharpFilter(); unsharpFilter.setRadius(2f); unsharpFilter.setAmount(unsharpenMask.factor); unsharpFilter.setThreshold(10); return unsharpFilter.filter(bufferedImage, null); } return bufferedImage; }