java - Copying a snapshot of a Canvas to a BufferedImage -
I am currently using canvas with an affiliate buffer cart. How can I copy the contents of the canvas and save it to a buffard image? So far I have tried
BufferedImage image = ... g = image.createGraphics (); Canvas.printAll (g); // or color all
However, it appears that only 'blank' (filled with background color) screen is being prepared; I think because this is the default behavior of Canvas.paint ()
. There is currently a way for me to retrieve the image on the screen (the last shown with BufferStrategy.show (
), or do I want to draw on a bufffered image and image the buffer swap Need to copy in graphics. It seems that / could be a great slow; Why would this happen?
Why (because I know someone wants to ask): I have a set of classes set up as a framework for the creation of the game, which can benefit from the fastest screen, And I'm looking to create an Aden Framework, to tie one of these canvas into a remote server, sending it the picture displayed to other connected clients (on the lines of hosting a game remotely.)We are sure that there are better ways to do this in special cases (for example, why the server should display the game exactly?) But I have already done a lot of work and wondered if this method is based on the built-in game framework code (Mostly) can be modified without modifying.
Comments
Post a Comment