All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jj.play.ns.nl.captcha.util.ImageUtil Maven / Gradle / Ivy

Go to download

SimpleCaptcha - an easy to implement CAPTCHA framework to generate image and audio challenges, for Java 1.5 and Java 6 (repackaged by Play! Framework)

The newest version!
package jj.play.ns.nl.captcha.util;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.awt.image.FilteredImageSource;
import java.awt.image.ImageFilter;

public class ImageUtil {
	public static final void applyFilter(BufferedImage img, ImageFilter filter) {
		FilteredImageSource src = new FilteredImageSource(img.getSource(), filter);
		Image fImg = Toolkit.getDefaultToolkit().createImage(src);
		Graphics2D g = img.createGraphics();
		g.drawImage(fImg, 0, 0, null, null);
		g.dispose();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy