Java examples for 2D Graphics:BufferedImage Create
Creates a BufferedImage by scaling the alpha channel of a provided image.
import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; import java.awt.Image; import java.awt.RenderingHints; import java.awt.Transparency; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import java.awt.image.BufferedImageOp; import java.awt.image.ColorModel; import java.awt.image.PixelGrabber; import javax.swing.Icon; import javax.swing.ImageIcon; public class Main{ /**//from w w w . j a va2 s . c o m * Creates a BufferedImage by scaling the alpha channel of a provided image. * * @param srcImage * @param alphaScale * @return */ public static BufferedImage scaleAlpha(BufferedImage srcImage, double alphaScale) { ScaleAlphaImageOpARGB scaleOp = new ScaleAlphaImageOpARGB( alphaScale); BufferedImage destImage = scaleOp.createCompatibleDestImage( srcImage, srcImage.getColorModel()); scaleOp.filter(srcImage, destImage); return destImage; } }