Refactoring is going well, and so are the performance improvements. Right now I managed to get the memory usage constant, by reusing resources. I’ve also made this easy to do. For example:
if ( resultImage == null )
{
resultImage = font.render(text);
}
else
{
font.render(text,resultImage);
}
This is great for animations, since you can reuse the same destination object and thus avoid memory issues. This helps A LOT when it comes to keeping the FPS constant and the resource consumption low.
I’m 70% ready with the refactoring&performance updates, a new demo should be out in a couple of days.
Major updates so far:
*Everything is now not based around native Image objects, but around custom AbstractImages. This should make things faster and more flexible in the future.
* AbstractImages are a lot like images, in that you can draw then on other AbstractImages or on native Graphics objects. This is also very easy to do:
AbstractImage.drawOnGraphics( Graphics g, int x, int y, int anchor, boolean keepTransparency);
AbstractImage.drawOnAbstractImage (AbstractImage dest, int x, int y, int anchor);
The anchor even supports stuff like Graphics.HCENTER | Graphics.VCENTER !
* There’s a new object type called SmartImage (it implements the AbstractImage interface) that allows (among other things) you instantaneous READ-WRITE access to the underlying ARGB data. How’s that for opening up possibilities?
* You can now keep memory usage fairly constant by re-using images.
* Renamed a couple of methods, added a couple of methods.
* Oh, I’ve also added a new effect.
Thanks (and stay tuned),
Ovidiu