hi,
- How to clone a BufferedImage object? I want to copy a BufferedImage
object and then draw on the new object without modifying the original
BufferedImage object. I've tried the following code:

public class CloneableBufferedImage extends BufferedImage
        implements Cloneable
{
        public CloneableBufferedImage(int width, int height,      
                                 int imageType) {
    super(width, height, imageType);
        }

        protected Object clone(){
                try {
                        return super.clone();
                } catch (CloneNotSupportedException e) {
                        // this should not happen
                        throw new InternalError();
                }
        }
}

- when I call the code:

CloneableBufferedImage newCBI = (CloneableBufferedImage) oldCBI.clone();
Graphics2D offg2 = newCBI.createGraphics();
offg2.drawString(.....);

- all the drawings will be drawn on the image 'oldCBI' as well, which is
I don't want exactly!     

Thanks alot in advance!

Eric Li

-- 
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/

Reply via email to