Affine Transformation prob in JAVA 2D

java , xml Sri Lanka
  • 13 years ago

    Hi All !!

       In my programme, I'm drawing on a Jpanel acording to XML base cordinate sturucture. Since, java starting (0,0) point from the left top corner, I used the "translate" and "scale" to reverse the cordinate system, so that, its showing cordinate system as it started from bottom left corner of the panel. Follwing is the code I used.

      g2.translate(5,d.height-50);
      g2.scale(1.0,-1.0);

      ==> "d" is keeping the Dimension of the panel.

      My problem is, I'm drawing Line Id's (a text) with the line after applying this transformation, so that, text also displaying upside down. So I wnat to apply that tranformation only for the lines I drawing, nt for the text parts. I tried, sevaral ways to do this, non of it worked.

     So if anyone knows, how to do this, pls let me know !! 

     

     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” - Martin Fowler