Rectangle
specifies an area in a coordinate space that is enclosed by the Rectangle
object's upper-left point {@code (x,y)}in the coordinate space, its width, and its height. A Rectangle
object's width
and height
are public
fields. The constructors that create a Rectangle
, and the methods that can modify one, do not prevent setting a negative value for width or height.
Methods which affect only the location of a {@code Rectangle} willoperate on its location regardless of whether or not it has a negative or zero dimension along either axis.
Note that a {@code Rectangle} constructed with the default no-argumentconstructor will have dimensions of {@code 0x0} and therefore be empty.That {@code Rectangle} will still have a location of {@code (0,0)} andwill contribute that location to the union and add operations. Code attempting to accumulate the bounds of a set of points should therefore initially construct the {@code Rectangle} with a specificallynegative width and height or it should use the first point in the set to construct the {@code Rectangle}. For example:
Rectangle bounds = new Rectangle(0, 0, -1, -1); for (int i = 0; i < points.length; i++) { bounds.add(points[i]); }or if we know that the points array contains at least one point:
Rectangle bounds = new Rectangle(points[0]); for (int i = 1; i < points.length; i++) { bounds.add(points[i]); }
This class uses 32-bit integers to store its location and dimensions. Frequently operations may produce a result that exceeds the range of a 32-bit integer. The methods will calculate their results in a way that avoids any 32-bit overflow for intermediate results and then choose the best representation to store the final results back into the 32-bit fields which hold the location and dimensions. The location of the result will be stored into the {@link #x} and{@link #y} fields by clipping the true result to the nearest 32-bit value.The values stored into the {@link #width} and {@link #height} dimensionfields will be chosen as the 32-bit values that encompass the largest part of the true result as possible. Generally this means that the dimension will be clipped independently to the range of 32-bit integers except that if the location had to be moved to store it into its pair of 32-bit fields then the dimensions will be adjusted relative to the "best representation" of the location. If the true result had a negative dimension and was therefore non-existant along one or both axes, the stored dimensions will be negative numbers in those axes. If the true result had a location that could be represented within the range of 32-bit integers, but zero dimension along one or both axes, then the stored dimensions will be zero in those axes. @author Sami Shaio @since 1.0
Rectangle
is the representation of a geometric figure. Rectangles support constant width borders using {@link #setBorderWidth(float)}and {@link #setBorder(int)}. They also support borders that vary in width/color on each side using methods like {@link #setBorderWidthLeft(float)}or {@link #setBorderColorLeft(BaseColor)}.
@see Element
Rectangle
is the representation of a geometric figure. Rectangles support constant width borders using {@link #setBorderWidth(float)}and {@link #setBorder(int)}. They also support borders that vary in width/color on each side using methods like {@link #setBorderWidthLeft(float)}or {@link #setBorderColorLeft(java.awt.Color)}.
@see Element
@see Table
@see Cell
@see HeaderFooter
java.awt.rectangle
works with double's, this is by a text based terminal senseless.
NOTE: This API is still in flux and might change in incompatible ways in the next release.
Implementation of the Paintable
interface for drawing rectangles. It is only usefull as a rendering object, do not use this as a bounding box.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|