I''ve got a little problem... let''s see if someone out there might have a nice solution or may enlighten me a little bit.
I create an image (fieldImg) and then get a graphic buffer to it (fieldBuffer). I then draw on the buffer (fieldBuffer) and finally draw the whole whole image (fieldImg) on the real backbuffer which is then drawn to screen in paint().
fieldImg = createImage(WIDTH, HEIGHT);
fieldBuffer = fieldImg.getGraphics();
fieldBuffer.drawString("test", 120, 30);
bufferg.drawImage(fieldImg, 0, 0, this);
This work. However, what I''m trying to do but fail is to, in various places, change the whole fieldImg from a MemoryImageSource, but then continue as usual with drawing the string and then putting it on the bufferg.
fieldImg = createImage(new MemoryImageSource(WIDTH, HEIGHT, fieldimage, 0, WIDTH));
fieldBuffer = fieldImg.getGraphics();
fieldBuffer.drawString("test", 120, 30);
bufferg.drawImage(fieldImg, 0, 0, this);
However, after the createImage(new MemoryImageSource()) fieldBuffer seems completely dead. Nothing happens when using fieldBuffer.drawString and when using bufferg.drawImage it''s exactly the MemoryImageSource that gets drawn but the drawString doesn''t affect at all.
So... How may I get the MemoryImageSource into an Image, but still draw to that Image afterwards?