W
Wolfgang
Assume I have an image 'img'.
Rreading the image from a file, I made sure I really have the entire
image available by using a MediaTracker.
Now I want to print the image into a BufferedImage using drawImage on
the graphics object of the BufferedImage. The question: is this use
of drawImage a asynchronous operation?
So here is what I want to do:
bufImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics2d. = bufImage.createGraphics();
// get and image named 'img' here;
// getting the image is asynchronous
// so use a MediaTracker to make sure it has arrived.
// Now that I am sure I have the complete image 'img', I draw it
graphics2d.drawImage(img, 0, 0, w, h, null);
System.out.println("Question: Am I guranteed at this point to have");
System.out.println(" 'img' completely in the buffered image?");
System.out.println(" Or did drawImage go off on a thread while I");
System.out.println(" continue parallel execution?");
If graphics2d.drawImage(image, 0, 0, w, h, null) is asynchronous, is
there a way to wait for it to complete (like a MediaTracker for
loading an image from disk)?
Thanks,
Wolfgang
Santa Barbara, CA
Rreading the image from a file, I made sure I really have the entire
image available by using a MediaTracker.
Now I want to print the image into a BufferedImage using drawImage on
the graphics object of the BufferedImage. The question: is this use
of drawImage a asynchronous operation?
So here is what I want to do:
bufImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics2d. = bufImage.createGraphics();
// get and image named 'img' here;
// getting the image is asynchronous
// so use a MediaTracker to make sure it has arrived.
// Now that I am sure I have the complete image 'img', I draw it
graphics2d.drawImage(img, 0, 0, w, h, null);
System.out.println("Question: Am I guranteed at this point to have");
System.out.println(" 'img' completely in the buffered image?");
System.out.println(" Or did drawImage go off on a thread while I");
System.out.println(" continue parallel execution?");
If graphics2d.drawImage(image, 0, 0, w, h, null) is asynchronous, is
there a way to wait for it to complete (like a MediaTracker for
loading an image from disk)?
Thanks,
Wolfgang
Santa Barbara, CA