ImgTile Class Reference

#include <image.h>

Class Description

Represents a rectangle. Used to specify rectangular regions of an image.

Definition at line 960 of file image.h.

+ Inheritance diagram for ImgTile:

Public Member Functions

 ImgTile ()
 Create a default empty tile. More...
 
 ImgTile (int X, int Y, int NX, int NY)
 Create a tile as specified in the parameters. More...
 
 ImgTile (const ImgTile &a, const ImgTile &b)
 Construct a tile by computing the intersection fo the two input tiles. More...
 
bool isEqualTile (const ImgTile &t) const
 
bool operator== (const ImgTile &t) const
 
bool operator!= (const ImgTile &t) const
 
bool isEmpty () const
 return true of this tile is empty More...
 
void setEmpty ()
 
bool contains (const ImgTile &a) const
 return true if this tile includes the specified tile More...
 
bool contains (int x_, int y_) const
 return true if this tile includes the specified point More...
 
void clipPositive ()
 Clip the tile so it will not extend into the negative quadrants. More...
 
void ExpandToInclude (int x_, int y_)
 Expand this tile to include the specified point. More...
 
void Expand (int numPixels=1)
 Grow the tile by the specified number of pixels on all 4 sides. More...
 
int numPixels () const
 return the number of pixels contained in this tile More...
 

Public Attributes

int x
 x origin of the tile More...
 
int y
 y origin of the tile More...
 
int nx
 x size of the tile (width) More...
 
int ny
 y size of the tile (height) More...
 

Constructor & Destructor Documentation

ImgTile ( )
inline

Create a default empty tile.

Definition at line 969 of file image.h.

969 : x(0), y(0), nx(0), ny(0) {}
int nx
x size of the tile (width)
Definition: image.h:965
int y
y origin of the tile
Definition: image.h:964
int x
x origin of the tile
Definition: image.h:963
int ny
y size of the tile (height)
Definition: image.h:966
ImgTile ( int  X,
int  Y,
int  NX,
int  NY 
)
inline

Create a tile as specified in the parameters.

Parameters
XX origin
Yy Origin
NXx Size (width)
NYy Size (height)

Definition at line 978 of file image.h.

978 : x(X), y(Y), nx(NX), ny(NY) {}
int nx
x size of the tile (width)
Definition: image.h:965
int y
y origin of the tile
Definition: image.h:964
int x
x origin of the tile
Definition: image.h:963
int ny
y size of the tile (height)
Definition: image.h:966
ImgTile ( const ImgTile a,
const ImgTile b 
)
inline

Construct a tile by computing the intersection fo the two input tiles.

Parameters
t1First tile to be intersected
t2Second tile to be intersected

Definition at line 992 of file image.h.

993  {
994  x = MAX(a.x, b.x);
995  y = MAX(a.y, b.y);
996  nx = MIN(a.x+a.nx, b.x+b.nx) - x;
997  ny = MIN(a.y+a.ny, b.y+b.ny) - y;
998  if (nx <= 0 || ny <= 0) x = y = nx = ny = 0;
999  }
GLenum GLint GLint y
Definition: GLee.h:876
#define MAX(a_, b_)
Definition: image.h:981
GLfloat ny
Definition: GLee.h:5410
int y
y origin of the tile
Definition: image.h:964
GLenum GLint x
Definition: GLee.h:876
int x
x origin of the tile
Definition: image.h:963
#define MIN(a_, b_)
Definition: image.h:984
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
GLubyte GLubyte b
Definition: GLee.h:5404
GLubyte GLubyte GLubyte a
Definition: GLee.h:5404

Member Function Documentation

bool isEqualTile ( const ImgTile t) const
inline

Definition at line 1001 of file image.h.

1002  { return x == t.x && y == t.y && nx == t.nx && ny == t.ny; }
GLenum GLint GLint y
Definition: GLee.h:876
GLfloat ny
Definition: GLee.h:5410
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
GLdouble GLdouble t
Definition: GLee.h:1181
bool operator== ( const ImgTile t) const
inline

Definition at line 1004 of file image.h.

1005  { return x == t.x && y == t.y && nx == t.nx && ny == t.ny; }
GLenum GLint GLint y
Definition: GLee.h:876
GLfloat ny
Definition: GLee.h:5410
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
GLdouble GLdouble t
Definition: GLee.h:1181
bool operator!= ( const ImgTile t) const
inline

Definition at line 1007 of file image.h.

1008  { return !(t == *this); }
GLdouble GLdouble t
Definition: GLee.h:1181
bool isEmpty ( ) const
inline

return true of this tile is empty

Definition at line 1011 of file image.h.

1011 { return nx <= 0 || ny <= 0; }
GLfloat ny
Definition: GLee.h:5410
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
void setEmpty ( )
inline

Definition at line 1013 of file image.h.

1013 { x = y = nx = ny = 0; }
GLenum GLint GLint y
Definition: GLee.h:876
GLfloat ny
Definition: GLee.h:5410
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
bool contains ( const ImgTile a) const
inline

return true if this tile includes the specified tile

Definition at line 1016 of file image.h.

1017  { return x <= a.x && a.x+a.nx <= x+nx &&
1018  y <= a.y && a.y+a.ny <= y+ny;
1019  }
GLenum GLint GLint y
Definition: GLee.h:876
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
GLubyte GLubyte GLubyte a
Definition: GLee.h:5404
int ny
y size of the tile (height)
Definition: image.h:966
bool contains ( int  x_,
int  y_ 
) const
inline

return true if this tile includes the specified point

Definition at line 1022 of file image.h.

1023  { return x <= x_ && x_ < x+nx && y <= y_ && y_ < y+ny;
1024  }
GLenum GLint GLint y
Definition: GLee.h:876
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
int ny
y size of the tile (height)
Definition: image.h:966
void clipPositive ( )
inline

Clip the tile so it will not extend into the negative quadrants.

Definition at line 1027 of file image.h.

1028  {
1029  if (x < 0) {
1030  nx += x; x = 0;
1031  if (nx < 0) x = y = nx = ny = 0;
1032  }
1033  if (y < 0) {
1034  ny += y; y = 0;
1035  if (ny < 0) x = y = nx = ny = 0;
1036  }
1037  }
GLenum GLint GLint y
Definition: GLee.h:876
GLfloat ny
Definition: GLee.h:5410
int y
y origin of the tile
Definition: image.h:964
GLenum GLint x
Definition: GLee.h:876
int x
x origin of the tile
Definition: image.h:963
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
void ExpandToInclude ( int  x_,
int  y_ 
)
inline

Expand this tile to include the specified point.

Definition at line 1040 of file image.h.

1041  {
1042  if (isEmpty()) {
1043  x = x_; y = y_; nx = 1; ny = 1;
1044  } else {
1045  if (x_ < x) { nx += (x - x_); x = x_; }
1046  if (y_ < y) { ny += (y - y_); y = y_; }
1047 
1048  if (x + nx < x_) nx = (x_ - x) + 1;
1049  if (y + ny < y_) ny = (y_ - y) + 1;
1050  }
1051  }
GLenum GLint GLint y
Definition: GLee.h:876
GLfloat ny
Definition: GLee.h:5410
int y
y origin of the tile
Definition: image.h:964
GLenum GLint x
Definition: GLee.h:876
int x
x origin of the tile
Definition: image.h:963
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
bool isEmpty() const
return true of this tile is empty
Definition: image.h:1011
void Expand ( int  numPixels = 1)
inline

Grow the tile by the specified number of pixels on all 4 sides.

Definition at line 1054 of file image.h.

1055  {
1056  x -= numPixels; y -= numPixels;
1057  numPixels <<= 1;
1058  nx += numPixels; ny += numPixels;
1059  }
GLenum GLint GLint y
Definition: GLee.h:876
GLfloat ny
Definition: GLee.h:5410
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
int numPixels() const
return the number of pixels contained in this tile
Definition: image.h:1062
int numPixels ( ) const
inline

return the number of pixels contained in this tile

Definition at line 1062 of file image.h.

1062 { return isEmpty() ? 0 : nx * ny; }
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
bool isEmpty() const
return true of this tile is empty
Definition: image.h:1011
int ny
y size of the tile (height)
Definition: image.h:966

Member Data Documentation

int x

x origin of the tile

Definition at line 963 of file image.h.

int y

y origin of the tile

Definition at line 964 of file image.h.

x size of the tile (width)

Definition at line 965 of file image.h.

y size of the tile (height)

Definition at line 966 of file image.h.


The documentation for this class was generated from the following file: