Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

IMG_Rect Class Reference

Implements rectangle functionality. More...

#include <IMG_Rect.h>

List of all members.

Public Methods

 IMG_Rect (TInt32 l=0,TInt32 t=0,TInt32 r=0,TInt32 b=0)
 Constructs a rectangle with the given values. More...

 IMG_Rect (const IMG_Rect &r)
 Copy constructor. More...

virtual ~IMG_Rect ()
 Destructor.

virtual TInt32 getWidth ()const
 Access to rectangle width. More...

virtual TInt32 getHeight ()const
 Access to rectangle height. More...

virtual void set (TInt32 l,TInt32 t,TInt32 r,TInt32 b)
 Sets all members of the rectangle. More...

virtual bool isEmpty ()const
 Returns whether this rectangle is empty. More...

virtual bool isValid ()const
 Returns whether this rectangle is valid. More...

virtual void inset (TInt32 i)
 Grows (or shrinks the rectangle). More...

virtual void unionRect (const IMG_Rect &r)
 Does a union of the rectangle given and this rectangle. More...

virtual void unionPoint (TInt32 x,TInt32 y)
 Grows the rectangle to included a point. More...

virtual bool isInside (TInt32 x,TInt32 y)const
 Returns whether the point is inside this rectangle. More...

virtual TVisibility getVisibility (IMG_Rect &r)const
 Returns whether the rectangle is inside this rectangle. More...

virtual TVisibility getVisibility (IMG_Line &l)const
 Returns whether the line is inside this rectangle. More...

virtual void setCenter (TInt32 cx,TInt32 cy)
 Sets rectangle members. More...

virtual void setCenter (TInt32 cx,TInt32 cy,TInt32 w,TInt32 h)
 Sets rectangle members. More...

virtual bool clip (IMG_Rect &r)const
 Clips a rectangle. More...

virtual bool clip (IMG_Line &l)const
 Clips a line. More...


Public Attributes

TInt32 m_l
 Left coordinate of the rectangle.

TInt32 m_t
 Top coordinate of the rectangle.

TInt32 m_r
 Right coordinate of the rectangle.

TInt32 m_b
 Bottom coordinate of the rectangle.


Detailed Description

Implements rectangle functionality.

Used for bounds in images. The four extreme coordinates are stored as left, top, right and bottom. left is assumed to be smaller than or equal to right. top is assumed to be smaller than or equal to bottom.

Author(s):
Maarten Gribnau
Date:
March 6, 2001


Constructor & Destructor Documentation

IMG_Rect::IMG_Rect ( TInt32 l = 0,
TInt32 t = 0,
TInt32 r = 0,
TInt32 b = 0 ) [inline]
 

Constructs a rectangle with the given values.

Parameters:
l   requested left coordinate of the rectangle
t   requested top coordinate of the rectangle
r   requested right coordinate of the rectangle
b   requested bottom coordinate of the rectangle

IMG_Rect::IMG_Rect ( const IMG_Rect & r ) [inline]
 

Copy constructor.

Parameters:
r   rectangle to copy


Member Function Documentation

bool IMG_Rect::clip ( IMG_Line & l ) const [virtual]
 

Clips a line.

Updates the line given such that it will fit within this rectangle. This can result in an empty line.

Parameters:
l   the line to clip
Returns:
whether clipping has occurred

bool IMG_Rect::clip ( IMG_Rect & r ) const [virtual]
 

Clips a rectangle.

Updates the rectangle given such that it will fit within this one. This can result in an empty rectangle.

Parameters:
r   the rectangle to clip
Returns:
whether clipping has occurred

TInt32 IMG_Rect::getHeight ( ) const [inline, virtual]
 

Access to rectangle height.

Returns:
height of the rectangle

TVisibility IMG_Rect::getVisibility ( IMG_Line & l ) const [virtual]
 

Returns whether the line is inside this rectangle.

Parameters:
l   line to test.
Returns:
visibility (not, partially or fully visible).

TVisibility IMG_Rect::getVisibility ( IMG_Rect & r ) const [virtual]
 

Returns whether the rectangle is inside this rectangle.

Parameters:
r   rectangle to test.
Returns:
visibility (not, partially or fully visible).

TInt32 IMG_Rect::getWidth ( ) const [inline, virtual]
 

Access to rectangle width.

Returns:
width of the rectangle

void IMG_Rect::inset ( TInt32 i ) [virtual]
 

Grows (or shrinks the rectangle).

The method avoids negative insets making the rectangle invalid

Parameters:
i   The amount of offset given to each extreme (negative values shrink the rectangle).

bool IMG_Rect::isEmpty ( ) const [inline, virtual]
 

Returns whether this rectangle is empty.

Empty rectangles are rectangles that have width==0 and/or height==0.

Returns:
boolean value (true==empty rectangle)

bool IMG_Rect::isInside ( TInt32 x,
TInt32 y ) const [inline, virtual]
 

Returns whether the point is inside this rectangle.

Point on the boundary is considered inside.

Parameters:
x   x-coordinate of point to test.
y   y-coordinate of point to test.
Returns:
boolean value (true if point is inside).

bool IMG_Rect::isValid ( ) const [inline, virtual]
 

Returns whether this rectangle is valid.

Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, emapty rectangles are valid.

Returns:
boolean value (true==valid rectangle)

void IMG_Rect::set ( TInt32 l,
TInt32 t,
TInt32 r,
TInt32 b ) [inline, virtual]
 

Sets all members of the rectangle.

Parameters:
l   requested left coordinate of the rectangle
t   requested top coordinate of the rectangle
r   requested right coordinate of the rectangle
b   requested bottom coordinate of the rectangle

void IMG_Rect::setCenter ( TInt32 cx,
TInt32 cy,
TInt32 w,
TInt32 h ) [virtual]
 

Sets rectangle members.

Sets rectangle members such that it is centered at the given location, with the width requested.

Parameters:
cx   requested center x-coordinate of the rectangle
cy   requested center y-coordinate of the rectangle
w   requested width of the rectangle
h   requested height of the rectangle

void IMG_Rect::setCenter ( TInt32 cx,
TInt32 cy ) [virtual]
 

Sets rectangle members.

Sets rectangle members such that it is centered at the given location.

Parameters:
cx   requested center x-coordinate of the rectangle
cy   requested center y-coordinate of the rectangle

void IMG_Rect::unionPoint ( TInt32 x,
TInt32 y ) [inline, virtual]
 

Grows the rectangle to included a point.

Parameters:
x   The x-coordinate of the point.
y   The y-coordinate of the point.

void IMG_Rect::unionRect ( const IMG_Rect & r ) [inline, virtual]
 

Does a union of the rectangle given and this rectangle.

The result is stored in this rectangle.

Parameters:
r   The rectangle that is input for the union operation.


The documentation for this class was generated from the following files:
Generated at Thu May 3 17:29:38 2001 for ImgLib by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000