Is there a way to blend pixels directly to Raster in a BufferedImage with custom blending using own pixel loops instead of cloning the source pixels with getDataElements? I tried inheriting from Composite and CompositeContext but the permanent memory leak causes crashes when the memory runs out. I need custom blending for light effects so AlphaComposite is not enough for my project. In the worst case, I just make my own image type using arrays as I usually do in C.
Blend pixel data without leaking memory
It seems like Java is leaking because it creates an intermediate image for interpolation so when I first draw to an image that I recycle myself using AlphaComposite.Src and drawRenderedImage, I can then use my custom composite in a 1:1 scale ratio without leaking memory. The wasted time is acceptable because the operation is only performed when the level is loaded.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement