jcckit.renderer
Class Transformation

java.lang.Object
  extended by jcckit.renderer.Transformation

public class Transformation
extends Object

Transformation between device-independent coordinates and standard Java coordinates. The aspect-ratio will be the same. The position in the canvas is determined by a Rectangle defining a (virtual) paper which is placed in the canvas according to an anchor point. Depending on the aspect ratio of the canvas the paper width or height occupies the canvas width or height.

Author:
Franz-Josef Elmer

Constructor Summary
Transformation(int width, int height, ClippingRectangle paper, Anchor horizontalAnchor, Anchor verticalAnchor)
          Creates an instance for the specified canvas size, paper size, and anchor points of the paper.
 
Method Summary
 void apply(Graphics2D g)
           
 String toString()
           
 GraphPoint transformBack(int x, int y)
          Transforms a point in Java coordinates back into device-independent coordinates.
 int transformHeight(double height)
          Transforms the device-independent height into Java height.
 int transformWidth(double width)
          Transforms the device-independent width into Java width.
 int transformX(double x)
          Transforms the device-independent x coordinate into Java coordinates.
 int transformY(double y)
          Transforms the device-independent y coordinate into Java coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Transformation

public Transformation(int width,
                      int height,
                      ClippingRectangle paper,
                      Anchor horizontalAnchor,
                      Anchor verticalAnchor)
Creates an instance for the specified canvas size, paper size, and anchor points of the paper.

Parameters:
width - Width of the canvas.
height - Height of the canvas.
paper - Rectangle defining the paper in device-independent coordinates.
horizontalAnchor - Horizontal anchor of the paper in the canvas.
verticalAnchor - Vertical anchor of the paper in the canvas.
Method Detail

toString

public String toString()
Overrides:
toString in class Object

transformX

public int transformX(double x)
Transforms the device-independent x coordinate into Java coordinates.


transformY

public int transformY(double y)
Transforms the device-independent y coordinate into Java coordinates.


transformWidth

public int transformWidth(double width)
Transforms the device-independent width into Java width.


transformHeight

public int transformHeight(double height)
Transforms the device-independent height into Java height.


transformBack

public GraphPoint transformBack(int x,
                                int y)
Transforms a point in Java coordinates back into device-independent coordinates.


apply

public void apply(Graphics2D g)


Copyright © 2013. All Rights Reserved.