Detailed Description

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

Inheritance diagram for Css.BoxRegion:
Css.ScreenRegion Css.LayoutBox

Public Member Functions

 BoxRegion ()
 
 BoxRegion (float x, float y, float width, float height)
 Creates a new box. More...
 
override bool Contains (float x, float y)
 Checks if this box contains the given co-ordinates. More...
 
void Set (float x, float y, float width, float height)
 Applies new values to an existing box. More...
 
void SetPoints (float minX, float minY, float maxX, float maxY)
 
void SetPoint (float x, float y)
 Sets this region to being the given point (with a w/h of 0). More...
 
void AddPoint (float x, float y)
 Adds the given point to the region. More...
 
void Combine (BoxRegion r)
 Adds the given region into this one. 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...
 

Properties

static BoxRegion Empty [get]
 An all zero box region. More...
 
override float ScreenMinX [get]
 
override float ScreenMinY [get]
 
override float ScreenMaxX [get]
 
override float ScreenMaxY [get]
 
bool IsNotEmpty [get]
 True if this region is non-zero. More...
 
bool IsEmpty [get]
 True if this region is all zero. More...
 
- Properties inherited from Css.ScreenRegion
virtual float ScreenMinX [get]
 
virtual float ScreenMinY [get]
 
virtual float ScreenMaxX [get]
 
virtual float ScreenMaxY [get]
 

Constructor & Destructor Documentation

Css.BoxRegion.BoxRegion ( )
inline
Css.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

void Css.BoxRegion.AddPoint ( float  x,
float  y 
)
inline

Adds the given point to the region.

float Css.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 Css.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 Css.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 Css.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 Css.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 Css.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 Css.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.
void Css.BoxRegion.Combine ( BoxRegion  r)
inline

Adds the given region into this one.

override bool Css.BoxRegion.Contains ( float  x,
float  y 
)
inlinevirtual

Checks if this box contains the given co-ordinates.

Parameters
xThe x coordinate to check.
yThe y coordinate to check.
Returns
True if the bounding box of this element contains the coordinate.

Reimplemented from Css.ScreenRegion.

bool Css.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 Css.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 Css.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 Css.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 Css.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 Css.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.
void Css.BoxRegion.SetPoint ( float  x,
float  y 
)
inline

Sets this region to being the given point (with a w/h of 0).

void Css.BoxRegion.SetPoints ( float  minX,
float  minY,
float  maxX,
float  maxY 
)
inline
override string Css.BoxRegion.ToString ( )
inline

Produces an easy to read summary of this boxes shape.

Member Data Documentation

float Css.BoxRegion.Height

The height of the box.

float Css.BoxRegion.MaxX

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

float Css.BoxRegion.MaxY

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

float Css.BoxRegion.Width

The width of the box.

float Css.BoxRegion.X

The X coordinate of the box.

float Css.BoxRegion.Y

The Y coordinate of the box.

Property Documentation

BoxRegion Css.BoxRegion.Empty
staticget

An all zero box region.

bool Css.BoxRegion.IsEmpty
get

True if this region is all zero.

bool Css.BoxRegion.IsNotEmpty
get

True if this region is non-zero.

override float Css.BoxRegion.ScreenMaxX
get
override float Css.BoxRegion.ScreenMaxY
get
override float Css.BoxRegion.ScreenMinX
get
override float Css.BoxRegion.ScreenMinY
get