Just to be clear, you are calling "g.drawImage(img, width, height, null)" in the pseudo-code below which draws "img" at the location w,h - don't you want to draw it at (0,0) as in:

        g.drawImage(img, 0, 0, null);

or was that a typo in the pseudo-code?

                        ...jim

[EMAIL PROTECTED] wrote:
Hi,

I am currently rebuilding quite an old graphics library from software rendered 
Images to hardware accelerated VolatileImages. I am nearly done with this task, 
but now I have encountered an old functionality that requies the backup of the 
Image-content in order to do a scrolling of the zoomed selection over the 
original scaled graphic.

In the old version it was quite easy to do. They just made a new Image object, 
and assigned the to be saved image to it:

Image copy = new Image(width, height);
copy = originalImage;
stack.push(copy);

After the assignment, they put the copy on an Object stack, where (inscrolling 
mode) they can recall this image.

How can I achive tha same functionality when originalImage is of the type 
VolatileImage? I am pretty sure, that I can't put a volatile image in our 
stack, as the contents could be lost on th stack without beeing recognized. So 
my approach was to draw the contents of the volatile image onto an Image-typed 
object:

Image copy;
copy.getGraphics.drawImage(originalImage, originalImage.getWidth(), 
originalImage.getHeight(), null);
stack.push(copy);

In the case of recalling the backup, I do the same things the other way around:

originalImage = 
this.getGraphicsConfiguration.createCompatibleVolatileImage(copy.getWidth(), 
copy.getHeight());
originalImage.getGraphics.drawImage(copy, copy.getWidth(), copy.getHeight(), 
null);

Unfortunatly, it does not work as I expected because originalImage does contain 
after these lines above still the same content as if I never called these lines 
and not the content I saved earlier in the copy image.

Question: Is this approach appropriate for that what I intend to do?

Thanks,
Maik
[Message sent by forum member 'kiamur' (kiamur)]

http://forums.java.net/jive/thread.jspa?messageID=293223

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to