Rectangle
A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y) and by its width and its height.
The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of one property has no effect on the others. However, the right and bottom properties are integrally related to those four properties. For example, if you change the value of the right property, the value of the width property changes; if you change the bottom property, the value of the height property changes.
Can be created with method new:
Lib.Media.Geom.Rectangle.new(x, y, width, height) |
Creates a new Rectangle object with the top-left corner specified by the x and y parameters and with the specified width and height parameters. |
x - (default = 0) - The x coordinate of the top-left corner of the rectangle. y - (default = 0) - The y coordinate of the top-left corner of the rectangle. width - (default = 0) - The width of the rectangle, in pixels. height - (default = 0) - The height of the rectangle, in pixels. |
Created Rectangle object has properties:
bottom |
The sum of the y and height properties. |
bottomRight |
The location of the Rectangle object's bottom-right corner, determined by the values of the right and bottom properties. |
height |
The height of the rectangle, in pixels. |
left |
The x coordinate of the top-left corner of the rectangle. |
right |
The sum of the x and width properties. |
size |
The size of the Rectangle object, expressed as a Point object with the values of the width and height properties. |
top |
The y coordinate of the top-left corner of the rectangle. |
topLeft |
The location of the Rectangle object's top-left corner, determined by the x and y coordinates of the point. |
width |
The width of the rectangle, in pixels. |
x |
The x coordinate of the top-left corner of the rectangle. |
y |
The y coordinate of the top-left corner of the rectangle. |
methods:
clone() |
Returns a new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object. |
|
contains(x, y) |
Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. |
x - The x coordinate (horizontal position) of the point. y - The y coordinate (vertical position) of the point. |
containsPoint(point) |
Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. |
point - The point, as represented by its x and y coordinates. |
containsRect(rect) |
Determines whether the Rectangle object specified by the rect parameter is contained within this Rectangle object. |
rect - The Rectangle object being checked. |
copyFrom(sourceRect) |
Copies all of rectangle data from the source Rectangle object into the calling Rectangle object. |
sourceRect - The Rectangle object from which to copy the data. |
equals(toCompare) |
Determines whether the object specified in the toCompare parameter is equal to this Rectangle object. |
toCompare - The rectangle to compare to this Rectangle object. |
inflate(dx, dy) |
Increases the size of the Rectangle object by the specified amounts, in pixels. |
dx - The value to be added to the left and the right of the Rectangle object. The following equation is used to calculate the new width and position of the rectangle: x = x - dx width = width + 2 * dx dy - The value to be added to the top and the bottom of the Rectangle. The following equation is used to calculate the new height and position of the rectangle: y = y - dy height = height + 2 * dy |
inflatePoint(point) |
Increases the size of the Rectangle object. |
point - The x property of this Point object is used to increase the horizontal dimension of the Rectangle object. The y property is used to increase the vertical dimension of the Rectangle object. |
intersection(toIntersect) |
If the Rectangle object specified in the toIntersect parameter intersects with this Rectangle object, returns the area of intersection as a Rectangle object. |
toIntersect - The Rectangle object to compare against to see if it intersects with this Rectangle object. |
intersects(toIntersect) |
Determines whether the object specified in the toIntersect parameter intersects with this Rectangle object. |
toIntersect - The Rectangle object to compare against this Rectangle object. |
isEmpty() |
Determines whether or not this Rectangle object is empty. |
|
offset(dx, dy) |
Adjusts the location of the Rectangle object, as determined by its top-left corner, by the specified amounts. |
dx - Moves the x value of the Rectangle object by this amount. dy - Moves the y value of the Rectangle object by this amount. |
offsetPoint(point) |
Adjusts the location of the Rectangle object using a Point object as a parameter. |
point - A Point object to use to offset this Rectangle object. |
setEmpty() |
Sets all of the Rectangle object's properties to 0. |
|
setTo(xa, ya, widtha, heighta) |
Sets the members of Rectangle to the specified values |
xa - the values to set the rectangle to. ya widtha heighta |
toString() |
Builds and returns a string that lists the horizontal and vertical positions and the width and height of the Rectangle object. |
|
union(toUnion) |
Adds two rectangles together to create a new Rectangle object, by filling in the horizontal and vertical space between the two rectangles. |
toUnion - A Rectangle object to add to this Rectangle object. |
Created with the Personal Edition of HelpNDoc: Full-featured Kindle eBooks generator