[2633] in java-interest

home help back first fref pref prev next nref lref last post

Q: awt.Graphics translate() and scale() methods

daemon@ATHENA.MIT.EDU (Leslie Picardo)
Sat Oct 7 15:18:59 1995

Date: Sat, 7 Oct 1995 13:04:33 -0400
From: Leslie Picardo <picardo@alpha.CES.CWRU.Edu>
To: java-interest@java.sun.com
Reply-to: picardo@alpha.CES.CWRU.Edu


 Re: preBeta JDK using appletviewer

 Q: I'm creating an applet in which I'd like to use a normal
    cartesian coordinate system to do my graphics drawing instead
    of the default window coordinate system. The awt.Graphics.translate()
    method works fine and allows me to reposition the origin but the 
    awt.Graphics.scale() function only seems to work for positive
    values. I want to flip the coordinate system so that the y-axis is
    positive upwards. How do I do that ?
 

    eg: 
     . . .
     public paint(Graphics g){
       // put origin at center of applet
       g.translate( size().width/2, size().height/2 );
       // try to flip the coordinate system so that y-axis is +ve up
       g.scale((float) 1, (float) -1); 
       // ...................^^^^^^^ 
       //This screws up subsequent graphics operations
     }
 
  If I use positive values for the scale(sx, sy) method it works fine
  but my coordinate system is upside down which I don't like. 

  
Leslie Picardo
picardo@alpha.ces.cwru.edu


-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post