draw game assets from buffer vs. directly drawImage

hello folks,

now obviously I am sorry if this topic was covered in lengths already, but my search did not yield results on this topic.

I read in a discussion that after accessing a bufferedImage’s pixel raster, java irreversibly treats it in a different manner, slowing down any operation as it is supposedly checking for its consistency (or something like that, i read this a while ago(sorry! :persecutioncomplex:)).

now if this happens to be true, would you say that there is any considerable advantage in not rendering game assets from sprite sheets but directly from their respective files by e.g. splitting spritesheets in single image files?

thanks for your time!

I’m sorry to say this, but you will probably have to do some tests yourself. There aren’t many people on this forum who bother making efficient games with java2d.

thanks for the quick reply!
I must admit I was afraid I might run into a common sense issue if i used drawImage for static assets.
so I guess i will not bother checking on performance :smiley:

From what I’ve done, there is no difference between rendering a entire spritesheet or separate images. Java optimizes the speed based on how much times the screen is updated. The more changes and draw calls, the slower it becomes. Since you can obtain a single sprite in the same amount of draw calls as a spritesheet, the performance enhancement is negligible.