Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

ptc::Area Class Reference

A rectangular area. More...

List of all members.

Public Members


Detailed Description

A rectangular area.

The area class represents a rectangle of pixels.

It is typically used to select certain areas of pixels for operations such as copying, and clearing.

The most important thing to understand about area objects is that zero areas represent zero areas.

This means that an area object Area(0,0,0,0) covers zero pixels, instead of one pixel.

An area Area(0,0,1,1) covers a single pixel, even though the points (0,0) and (1,1) span over a 2x2 block of pixels.

Another way to think about it is that the top-left coordinate is inclusive and the bottom-right coordinate is exclusive.

See Surface::load(), Surface::save(), Surface::copy(), and Surface::clear() for examples of the use of areas.


Member Function Documentation

ptc::Area::Area ()

Default constructor.

left, right, top and bottom are all set to zero.

ptc::Area::Area (int left, int top, int right, int bottom)

Creates a rectangular area with the upper left corner at ( left, top ) and the lower right corner at ( right, bottom ).

Switches the left and right coordinates if left > right.

Switches the top and bottom coordinates if top > bottom.

Parameters:
left - the left coordinate of the area.
top - the top coordinate of the area.
right - the right coordinate of the area.
bottom - the bottom coordinate of the area.

ptc::Area::Area (const Area & area)

Copy constructor.

ptc::Area::~Area ()

Destructor.

int ptc::Area::left () const

Gets the left coordinate of the area.

Returns:
The left area coordinate.

int ptc::Area::top () const

Gets the top coordinate of the area.

Returns:
The top area coordinate.

int ptc::Area::right () const

Gets the right coordinate of the area.

Returns:
The right area coordinate.

int ptc::Area::bottom () const

Gets the bottom coordinate of the area.

Returns:
The bottom area coordinate.

int ptc::Area::width () const

Gets the width of the area ( right - left ).

Returns:
The area width.

int ptc::Area::height () const

Gets the height of the area ( bottom - top ).

Returns:
The area height.

Area & ptc::Area::operator= (const Area & area)

Assignment operator.

bool ptc::Area::operator== (const Area & area) const

Equality operator.

bool ptc::Area::operator!= (const Area & area) const

Inequality operator.


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