PowerUI.BoxRegion Class Reference

Detailed Description

BoxRegion defines a 2D screen region. Mostly used for clipping.

Public Member Functions

 BoxRegion ()
 
 BoxRegion (float x, float y, float width, float height)
 Creates a new box. More...
 
void Set (float x, float y, float width, float height)
 Applies new values to an existing box. More...
 
bool Overlaps (BoxRegion box)
 Evaluates if one box overlaps another. More...
 
void ClipByAffecting (BoxRegion bound, BoxRegion affect)
 Makes sure this box fits inside the given one by clipping it so it does. Any pixels sliced off this box are also sliced off affect. More...
 
void ClipBy (BoxRegion box)
 Makes sure this box fits inside the given one by clipping it so it does. More...
 
bool ClipByChecked (BoxRegion box)
 Makes sure this box fits inside the given one by clipping it so it does. More...
 
float ClipLeft (float line)
 Clips the left side of this box, making sure it does not extend beyond the given value. More...
 
float ClipRight (float line)
 Clips the right side of this box, making sure it does not extend beyond the given value. More...
 
float ClipTop (float line)
 Clips the top of this box, making sure it does not extend beyond the given value. More...
 
float ClipBottom (float line)
 Clips the bottom of this box, making sure it does not extend beyond the given value. More...
 
void RemoveFromLeft (float px)
 Removes up to the given amount of pixels from the left side of the box. It is bounded to ensure a negative width is not created. More...
 
void RemoveFromRight (float px)
 Removes up to the given amount of pixels from the right side of the box. It is bounded to ensure a negative width is not created. More...
 
void RemoveFromTop (float px)
 Removes up to the given amount of pixels from the top side of the box. It is bounded to ensure a negative height is not created. More...
 
void RemoveFromBottom (float px)
 Removes up to the given amount of pixels from the bottom side of the box. It is bounded to ensure a negative height is not created. More...
 
override string ToString ()
 Produces an easy to read summary of this boxes shape. More...
 

Public Attributes

float X
 The X coordinate of the box. More...
 
float Y
 The Y coordinate of the box. More...
 
float MaxX
 The Maximum X value of the box. X+Width. More...
 
float MaxY
 The Maximum Y value of the box. Y+Height. More...
 
float Width
 The width of the box. More...
 
float Height
 The height of the box. More...
 

Constructor & Destructor Documentation

PowerUI.BoxRegion.BoxRegion ( )
inline
PowerUI.BoxRegion.BoxRegion ( float  x,
float  y,
float  width,
float  height 
)
inline

Creates a new box.

Parameters
xThe X coordinate of the box.
yThe Y coordinate of the box.
widthThe width of the box.
heightThe height of the box.

Member Function Documentation

float PowerUI.BoxRegion.ClipBottom ( float  line)
inline

Clips the bottom of this box, making sure it does not extend beyond the given value.

Parameters
lineThe y coordinate of a horizontal line to clip with. It's exclusive; If it sits on the border, nothing happens.
Returns
The amount of pixels cut off.
void PowerUI.BoxRegion.ClipBy ( BoxRegion  box)
inline

Makes sure this box fits inside the given one by clipping it so it does.

Parameters
boundThe bounding box that this must be clipped to.
void PowerUI.BoxRegion.ClipByAffecting ( BoxRegion  bound,
BoxRegion  affect 
)
inline

Makes sure this box fits inside the given one by clipping it so it does. Any pixels sliced off this box are also sliced off affect.

Parameters
boundThe bounding box that this must be clipped to.
affectA secondary box that will also be clipped with this one. May, for example, be a region of UV pixel coordinates.
bool PowerUI.BoxRegion.ClipByChecked ( BoxRegion  box)
inline

Makes sure this box fits inside the given one by clipping it so it does.

Parameters
boundThe bounding box that this must be clipped to.
float PowerUI.BoxRegion.ClipLeft ( float  line)
inline

Clips the left side of this box, making sure it does not extend beyond the given value.

Parameters
lineThe x coordinate of a vertical line to clip with. It's exclusive; If it sits on the border, nothing happens.
Returns
The amount of pixels cut off.
float PowerUI.BoxRegion.ClipRight ( float  line)
inline

Clips the right side of this box, making sure it does not extend beyond the given value.

Parameters
lineThe x coordinate of a vertical line to clip with. It's exclusive; If it sits on the border, nothing happens.
Returns
The amount of pixels cut off.
float PowerUI.BoxRegion.ClipTop ( float  line)
inline

Clips the top of this box, making sure it does not extend beyond the given value.

Parameters
lineThe y coordinate of a horizontal line to clip with. It's exclusive; If it sits on the border, nothing happens.
Returns
The amount of pixels cut off.
bool PowerUI.BoxRegion.Overlaps ( BoxRegion  box)
inline

Evaluates if one box overlaps another.

Parameters
boxThe other box to check with.
Returns
True if the given box overlaps this one.
void PowerUI.BoxRegion.RemoveFromBottom ( float  px)
inline

Removes up to the given amount of pixels from the bottom side of the box. It is bounded to ensure a negative height is not created.

Parameters
pxThe amount of pixels to remove.
void PowerUI.BoxRegion.RemoveFromLeft ( float  px)
inline

Removes up to the given amount of pixels from the left side of the box. It is bounded to ensure a negative width is not created.

Parameters
pxThe amount of pixels to remove.
void PowerUI.BoxRegion.RemoveFromRight ( float  px)
inline

Removes up to the given amount of pixels from the right side of the box. It is bounded to ensure a negative width is not created.

Parameters
pxThe amount of pixels to remove.
void PowerUI.BoxRegion.RemoveFromTop ( float  px)
inline

Removes up to the given amount of pixels from the top side of the box. It is bounded to ensure a negative height is not created.

Parameters
pxThe amount of pixels to remove.
void PowerUI.BoxRegion.Set ( float  x,
float  y,
float  width,
float  height 
)
inline

Applies new values to an existing box.

Parameters
xThe X coordinate of the box.
yThe Y coordinate of the box.
widthThe width of the box.
heightThe height of the box.
override string PowerUI.BoxRegion.ToString ( )
inline

Produces an easy to read summary of this boxes shape.

Member Data Documentation

float PowerUI.BoxRegion.Height

The height of the box.

float PowerUI.BoxRegion.MaxX

The Maximum X value of the box. X+Width.

float PowerUI.BoxRegion.MaxY

The Maximum Y value of the box. Y+Height.

float PowerUI.BoxRegion.Width

The width of the box.

float PowerUI.BoxRegion.X

The X coordinate of the box.

float PowerUI.BoxRegion.Y

The Y coordinate of the box.