Public Types | |
typedef centreX | centerX |
typedef centreY | centerY |
typedef centreOn | centerOn |
typedef centreXOn | centerXOn |
typedef centreYOn | centerYOn |
Public Member Functions | |
void | centreOn (Rect r) |
Moves this rectangle's centre to be the same as that of r . | |
void | centreOn (Rect r, int w, int h) |
Sets this rectangle's centre and dimensions. | |
void | centreOn (Rect r, RectDim dim) |
Sets this rectangle's centre and dimensions. | |
void | centreXOn (Rect r, int w) |
Sets this rectangle's horizontal centre and width. | |
void | centreYOn (Rect r, int h) |
Sets this rectangle's vertical centre and height. | |
void | clipTo (Rect r) |
Clips this rectangle to the bounds of r. | |
bool | contains (Point p) |
Determines whether this rectangle contains the given point. | |
bool | contains (Rect r) |
Determines whether this rectangle completely contains the given rectangle. | |
bool | overlaps (Rect r) |
Determines whether this rectangle completely overlaps the given rectangle. | |
void | border (int width) |
Enlarges or reduces this rectangle by a specified amount, as if to add or subtract a border. | |
void | border (int x, int y) |
Enlarges or reduces this rectangle by a specified amount, as if to add or subtract a border. | |
Properties | |
string | toString () |
Returns a string representation of this Rect. | |
int | width () |
The width of this rectangle. | |
int | width (int w) |
Sets the width of this rectangle, by changing right and leaving left unchanged. | |
int | height () |
The height of this rectangle. | |
int | height (int h) |
Sets the height of this rectangle, by changing bottom and leaving top unchanged. | |
RectDim | dim () |
The dimensions of this rectangle. | |
RectDim | dim (RectDim d) |
Sets the dimensions of this rectangle by changing bottom and right , leaving top and left unchanged. | |
Point | bottomLeft () |
The bottom-left corner of this rectangle. | |
Point | bottomLeft (Point p) |
The bottom-left corner of this rectangle. | |
Point | topRight () |
The top-right corner of this rectangle. | |
Point | topRight (Point p) |
The top-right corner of this rectangle. | |
int | centreX () |
The horizontal coordinate of this rectangle's centre. | |
int | centreX (int x) |
Sets the horizontal coordinate of this rectangle's centre. | |
int | centreY () |
The vertical coordinate of this rectangle's centre. | |
int | centreY (int y) |
Sets the vertical coordinate of this rectangle's centre. | |
long | area () |
The area of this rectangle. | |
bool | isNormal () |
Checks whether this rectangle is 'normal'. | |
Operators | |
{ Returns the intersection of this rectangle with another rectangle. | |
Rect | opAnd (Rect r) |
Static Public Member Functions | |
static Rect | desktopArea () |
The Windows desktop area. | |
Pseudo-Constructors | |
static Rect | opCall (int l, int t, int r, int b) |
Constructs a Rect with the given extremities. | |
static Rect | opCall (Point tl, Point br) |
Constructs a Rect with the given opposite corners. | |
static Rect | opCall (Point tl, RectDim dim) |
Constructs a Rect with the given position and dimensions. | |
Public Attributes | |
RECT | rect |
This rectangle as a Windows RECT structure. | |
int | left |
int | top |
int | right |
int | bottom |
Point | topLeft |
Point | bottomRight |
Examples are:
left
and top
are just inside the rectangle, whereas right
and bottom
are just outside it. This interpretation provides compatibility with the Windows API, and makes for simple, efficient operations without fencepost errors.
It is called Rect
to avoid confusion with the Windows API function Rectangle
.
This type is a wrapper around the Windows API RECT
structure,
typedef centreX smjg.libs.sdwf.geometry.Rect.centerX |
typedef centreY smjg.libs.sdwf.geometry.Rect.centerY |
typedef centreOn smjg.libs.sdwf.geometry.Rect.centerOn |
typedef centreXOn smjg.libs.sdwf.geometry.Rect.centerXOn |
typedef centreYOn smjg.libs.sdwf.geometry.Rect.centerYOn |
static Rect smjg.libs.sdwf.geometry.Rect.desktopArea | ( | ) | [static] |
The Windows desktop area.
This is the screen area minus the taskbar, if the taskbar is always on top. Otherwise, it is the entire screen area. It is useful for positioning a window.
static Rect smjg.libs.sdwf.geometry.Rect.opCall | ( | int | l, | |
int | t, | |||
int | r, | |||
int | b | |||
) | [static] |
string smjg.libs.sdwf.geometry.Rect.toString | ( | ) |
Returns a string representation of this Rect.
int smjg.libs.sdwf.geometry.Rect.width | ( | ) |
The width of this rectangle.
int smjg.libs.sdwf.geometry.Rect.width | ( | int | w | ) |
Sets the width of this rectangle, by changing right
and leaving left
unchanged.
int smjg.libs.sdwf.geometry.Rect.height | ( | ) |
The height of this rectangle.
int smjg.libs.sdwf.geometry.Rect.height | ( | int | h | ) |
Sets the height of this rectangle, by changing bottom
and leaving top
unchanged.
RectDim smjg.libs.sdwf.geometry.Rect.dim | ( | ) |
The dimensions of this rectangle.
Sets the dimensions of this rectangle by changing bottom
and right
, leaving top
and left
unchanged.
Point smjg.libs.sdwf.geometry.Rect.bottomLeft | ( | ) |
The bottom-left corner of this rectangle.
Point smjg.libs.sdwf.geometry.Rect.topRight | ( | ) |
The top-right corner of this rectangle.
int smjg.libs.sdwf.geometry.Rect.centreX | ( | ) |
The horizontal coordinate of this rectangle's centre.
int smjg.libs.sdwf.geometry.Rect.centreX | ( | int | x | ) |
Sets the horizontal coordinate of this rectangle's centre.
The rectangle's dimensions remain unchanged.
int smjg.libs.sdwf.geometry.Rect.centreY | ( | ) |
The vertical coordinate of this rectangle's centre.
int smjg.libs.sdwf.geometry.Rect.centreY | ( | int | y | ) |
Sets the vertical coordinate of this rectangle's centre.
The rectangle's dimensions remain unchanged.
long smjg.libs.sdwf.geometry.Rect.area | ( | ) |
The area of this rectangle.
bool smjg.libs.sdwf.geometry.Rect.isNormal | ( | ) |
Checks whether this rectangle is 'normal'.
left <= right
and top <= bottom
.void smjg.libs.sdwf.geometry.Rect.centreOn | ( | Rect | r | ) |
Moves this rectangle's centre to be the same as that of r
.
Does not alter the rectangle's dimensions.
void smjg.libs.sdwf.geometry.Rect.centreOn | ( | Rect | r, | |
int | w, | |||
int | h | |||
) |
Sets this rectangle's centre and dimensions.
r | the rectangle whose centre is to be used. | |
w | the new width. | |
h | the new height. |
Sets this rectangle's centre and dimensions.
r | the rectangle whose centre is to be used. | |
dim | the rectangle's new dimensions. |
void smjg.libs.sdwf.geometry.Rect.centreXOn | ( | Rect | r, | |
int | w | |||
) |
Sets this rectangle's horizontal centre and width.
r | the rectangle whose horizontal centre is to be used. | |
w | the new width. |
void smjg.libs.sdwf.geometry.Rect.centreYOn | ( | Rect | r, | |
int | h | |||
) |
Sets this rectangle's vertical centre and height.
r | the rectangle whose vertical centre is to be used. | |
h | the new height. |
void smjg.libs.sdwf.geometry.Rect.clipTo | ( | Rect | r | ) |
Clips this rectangle to the bounds of r.
bool smjg.libs.sdwf.geometry.Rect.contains | ( | Point | p | ) |
Determines whether this rectangle contains the given point.
Considers left
and top
to be just inside, and right
and bottom
to be just outside.
p | point to check. |
p
is within this rectangle.bool smjg.libs.sdwf.geometry.Rect.contains | ( | Rect | r | ) |
Determines whether this rectangle completely contains the given rectangle.
r
are 'normal'.r | rectangle to check. |
r
is completely contained within this rectangle.bool smjg.libs.sdwf.geometry.Rect.overlaps | ( | Rect | r | ) |
Determines whether this rectangle completely overlaps the given rectangle.
r
are 'normal'.r | rectangle to check. |
r
has any area in common with this rectangle.void smjg.libs.sdwf.geometry.Rect.border | ( | int | width | ) |
Enlarges or reduces this rectangle by a specified amount, as if to add or subtract a border.
width | value by which to adjust each side of the rectangle. |
r.left < r.right
and r.top < r.bottom
.void smjg.libs.sdwf.geometry.Rect.border | ( | int | x, | |
int | y | |||
) |
Enlarges or reduces this rectangle by a specified amount, as if to add or subtract a border.
x | value by which to adjust the left and right sides. | |
y | value by which to adjust the top and bottom sides. |
r.left < r.right
and r.top < r.bottom
.
This rectangle as a Windows RECT
structure.