iflTile(3) Image Format Library C++ Reference Manual iflTile(3)
iflTile2D - defines a simple 2-D rectangle
This is a base class and therefore has no inheritance.
#include <ifl/iflTile.h>
This class is used to describe rectangles (tiles). It is mostly used to
group together the four values describing the origin (x,y) and size
(nx,ny,) of a rectangle in a convenient way.
This is a template class that can be used with any scalar data type; e.g,
use iflTile2D<int>() to construct a 2D integer tile and
iflTile2D<float>() for a 2D-float tile.
The following is an example on how to use a 2D integer tile. iflTile
object can be declared in the following way:
// unitialized
iflTile2D<int> tile;
// initialized
iflTile2D<int> tile(xStart, yStart, xSize, ySize);
iflTile2D<int> tile(tileA, tileB);
A useful function, contains(), is provided that can be used to determine
if this tile fully contains another. An overloaded version allows
maximum (x,y) bounds to be specified that are use to clip the other tile;
this version is used where a page might extend beyond the edge of an
image. Also two operators == and != are provided to find out whether or
not two tiles are the same.
CLASS MEMBER FUNCTION SUMMARY [Toc] [Back] Constructors
iflTile2D<type>()
iflTile2D<type>(type X, type Y, type nX, type nY)
iflTile2D<type>(const iflTile2D& that)
iflTile2D<type>(const iflTile2D<type>& a, const iflTile2D<type>& b)
iflTile2D<type>(const iflTile2D<type>& a, const iflTile2D<type>& b,
const iflTile2D<type>& c)
Page 1
iflTile(3) Image Format Library C++ Reference Manual iflTile(3)
Initialization [Toc] [Back]
iflTile2D<type>& init(type X, type Y, type Nx, type Ny)
iflTile2D<type>& init(const iflTile2D<type>& tile)
Intersection [Toc] [Back]
iflTile2D<type>& intersect(const iflTile2D<type>& a,
const iflTile2D<type>& b)
iflTile2D<type>& intersect(const iflTile2D<type>& a,
const iflTile2D<type>& b,
const iflTile2D<type>& c)
Bounding box [Toc] [Back]
iflTile2D<type>& boundingBox(const iflTile2D<type>& a,
const iflTile2D<type>& b)
iflTile2D<type>& boundingBox(const iflTile2D<type>& a,
const iflTile2D<type>& b,
const iflTile2D<type>& c)
Checking for containment [Toc] [Back]
int contains(type X, type Y) const
int contains(const iflTile2D<type>& tile) const
int contains(const iflTile2D<type>& tile,
type xMax, type yMax) const
Equality operators [Toc] [Back]
int operator==(const iflTile2D<type>& tile) const
int operator!=(const iflTile2D<type>& tile) const
Offsetting and growing
void operator+=(const iflXY<type>& offset)
void operator-=(const iflXY<type>& offset)
void grow(const iflXY<type>& delta)
void shrink(const iflXY<type>& delta)
FUNCTION DESCRIPTIONS [Toc] [Back] iflTile2D()
iflTile2D<type>()
iflTile2D<type>(type X, type Y, type nX, type nY)
iflTile2D<type>(const iflTile2D& that)
Page 2
iflTile(3) Image Format Library C++ Reference Manual iflTile(3)
iflTile2D<type>(const iflTile2D<type>& a, const iflTile2D<type>& b)
iflTile2D<type>(const iflTile2D<type>& a, const iflTile2D<type>& b,
const iflTile2D<type>& c)
The first version with no arguments constructs an uninitialized
iflTile2D. The second version constructs an iflTile2D with the
origin set to (X,Y) and the size set to (nX,nY). The third version
constructs a copy of another 2D tile. The fourth version constructs
an iflTile2D whose origin and size are set to the intersection of
the tiles specified by a and b. The final version constructs an
iflTile2D whose origin and size are set to the intersection of the
tiles specified by a, b and c.
boundingBox()
iflTile2D<type>& boundingBox(const iflTile2D<type>& a,
const iflTile2D<type>& b)
iflTile2D<type>& boundingBox(const iflTile2D<type>& a,
const iflTile2D<type>& b,
const iflTile2D<type>& c)
The first version sets this object's origin and size to the
intersection of the tiles specified by a and b. The second version
sets this object's origin and size to the intersection of the tiles
specified by a, b and c. The returned value is a reference to this
object.
contains()
int contains(type X, type Y) const
int contains(const iflTile2D<type>& tile) const
int contains(const iflTile2D<type>& tile,
type xMax, type yMax) const
This function returns true if this object contains the point
specified by (X,Y). The second version returns true if this object
completely contains the iflTile2D specified by tile. The third
version allows tile to be first clipped by the maximum bounds
specified by xMax and yMax before checking for containment.
grow()
void grow(const iflXY<type>& delta)
Increase the size of the tile by the amount specified in delta.
Page 3
iflTile(3) Image Format Library C++ Reference Manual iflTile(3)
init()
iflTile2D<type>& init(type X, type Y, type nX, type nY)
iflTile2D<type>& init(const iflTile2D<type>& tile)
The first version initializes this object with the origin set to
(X,Y) and the size set to (nX,nY). The second version initializes
this object with a copy of the 2D tile specified by tile.
intersect()
iflTile2D<type>& intersect(const iflTile2D<type>& a,
const iflTile2D<type>& b)
iflTile2D<type>& intersect(const iflTile2D<type>& a,
const iflTile2D<type>& b,
const iflTile2D<type>& c)
The first version initializes this object with the origin and size
set to the intersection of the tiles specified by a and b. The
second version initializes this object with the origin and size set
to the intersection of the tiles specified by a, b and c.
operator==
int operator==(const iflTile2D<type>& tile) const
Returns TRUE if tile is the same as 'this' tile, FALSE otherwise.
operator!=
int operator!=(const iflTile2D<type>& tile) const
Returns TRUE if tile is not the same as 'this' tile, FALSE
otherwise.
operator+=
void operator+=(const iflXY<type>& offset) const
Shift the origin of the tile by adding to it the amount specified in
offset.
operator-=
void operator-=(const iflXY<type>& offset) const
Page 4
iflTile(3) Image Format Library C++ Reference Manual iflTile(3)
Shift the origin of the tile by subtracting from it the amount
specified in offset.
shrink()
void shrink(const iflXY<type>& delta)
Decrease the size of the tile by the amount specified in delta.
PPPPaaaaggggeeee 5555 [ Back ]
|