|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lizardtech.djvu.anno.Mapper
public class Mapper
Maps points from one rectangle to another rectangle. This class represents a relation between the points of two rectangles. Given the coordinates of a point in the first rectangle (input rectangle), function map computes the coordinates of the corresponding point in the second rectangle (the output rectangle). This function actually implements an affine transform which maps the corners of the first rectangle onto the matching corners of the second rectangle. The scaling operation is performed using integer fraction arithmetic in order to maximize accuracy.
Constructor Summary | |
---|---|
Mapper()
Constructs a rectangle mapper. |
Method Summary | |
---|---|
void |
clear()
Resets the rectangle mapper state. |
GRect |
getInput()
Query the input rectangle. |
GRect |
getOutput()
Query the output rectangle. |
void |
map(GRect rect)
Maps a rectangle according to the affine transform. |
int |
mapX(int x,
int y)
Map a point and return the new x coordinate. |
int |
mapY(int x,
int y)
Map a point and return the new y coordinate. |
void |
mirrorx()
Composes the affine transform with a symmetry with respect to the vertical line crossing the center of the output rectangle. |
void |
mirrory()
Composes the affine transform with a symmetry with respect to the horizontal line crossing the center of the output rectangle. |
void |
rotate()
Composes the affine transform with a rotation of count quarter turns counter-clockwise. |
void |
rotate(int count)
Composes the affine transform with a rotation of count quarter turns counter-clockwise. |
void |
setInput(GRect rect)
Sets the input rectangle. |
void |
setOutput(GRect rect)
Sets the output rectangle. |
void |
unmap(GRect rect)
Maps a rectangle according to the inverse of the affine transform. |
int |
unmap(int x,
int y,
boolean needX)
Maps a point according to the inverse of the affine transform. |
int |
unmapX(int x,
int y)
Transform the specified point and return the x coordinate |
int |
unmapY(int x,
int y)
Transform the specified point and return the y coordinate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Mapper()
Method Detail |
---|
public void clear()
public GRect getInput()
public GRect getOutput()
public void map(GRect rect)
rect
- the rectangle to transformpublic int mapX(int x, int y)
x
- old x coordinatey
- old y coordinate
public int mapY(int x, int y)
x
- old x coordinatey
- old y coordinate
public void mirrorx()
public void mirrory()
public void rotate(int count)
count
- angle to rotate divided by 90public void rotate()
public void setInput(GRect rect)
rect
- input rectangle
java.lang.IllegalArgumentException
- if the rectangle is emptypublic void setOutput(GRect rect)
rect
- output rectangle
java.lang.IllegalArgumentException
- if the rectangle is emptypublic int unmap(int x, int y, boolean needX)
x
- horizontal coordinatey
- vertical coordinateneedX
- true if x should be returned
public void unmap(GRect rect)
rect
- rectangle to unmappublic int unmapX(int x, int y)
x
- horizontal coordinatey
- vertical coordinate
public int unmapY(int x, int y)
x
- horizontal coordinatey
- vertical coordinate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |