0

Using the Canvas, what is the fastest way of rendering an image which has transformations on it:

  1. Using the AffineTransorm to restore the graphics object to its original state after rendering an object or...
  2. Creating a new BufferedImage, drawing the contents and transformations onto that, then drawing that to the screen.

I can't really give much more information, I'm just thinking about what would be best for a game I'm creating. Also if there's an even faster way, any other suggestions would be much appreciated.

Shaun Wild
  • 1,237
  • 3
  • 17
  • 34
  • 1
    #2. KISS. It also implicitly supports "double buffering". Hooray. (Only, don't actually create a *new* buffer to render to, but reuse an output buffer.) –  Feb 17 '13 at 05:50
  • Put it as an answer so I can accept it, thank you for your input. – Shaun Wild Feb 17 '13 at 05:52
  • If the view does not change, clearly use a `BufferedImage`. Also consider displaying the image in a label. (Of course, an image can also be animated, we just need to repaint the label to see the result.) – Andrew Thompson Feb 17 '13 at 08:11
  • *"use a `BufferedImage`. ..in a label. ..animated.."* E.G. [1](http://stackoverflow.com/questions/10628492/dynamic-graphics-object-painting-in-java/10628553#10628553), [2](http://stackoverflow.com/questions/7314672/java-bitmap-font-blitting-1-bit-image-with-different-colors/7344204#7344204) & [3](http://stackoverflow.com/questions/10055005/how-to-draw-an-image-over-an-another-image/10055306#10055306).. – Andrew Thompson Feb 17 '13 at 08:18

0 Answers0