Combining multiple images into a single image for subsequent painting with alpha blending

I have a graphical system for Java that allows objects to "adore" by specifying several images that can have (relatively) complex alignment and resizing options.

To perform adequately (especially on devices with very low power), I draw the image in the internal image when the wallpaper is first drawn, and then copy this composite image into the target graphic context to get it on the screen. The composite is then recreated only if the object is modified, so the only job for subsequent reviews is to copy the cropped area from the composite to the target graphic context.

The solution works very well, except that when I have PNG images with alpha channel transparency, the alpha channel is lost when drawing the composite, that is, the composite has all the pixels that are completely opaque. Thus, the subsequent copy to the on-screen graphic context does not allow resolving what is behind the wallpaper object.

I managed to use RGBImageFilter to filter out fully transparent pixels, but I don't see a solution with this to provide transparency transparency.

Does anyone know how I can draw images with a constant alpha channel and combine if two pixels with alpha values ​​overlap?

+3
source share
1 answer

?

BufferedImage TYPE_INT_ARGB, .

+3

Source: https://habr.com/ru/post/1714251/


All Articles