org.apache.fop.area
Class CTM
- Serializable
public class CTM
extends java.lang.Object
implements Serializable
Describe a PDF or PostScript style coordinate transformation matrix (CTM).
The matrix encodes translations, scaling and rotations of the coordinate
system used to render pages.
CTM()- Create the identity matrix
|
CTM(double x, double y)- Initialize a CTM to the identity matrix with a translation
specified by x and y
|
CTM(double a, double b, double c, double d, double e, double f)- Initialize a CTM from the passed arguments.
|
CTM(CTM ctm)- Initialize a CTM with the values of another CTM.
|
static CTM | getCTMandRelDims(int absRefOrient, int writingMode, Rectangle2D absVPrect, FODimension reldims)- Construct a coordinate transformation matrix (CTM).
|
static CTM | getWMctm(int wm, int ipd, int bpd)- Return a CTM which will transform coordinates for a particular writing-mode
into normalized first quandrant coordinates.
|
CTM | multiply(CTM premult)- Multiply new passed CTM with this one and generate a new result CTM.
|
CTM | rotate(double angle)- Rotate this CTM by "angle" radians and return a new result CTM.
|
CTM | scale(double x, double y)- Scale this CTM by the passed x and y values and return a new result CTM.
|
double[] | toArray()- Get an array containing the values of this transform.
|
String | toString()- Get string for this transform.
|
Rectangle2D | transform(Rectangle2D inRect)- Transform a rectangle by the CTM to produce a rectangle in the transformed
coordinate system.
|
CTM | translate(double x, double y)- Translate this CTM by the passed x and y values and return a new result CTM.
|
CTM
public CTM()
Create the identity matrix
CTM
public CTM(double x,
double y) Initialize a CTM to the identity matrix with a translation
specified by x and y
x - the x shifty - the y shift.
CTM
public CTM(double a,
double b,
double c,
double d,
double e,
double f) Initialize a CTM from the passed arguments.
a - the x scaleb - the x shearc - the y sheard - the y scalee - the x shiftf - the y shift
CTM
protected CTM(CTM ctm)
Initialize a CTM with the values of another CTM.
getCTMandRelDims
public static CTM getCTMandRelDims(int absRefOrient,
int writingMode,
Rectangle2D absVPrect,
FODimension reldims) Construct a coordinate transformation matrix (CTM).
absRefOrient - absolute reference orientationwritingMode - the writing modeabsVPrect - absolute viewpoint rectanglereldims - relative dimensions
- CTM the coordinate transformation matrix (CTM)
getWMctm
public static CTM getWMctm(int wm,
int ipd,
int bpd) Return a CTM which will transform coordinates for a particular writing-mode
into normalized first quandrant coordinates.
wm - A writing mode constant from fo.properties.WritingMode, ie.
one of LR_TB, RL_TB, TB_RL.ipd - The inline-progression dimension of the reference area whose
CTM is being set..bpd - The block-progression dimension of the reference area whose
CTM is being set.
- a new CTM with the required transform
multiply
public CTM multiply(CTM premult)
Multiply new passed CTM with this one and generate a new result CTM.
premult - The CTM to multiply with this one. The new one will be
the first multiplicand.
- CTM The result of multiplying premult * this.
rotate
public CTM rotate(double angle)
Rotate this CTM by "angle" radians and return a new result CTM.
This is used to account for reference-orientation.
angle - The angle in radians. Positive angles are measured counter-
clockwise.
- CTM The result of rotating this CTM.
scale
public CTM scale(double x,
double y) Scale this CTM by the passed x and y values and return a new result CTM.
x - The amount to scale along the x axis.y - The amount to scale along the y axis.
- CTM The result of scaling this CTM.
toArray
public double[] toArray()
Get an array containing the values of this transform.
This creates and returns a new transform with the values in it.
- an array containing the transform values
toString
public String toString()
Get string for this transform.
- a string with the transform values
transform
public Rectangle2D transform(Rectangle2D inRect)
Transform a rectangle by the CTM to produce a rectangle in the transformed
coordinate system.
inRect - The rectangle in the original coordinate system
- Rectangle2D The rectangle in the transformed coordinate system.
translate
public CTM translate(double x,
double y) Translate this CTM by the passed x and y values and return a new result CTM.
x - The amount to translate along the x axis.y - The amount to translate along the y axis.
- CTM The result of translating this CTM.
Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.