compositing

Set BufferedImage alpha mask in Java

自古美人都是妖i 提交于 2019-11-27 00:47:04
I have two BufferedImages I loaded in from pngs. The first contains an image, the second an alpha mask for the image. I want to create a combined image from the two, by applying the alpha mask. My google-fu fails me. I know how to load/save the images, I just need the bit where I go from two BufferedImages to one BufferedImage with the right alpha channel. Michael Myers Your solution could be improved by fetching the RGB data more than one pixel at a time(see http://java.sun.com/javase/6/docs/api/java/awt/image/BufferedImage.html ), and by not creating three Color objects on every iteration of

Set BufferedImage alpha mask in Java

喜夏-厌秋 提交于 2019-11-26 12:24:44
问题 I have two BufferedImages I loaded in from pngs. The first contains an image, the second an alpha mask for the image. I want to create a combined image from the two, by applying the alpha mask. My google-fu fails me. I know how to load/save the images, I just need the bit where I go from two BufferedImages to one BufferedImage with the right alpha channel. 回答1: Your solution could be improved by fetching the RGB data more than one pixel at a time(see http://java.sun.com/javase/6/docs/api/java