Java Code Examples for java.awt.RenderingHints.KEY_RENDERING

The following are Jave code examples for showing how to use KEY_RENDERING of the java.awt.RenderingHints class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: trashjam2017   File: ShadowEffect.java   Source Code and License Vote up 5 votes
/**
 * Apply blurring to the generate image
 * 
 * @param image The image to be blurred
 */
private void blur(BufferedImage image) {
	float[] matrix = GAUSSIAN_BLUR_KERNELS[blurKernelSize - 1];
	Kernel gaussianBlur1 = new Kernel(matrix.length, 1, matrix);
	Kernel gaussianBlur2 = new Kernel(1, matrix.length, matrix);
	RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
	ConvolveOp gaussianOp1 = new ConvolveOp(gaussianBlur1, ConvolveOp.EDGE_NO_OP, hints);
	ConvolveOp gaussianOp2 = new ConvolveOp(gaussianBlur2, ConvolveOp.EDGE_NO_OP, hints);
	BufferedImage scratchImage = EffectUtil.getScratchImage();
	for (int i = 0; i < blurPasses; i++) {
		gaussianOp1.filter(image, scratchImage);
		gaussianOp2.filter(scratchImage, image);
	}
}
 
Example 2
Project: Progetto-C   File: ShadowEffect.java   Source Code and License Vote up 5 votes
/**
 * Apply blurring to the generate image
 * 
 * @param image The image to be blurred
 */
private void blur(BufferedImage image) {
	float[] matrix = GAUSSIAN_BLUR_KERNELS[blurKernelSize - 1];
	Kernel gaussianBlur1 = new Kernel(matrix.length, 1, matrix);
	Kernel gaussianBlur2 = new Kernel(1, matrix.length, matrix);
	RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
	ConvolveOp gaussianOp1 = new ConvolveOp(gaussianBlur1, ConvolveOp.EDGE_NO_OP, hints);
	ConvolveOp gaussianOp2 = new ConvolveOp(gaussianBlur2, ConvolveOp.EDGE_NO_OP, hints);
	BufferedImage scratchImage = EffectUtil.getScratchImage();
	for (int i = 0; i < blurPasses; i++) {
		gaussianOp1.filter(image, scratchImage);
		gaussianOp2.filter(scratchImage, image);
	}
}
 
Example 3
Project: BaseClient   File: ShadowEffect.java   Source Code and License Vote up 5 votes
/**
 * Apply blurring to the generate image
 * 
 * @param image The image to be blurred
 */
private void blur(BufferedImage image) {
	float[] matrix = GAUSSIAN_BLUR_KERNELS[blurKernelSize - 1];
	Kernel gaussianBlur1 = new Kernel(matrix.length, 1, matrix);
	Kernel gaussianBlur2 = new Kernel(1, matrix.length, matrix);
	RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
	ConvolveOp gaussianOp1 = new ConvolveOp(gaussianBlur1, ConvolveOp.EDGE_NO_OP, hints);
	ConvolveOp gaussianOp2 = new ConvolveOp(gaussianBlur2, ConvolveOp.EDGE_NO_OP, hints);
	BufferedImage scratchImage = EffectUtil.getScratchImage();
	for (int i = 0; i < blurPasses; i++) {
		gaussianOp1.filter(image, scratchImage);
		gaussianOp2.filter(scratchImage, image);
	}
}