Shift
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Pages
Shift.Rectangle Struct Reference

Describes a 2D-rectangle. More...

Inheritance diagram for Shift.Rectangle:

Public Member Functions

 Rectangle (int x, int y, int width, int height)
 Creates a new instance of Rectangle struct, with the specified position, width, and height. More...
 
 Rectangle (Point location, Point size)
 Creates a new instance of Rectangle struct, with the specified location and size. More...
 
bool Contains (int x, int y)
 Gets whether or not the provided coordinates lie within the bounds of this Rectangle. More...
 
bool Contains (float x, float y)
 Gets whether or not the provided coordinates lie within the bounds of this Rectangle. More...
 
bool Contains (Point value)
 Gets whether or not the provided Point lies within the bounds of this Rectangle. More...
 
void Contains (ref Point value, out bool result)
 Gets whether or not the provided Point lies within the bounds of this Rectangle. More...
 
bool Contains (Vector2 value)
 Gets whether or not the provided Vector2 lies within the bounds of this Rectangle. More...
 
void Contains (ref Vector2 value, out bool result)
 Gets whether or not the provided Vector2 lies within the bounds of this Rectangle. More...
 
bool Contains (Rectangle value)
 Gets whether or not the provided Rectangle lies within the bounds of this Rectangle. More...
 
void Contains (ref Rectangle value, out bool result)
 Gets whether or not the provided Rectangle lies within the bounds of this Rectangle. More...
 
override bool Equals (object obj)
 Compares whether current instance is equal to specified Object. More...
 
bool Equals (Rectangle other)
 Compares whether current instance is equal to specified Rectangle. More...
 
override int GetHashCode ()
 Gets the hash code of this Rectangle. More...
 
void Inflate (int horizontalAmount, int verticalAmount)
 Adjusts the edges of this Rectangle by specified horizontal and vertical amounts. More...
 
void Inflate (float horizontalAmount, float verticalAmount)
 Adjusts the edges of this Rectangle by specified horizontal and vertical amounts. More...
 
bool Intersects (Rectangle value)
 Gets whether or not the other Rectangle intersects with this rectangle. More...
 
void Intersects (ref Rectangle value, out bool result)
 Gets whether or not the other Rectangle intersects with this rectangle. More...
 
void Offset (int offsetX, int offsetY)
 Changes the Location of this Rectangle. More...
 
void Offset (float offsetX, float offsetY)
 Changes the Location of this Rectangle. More...
 
void Offset (Point amount)
 Changes the Location of this Rectangle. More...
 
void Offset (Vector2 amount)
 Changes the Location of this Rectangle. More...
 
override string ToString ()
 Returns a String representation of this Rectangle in the format: {X:[X] Y:[Y] Width:[Width] Height:[Height]} More...
 

Static Public Member Functions

static bool operator== (Rectangle a, Rectangle b)
 Compares whether two Rectangle instances are equal. More...
 
static bool operator!= (Rectangle a, Rectangle b)
 Compares whether two Rectangle instances are not equal. More...
 
static Rectangle Intersect (Rectangle value1, Rectangle value2)
 Creates a new Rectangle that contains overlapping region of two other rectangles. More...
 
static void Intersect (ref Rectangle value1, ref Rectangle value2, out Rectangle result)
 Creates a new Rectangle that contains overlapping region of two other rectangles. More...
 
static Rectangle Union (Rectangle value1, Rectangle value2)
 Creates a new Rectangle that completely contains two other rectangles. More...
 
static void Union (ref Rectangle value1, ref Rectangle value2, out Rectangle result)
 Creates a new Rectangle that completely contains two other rectangles. More...
 
static implicit operator System.Drawing.Rectangle (Rectangle d)
 

Public Attributes

int X
 The x coordinate of the top-left corner of this Rectangle. More...
 
int Y
 The y coordinate of the top-left corner of this Rectangle. More...
 
int Width
 The width of this Rectangle. More...
 
int Height
 The height of this Rectangle. More...
 

Static Public Attributes

static readonly int SizeInBytes = System.Runtime.InteropServices.Marshal.SizeOf(new Rectangle())
 Defines the size of the Rectangle struct in bytes. More...
 

Properties

static Rectangle Empty [get]
 Returns a Rectangle with X=0, Y=0, Width=0, Height=0. More...
 
int Left [get]
 Returns the x coordinate of the left edge of this Rectangle. More...
 
int Right [get]
 Returns the x coordinate of the right edge of this Rectangle. More...
 
int Top [get]
 Returns the y coordinate of the top edge of this Rectangle. More...
 
int Bottom [get]
 Returns the y coordinate of the bottom edge of this Rectangle. More...
 
bool IsEmpty [get]
 Whether or not this Rectangle has a Width and Height of 0, and a Location of (0, 0). More...
 
Point Location [get, set]
 The top-left coordinates of this Rectangle. More...
 
Point Size [get, set]
 The width-height coordinates of this Rectangle. More...
 
Point Center [get]
 A Point located in the center of this Rectangle. More...
 

Detailed Description

Describes a 2D-rectangle.

Definition at line 12 of file Rectangle.cs.

Constructor & Destructor Documentation

Shift.Rectangle.Rectangle ( int  x,
int  y,
int  width,
int  height 
)
inline

Creates a new instance of Rectangle struct, with the specified position, width, and height.

Parameters
xThe x coordinate of the top-left corner of the created Rectangle.
yThe y coordinate of the top-left corner of the created Rectangle.
widthThe width of the created Rectangle.
heightThe height of the created Rectangle.

Definition at line 165 of file Rectangle.cs.

Shift.Rectangle.Rectangle ( Point  location,
Point  size 
)
inline

Creates a new instance of Rectangle struct, with the specified location and size.

Parameters
locationThe x and y coordinates of the top-left corner of the created Rectangle.
sizeThe width and height of the created Rectangle.

Definition at line 179 of file Rectangle.cs.

Member Function Documentation

bool Shift.Rectangle.Contains ( int  x,
int  y 
)
inline

Gets whether or not the provided coordinates lie within the bounds of this Rectangle.

Parameters
xThe x coordinate of the point to check for containment.
yThe y coordinate of the point to check for containment.
Returns
true if the provided coordinates lie inside this Rectangle; false otherwise.

Definition at line 215 of file Rectangle.cs.

bool Shift.Rectangle.Contains ( float  x,
float  y 
)
inline

Gets whether or not the provided coordinates lie within the bounds of this Rectangle.

Parameters
xThe x coordinate of the point to check for containment.
yThe y coordinate of the point to check for containment.
Returns
true if the provided coordinates lie inside this Rectangle; false otherwise.

Definition at line 226 of file Rectangle.cs.

bool Shift.Rectangle.Contains ( Point  value)
inline

Gets whether or not the provided Point lies within the bounds of this Rectangle.

Parameters
valueThe coordinates to check for inclusion in this Rectangle.
Returns
true if the provided Point lies inside this Rectangle; false otherwise.

Definition at line 236 of file Rectangle.cs.

void Shift.Rectangle.Contains ( ref Point  value,
out bool  result 
)
inline

Gets whether or not the provided Point lies within the bounds of this Rectangle.

Parameters
valueThe coordinates to check for inclusion in this Rectangle.
resulttrue if the provided Point lies inside this Rectangle; false otherwise. As an output parameter.

Definition at line 246 of file Rectangle.cs.

bool Shift.Rectangle.Contains ( Vector2  value)
inline

Gets whether or not the provided Vector2 lies within the bounds of this Rectangle.

Parameters
valueThe coordinates to check for inclusion in this Rectangle.
Returns
true if the provided Vector2 lies inside this Rectangle; false otherwise.

Definition at line 256 of file Rectangle.cs.

void Shift.Rectangle.Contains ( ref Vector2  value,
out bool  result 
)
inline

Gets whether or not the provided Vector2 lies within the bounds of this Rectangle.

Parameters
valueThe coordinates to check for inclusion in this Rectangle.
resulttrue if the provided Vector2 lies inside this Rectangle; false otherwise. As an output parameter.

Definition at line 266 of file Rectangle.cs.

bool Shift.Rectangle.Contains ( Rectangle  value)
inline

Gets whether or not the provided Rectangle lies within the bounds of this Rectangle.

Parameters
valueThe Rectangle to check for inclusion in this Rectangle.
Returns
true if the provided Rectangle's bounds lie entirely inside this Rectangle; false otherwise.

Definition at line 276 of file Rectangle.cs.

void Shift.Rectangle.Contains ( ref Rectangle  value,
out bool  result 
)
inline

Gets whether or not the provided Rectangle lies within the bounds of this Rectangle.

Parameters
valueThe Rectangle to check for inclusion in this Rectangle.
resulttrue if the provided Rectangle's bounds lie entirely inside this Rectangle; false otherwise. As an output parameter.

Definition at line 286 of file Rectangle.cs.

override bool Shift.Rectangle.Equals ( object  obj)
inline

Compares whether current instance is equal to specified Object.

Parameters
objThe Object to compare.
Returns
true if the instances are equal; false otherwise.

Definition at line 296 of file Rectangle.cs.

bool Shift.Rectangle.Equals ( Rectangle  other)
inline

Compares whether current instance is equal to specified Rectangle.

Parameters
otherThe Rectangle to compare.
Returns
true if the instances are equal; false otherwise.

Definition at line 306 of file Rectangle.cs.

override int Shift.Rectangle.GetHashCode ( )
inline

Gets the hash code of this Rectangle.

Returns
Hash code of this Rectangle.

Definition at line 315 of file Rectangle.cs.

void Shift.Rectangle.Inflate ( int  horizontalAmount,
int  verticalAmount 
)
inline

Adjusts the edges of this Rectangle by specified horizontal and vertical amounts.

Parameters
horizontalAmountValue to adjust the left and right edges.
verticalAmountValue to adjust the top and bottom edges.

Definition at line 325 of file Rectangle.cs.

void Shift.Rectangle.Inflate ( float  horizontalAmount,
float  verticalAmount 
)
inline

Adjusts the edges of this Rectangle by specified horizontal and vertical amounts.

Parameters
horizontalAmountValue to adjust the left and right edges.
verticalAmountValue to adjust the top and bottom edges.

Definition at line 338 of file Rectangle.cs.

static Rectangle Shift.Rectangle.Intersect ( Rectangle  value1,
Rectangle  value2 
)
inlinestatic

Creates a new Rectangle that contains overlapping region of two other rectangles.

Parameters
value1The first Rectangle.
value2The second Rectangle.
Returns
Overlapping region of the two rectangles.

Definition at line 379 of file Rectangle.cs.

static void Shift.Rectangle.Intersect ( ref Rectangle  value1,
ref Rectangle  value2,
out Rectangle  result 
)
inlinestatic

Creates a new Rectangle that contains overlapping region of two other rectangles.

Parameters
value1The first Rectangle.
value2The second Rectangle.
resultOverlapping region of the two rectangles as an output parameter.

Definition at line 392 of file Rectangle.cs.

bool Shift.Rectangle.Intersects ( Rectangle  value)
inline

Gets whether or not the other Rectangle intersects with this rectangle.

Parameters
valueThe other rectangle for testing.
Returns
true if other Rectangle intersects with this rectangle; false otherwise.

Definition at line 351 of file Rectangle.cs.

void Shift.Rectangle.Intersects ( ref Rectangle  value,
out bool  result 
)
inline

Gets whether or not the other Rectangle intersects with this rectangle.

Parameters
valueThe other rectangle for testing.
resulttrue if other Rectangle intersects with this rectangle; false otherwise. As an output parameter.

Definition at line 365 of file Rectangle.cs.

void Shift.Rectangle.Offset ( int  offsetX,
int  offsetY 
)
inline

Changes the Location of this Rectangle.

Parameters
offsetXThe x coordinate to add to this Rectangle.
offsetYThe y coordinate to add to this Rectangle.

Definition at line 413 of file Rectangle.cs.

void Shift.Rectangle.Offset ( float  offsetX,
float  offsetY 
)
inline

Changes the Location of this Rectangle.

Parameters
offsetXThe x coordinate to add to this Rectangle.
offsetYThe y coordinate to add to this Rectangle.

Definition at line 424 of file Rectangle.cs.

void Shift.Rectangle.Offset ( Point  amount)
inline

Changes the Location of this Rectangle.

Parameters
amountThe x and y components to add to this Rectangle.

Definition at line 434 of file Rectangle.cs.

void Shift.Rectangle.Offset ( Vector2  amount)
inline

Changes the Location of this Rectangle.

Parameters
amountThe x and y components to add to this Rectangle.

Definition at line 444 of file Rectangle.cs.

static implicit Shift.Rectangle.operator System.Drawing.Rectangle ( Rectangle  d)
inlinestatic

Definition at line 489 of file Rectangle.cs.

static bool Shift.Rectangle.operator!= ( Rectangle  a,
Rectangle  b 
)
inlinestatic

Compares whether two Rectangle instances are not equal.

Parameters
aRectangle instance on the left of the not equal sign.
bRectangle instance on the right of the not equal sign.
Returns
true if the instances are not equal; false otherwise.

Definition at line 204 of file Rectangle.cs.

static bool Shift.Rectangle.operator== ( Rectangle  a,
Rectangle  b 
)
inlinestatic

Compares whether two Rectangle instances are equal.

Parameters
aRectangle instance on the left of the equal sign.
bRectangle instance on the right of the equal sign.
Returns
true if the instances are equal; false otherwise.

Definition at line 193 of file Rectangle.cs.

override string Shift.Rectangle.ToString ( )
inline

Returns a String representation of this Rectangle in the format: {X:[X] Y:[Y] Width:[Width] Height:[Height]}

Returns
String representation of this Rectangle.

Definition at line 455 of file Rectangle.cs.

static Rectangle Shift.Rectangle.Union ( Rectangle  value1,
Rectangle  value2 
)
inlinestatic

Creates a new Rectangle that completely contains two other rectangles.

Parameters
value1The first Rectangle.
value2The second Rectangle.
Returns
The union of the two rectangles.

Definition at line 466 of file Rectangle.cs.

static void Shift.Rectangle.Union ( ref Rectangle  value1,
ref Rectangle  value2,
out Rectangle  result 
)
inlinestatic

Creates a new Rectangle that completely contains two other rectangles.

Parameters
value1The first Rectangle.
value2The second Rectangle.
resultThe union of the two rectangles as an output parameter.

Definition at line 481 of file Rectangle.cs.

Member Data Documentation

int Shift.Rectangle.Height

The height of this Rectangle.

Definition at line 51 of file Rectangle.cs.

readonly int Shift.Rectangle.SizeInBytes = System.Runtime.InteropServices.Marshal.SizeOf(new Rectangle())
static

Defines the size of the Rectangle struct in bytes.

Definition at line 17 of file Rectangle.cs.

int Shift.Rectangle.Width

The width of this Rectangle.

Definition at line 45 of file Rectangle.cs.

int Shift.Rectangle.X

The x coordinate of the top-left corner of this Rectangle.

Definition at line 33 of file Rectangle.cs.

int Shift.Rectangle.Y

The y coordinate of the top-left corner of this Rectangle.

Definition at line 39 of file Rectangle.cs.

Property Documentation

int Shift.Rectangle.Bottom
get

Returns the y coordinate of the bottom edge of this Rectangle.

Definition at line 81 of file Rectangle.cs.

Point Shift.Rectangle.Center
get

A Point located in the center of this Rectangle.

If Width or Height is an odd number, the center point will be rounded down.

Definition at line 137 of file Rectangle.cs.

Rectangle Shift.Rectangle.Empty
staticget

Returns a Rectangle with X=0, Y=0, Width=0, Height=0.

Definition at line 25 of file Rectangle.cs.

bool Shift.Rectangle.IsEmpty
get

Whether or not this Rectangle has a Width and Height of 0, and a Location of (0, 0).

Definition at line 90 of file Rectangle.cs.

int Shift.Rectangle.Left
get

Returns the x coordinate of the left edge of this Rectangle.

Definition at line 57 of file Rectangle.cs.

Point Shift.Rectangle.Location
getset

The top-left coordinates of this Rectangle.

Definition at line 101 of file Rectangle.cs.

int Shift.Rectangle.Right
get

Returns the x coordinate of the right edge of this Rectangle.

Definition at line 65 of file Rectangle.cs.

Point Shift.Rectangle.Size
getset

The width-height coordinates of this Rectangle.

Definition at line 117 of file Rectangle.cs.

int Shift.Rectangle.Top
get

Returns the y coordinate of the top edge of this Rectangle.

Definition at line 73 of file Rectangle.cs.


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