A class for manipulating rectangles.
None
Creates a Rect object from x, y, width and height values.
Rect.new(%(arg-type)Point% topLeft, Point bottomRight)Creates a Rect object from top-left and bottom-right points.
Rect.new(%(arg-type)Point% pos, Size size)Creates a Rect object from position and size values.
Rect.new(%(arg-type)Size% size)Creates a Rect object from size values at the origin.
intx
x coordinate of the top-level corner of the rectangle.
inty
y coordinate of the top-level corner of the rectangle.
intwidth
Width member.
intheight
Height member.
Returns the rectangle having the same size as this one but centered relatively
to the given rectangle r. By default, rectangle is centred in both
directions but if dir includes only VERTICAL
or only
HORIZONTAL
flag, then it is only centered in this direction while
the other component of its position remains unchanged.
Returns true
if the given point is inside the rectangle (or on its
boundary) and false
otherwise.
Returns if the given rectangle is completely inside this rectangle
(or touches its boundary) and otherwise.
Decrease the rectangle size.
This method is the opposite from Inflate:
Deflate(a, b) is equivalent to Inflate(-a, -b).
Please refer to Inflate for full description.
Gets the bottom point of the rectangle.
Gets the height member.
Gets the left point of the rectangle (the same as Rect#get_x).
Gets the position.
Gets the position of the top left corner of the rectangle, same as
get_position.
Gets the position of the top right corner.
Gets the position of the bottom left corner.
Gets the position of the bottom right corner.
Gets the right point of the rectangle.
Gets the size.
Gets the top point of the rectangle (the same as Rect#get_y).
Gets the width member.
Gets the x member.
Gets the y member.
Increases the size of the rectangle.
The second form uses the same diff for both dx and dy.
The first two versions modify the rectangle in place, the last one returns a
new rectangle leaving this one unchanged.
The left border is moved farther left and the right border is moved farther
right by dx. The upper border is moved farther up and the bottom border
is moved farther down by dy_. (Note the the width and height of the
rectangle thus change by 2*_dx and 2*_dy_, respectively.) If one or
both of dx and dy are negative, the opposite happens: the rectangle
size decreases in the respective direction.
Inflating and deflating behaves ``naturally’’. Defined more precisely, that
means:
Returns true
if this rectangle has a non-empty intersection with the
rectangle rect and false
otherwise.
Returns true
if this rectangle has a width or height less than or equal to
0 and false
otherwise.
Moves the rectangle by the specified offset. If dx is positive, the
rectangle is moved to the right, if dy is positive, it is moved to the
bottom, otherwise it is moved to the left or top respectively.
Sets the height.
Sets the size.
Sets the width.
Sets the x position.
Sets the y position.
Modifies the rectangle to contain the bounding box of this rectangle and the
one passed in as parameter. The const version returns the new rectangle, the
other one modifies this rectangle in place.
Assignment operator.
Equality operator.
Inequality operator.
[This page automatically generated from the Textile source at 2023-06-03 08:07:41 +0000]