kviewshell
GRectMapper Class Reference
Maps points from one rectangle to another rectangle. More...
#include <GRect.h>
Public Member Functions | |
void | clear () |
GRect | get_input () |
GRect | get_output () |
GRectMapper () | |
void | map (GRect &rect) |
void | map (int &x, int &y) |
void | mirrorx () |
void | mirrory () |
void | rotate (int count=1) |
void | set_input (const GRect &rect) |
void | set_output (const GRect &rect) |
void | unmap (GRect &rect) |
void | unmap (int &x, int &y) |
Friends | |
int | operator* (int n, GRatio r) |
int | operator/ (int n, GRatio r) |
Detailed Description
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.
Definition at line 263 of file GRect.h.
Constructor & Destructor Documentation
GRectMapper::GRectMapper | ( | ) |
Member Function Documentation
void GRectMapper::clear | ( | void | ) |
GRect GRectMapper::get_input | ( | ) |
GRect GRectMapper::get_output | ( | ) |
void GRectMapper::map | ( | GRect & | rect | ) |
void GRectMapper::map | ( | int & | x, | |
int & | y | |||
) |
Maps a point according to the affine transform.
Variables x# and y# initially contain the coordinates of a point. This operation overwrites these variables with the coordinates of a second point located in the same position relative to the corners of the output rectangle as the first point relative to the matching corners of the input rectangle. Coordinates are rounded to the nearest integer.
void GRectMapper::mirrorx | ( | ) |
Composes the affine transform with a symmetry with respect to the vertical line crossing the center of the output rectangle.
This operation essentially is a modification of the match between the corners of the input rectangle and the corners of the output rectangle.
void GRectMapper::mirrory | ( | ) |
Composes the affine transform with a symmetry with respect to the horizontal line crossing the center of the output rectangle.
This operation essentially is a modification of the match between the corners of the input rectangle and the corners of the output rectangle.
void GRectMapper::rotate | ( | int | count = 1 |
) |
void GRectMapper::set_input | ( | const GRect & | rect | ) |
void GRectMapper::set_output | ( | const GRect & | rect | ) |
void GRectMapper::unmap | ( | GRect & | rect | ) |
Maps a rectangle according to the inverse of the affine transform.
This operation consists in mapping the rectangle corners and reordering the corners in the canonical rectangle representation. Variable rect# is overwritten with the new rectangle coordinates.
void GRectMapper::unmap | ( | int & | x, | |
int & | y | |||
) |
Maps a point according to the inverse of the affine transform.
Variables x# and y# initially contain the coordinates of a point. This operation overwrites these variables with the coordinates of a second point located in the same position relative to the corners of input rectangle as the first point relative to the matching corners of the input rectangle. Coordinates are rounded to the nearest integer.
Friends And Related Function Documentation
The documentation for this class was generated from the following files: