I have BufferedImages in my game that I create with the Transparency constant of Transparency.TRANSLUCENT and I want to clear them sometimes. For example, in my menu, I hold on to the image so that I don’t have to recreate it every frame because it rarely changes. However when it does change and I nullify it and turn it into a new BufferedImage, there’s an obvious hiccup and it’s really quite unnatractive in cases where I have to recreate the image frequently. I can’t do away with caching it because it gives me over 60fps where before I was lucky to get 30-40.
So my question is: is there a way I can clear my BufferedImage to be as if I had drawn nothing on it? Turning it into a new BufferedImage takes way too long, and it seems silly that I should have to recreate the Object at all. What is the best way I should go about clearing my BufferedImage? Thanks!