- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes

# ImgTile Class Reference

This reference page is linked to from the following overview topics: Images.

Search for all occurrences

## Detailed Description

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

Definition at line 960 of file image.h.

`#include <image.h>`

Inheritance diagram for ImgTile:
[legend]

List of all members.

## Public Member Functions
| ImgTile ()
| Create a default empty tile.
| ImgTile (int X, int Y, int NX, int NY)
| Create a tile as specified in the parameters.
| ImgTile (const ImgTile &a, const ImgTile &b)
| Construct a tile by computing the intersection fo the two input tiles.
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
void | setEmpty ()
bool | contains (const ImgTile &a) const
| return true if this tile includes the specified tile
bool | contains (int x_, int y_) const
| return true if this tile includes the specified point
void | clipPositive ()
| Clip the tile so it will not extend into the negative quadrants.
void | ExpandToInclude (int x_, int y_)
| Expand this tile to include the specified point.
void | Expand (int numPixels=1)
| Grow the tile by the specified number of pixels on all 4 sides.
int | numPixels () const
| return the number of pixels contained in this tile
## Public Attributes
int | x
| x origin of the tile
int | y
| y origin of the tile
int | nx
| x size of the tile (width)
int | ny
| y size of the tile (height)

## Constructor & Destructor Documentation

ImgTile | ( |  | ) | `[inline]`

Create a default empty tile.

Definition at line 969 of file image.h.

    : x(0), y(0), nx(0), ny(0) {}

ImgTile | ( | int | X,
|  | int | Y,
|  | int | NX,
|  | int | NY
| ) |  | `[inline]`

Create a tile as specified in the parameters.

Parameters:

  X | X origin
  Y | y Origin
  NX | x Size (width)
  NY | y Size (height)

Definition at line 978 of file image.h.

    : x(X), y(Y), nx(NX), ny(NY) {}

ImgTile | ( | const ImgTile & | a,
|  | const ImgTile & | b
| ) |  | `[inline]`

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

Parameters:

  t1 | First tile to be intersected
  t2 | Second tile to be intersected

Definition at line 992 of file image.h.

        {
            x  = MAX(a.x, b.x);
            y  = MAX(a.y, b.y);
            nx = MIN(a.x+a.nx, b.x+b.nx) - x;
            ny = MIN(a.y+a.ny, b.y+b.ny) - y;
            if (nx <= 0 || ny <= 0) x = y = nx = ny = 0;
        }

## Member Function Documentation

bool isEqualTile | ( | const ImgTile & | t | ) | const `[inline]`

Search for all occurrences

Definition at line 1001 of file image.h.

        { return x == t.x && y == t.y && nx == t.nx && ny == t.ny; }

bool operator== | ( | const ImgTile & | t | ) | const `[inline]`

Definition at line 1004 of file image.h.

        { return x == t.x && y == t.y && nx == t.nx && ny == t.ny; }

bool operator!= | ( | const ImgTile & | t | ) | const `[inline]`

Definition at line 1007 of file image.h.

        { return !(t == *this); }

bool isEmpty | ( |  | ) | const `[inline]`

Search for all occurrences

return true of this tile is empty

Definition at line 1011 of file image.h.

    { return nx <= 0 || ny <= 0; }

void setEmpty | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 1013 of file image.h.

    { x = y = nx = ny = 0; }

bool contains | ( | const ImgTile & | a | ) | const `[inline]`

Search for all occurrences

return true if this tile includes the specified tile

Definition at line 1016 of file image.h.

        { return x <= a.x && a.x+a.nx <= x+nx &&
                 y <= a.y && a.y+a.ny <= y+ny;
        }

bool contains | ( | int | x_,
|  | int | y_
| ) |  | const `[inline]`

Search for all occurrences

return true if this tile includes the specified point

Definition at line 1022 of file image.h.

        { return x <= x_ && x_ < x+nx && y <= y_ && y_ < y+ny;
        }

void clipPositive | ( |  | ) | `[inline]`

Search for all occurrences

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

Definition at line 1027 of file image.h.

        {
            if (x < 0) {
                nx += x; x = 0;
                if (nx < 0) x = y = nx = ny = 0;
            }
            if (y < 0) {
                ny += y; y = 0;
                if (ny < 0) x = y = nx = ny = 0;
            }
        }

void ExpandToInclude | ( | int | x_,
|  | int | y_
| ) |  | `[inline]`

Search for all occurrences

Expand this tile to include the specified point.

Definition at line 1040 of file image.h.

        {
            if (isEmpty()) {
                x = x_; y = y_; nx = 1; ny = 1;
            } else {
                if (x_ < x) { nx += (x - x_); x = x_; }
                if (y_ < y) { ny += (y - y_); y = y_; }

                if (x + nx < x_) nx = (x_ - x) + 1;
                if (y + ny < y_) ny = (y_ - y) + 1;
            }
        }

void Expand | ( | int | numPixels = `1` | ) | `[inline]`

Search for all occurrences

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

Definition at line 1054 of file image.h.

        {
            x  -= numPixels; y  -= numPixels;
            numPixels <<= 1;
            nx += numPixels; ny += numPixels;
        }

int numPixels | ( |  | ) | const `[inline]`

Search for all occurrences

return the number of pixels contained in this tile

Definition at line 1062 of file image.h.

    { return isEmpty() ? 0 : nx * ny; }

## Member Data Documentation

int x

Search for all occurrences

x origin of the tile

Definition at line 963 of file image.h.

int y

Search for all occurrences

y origin of the tile

Definition at line 964 of file image.h.

int nx

Search for all occurrences

x size of the tile (width)

Definition at line 965 of file image.h.

int ny

Search for all occurrences

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:

- Mudbox/image.h

ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile
ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile ImgTile