Jump to content
  • Advertisement
Sign in to follow this  
Dawoodoz

Blend pixel data without leaking memory

This topic is 513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!