I am having a problem when I try to draw graphics after using 
AffineTransform for the first time.


The following code works

 Image actualImage=Toolkit.getDefaultToolkit().getImage
             ("C:/Development/Images/apple.gif");
MediaTracker temp = new MediaTracker(MMWorkspace.eraseMeLater);
temp.addImage(actualImage, 0);  //id for image is 0; in our case it is 
irrelevant
 try {
    temp.waitForAll();  //allow image to finish loading
  } catch(InterruptedException ie) {
      System.out.println(ie.getMessage());
   }
     
   AffineTransform transform = new AffineTransform();
   AffineTransform graphicsDefaultTransform = g.getTransform();

   transform.translate(10,10);
   g.setTransform(graphicsDefaultTransform); 
   g.transform(transform);
   Shape newClip =                 
     transform.createTransformedShape(rect); 
   g.clip(newClip);
   g.drawImage(actualImage, newClip.getBounds().x, newClip.getBounds().y, 
null);
          
   g.setTransform(graphicsDefaultTransform);


However, whenever I create another object and call this code for the second 
time -  It will create the object, but will not draw the graphics.

Note, whenever I take out all the AffineTranform stuff and just draw a 
rectangle or something it seems to work fine.

Does anyone know why this code snipet works fine the first time, but the 
second time an object is created, things seem to fall apart (i.e., graphics 
don't appear on the screen)?

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

Reply via email to