Struct BoxOf
2D box
struct BoxOf(T)
if (is(T == float) || is(T == int));
Constructors
Name | Description |
---|---|
this
(x, y, w, h)
|
Construct a box using x, y, width and height |
this
(p, sz)
|
Construct a box using position and size |
this
(rc)
|
Construct a box using Rect
|
Fields
Type | Name | Description |
---|---|---|
T |
h
|
Rectangle height |
T |
w
|
Rectangle width |
T |
x
|
x coordinate of the top left corner |
T |
y
|
y coordinate of the top left corner |
Methods
Name | Description |
---|---|
contains
(b)
|
Returns true if b is completely inside the box
|
contains
(pt)
|
Returns true if pt is inside the box
|
contains
(px, py)
|
Returns true if (px, py) point is inside the rectangle
|
containsX
(px)
|
Returns true if px is between left and right sides
|
containsY
(py)
|
Returns true if py is between top and bottom sides
|
empty
()
|
True if the box is empty |
expand
(ins)
|
Expand box dimensions by a margin |
expanded
(ins)
|
Return a box expanded by a margin |
from
(source)
|
Construct from a box with another base type via casting |
middle
()
|
The center point |
middleX
()
|
The midpoint of X side |
middleY
()
|
The midpoint of Y side |
moveToFit
(b)
|
Move this box to fit b bounds, retaining the same size
|
pos
()
|
Position as PointOf!T
|
shrink
(ins)
|
Shrink box dimensions by a margin |
shrinked
(ins)
|
Return a box shrinked by a margin |
size
()
|
Size as SizeOf!T
|
toString
()
|