Package org.openpdf.text
Class Rectangle
java.lang.Object
org.openpdf.text.Rectangle
- All Implemented Interfaces:
Element
- Direct Known Subclasses:
Image,RectangleReadOnly
A
Rectangle is the representation of a geometric figure.
Rectangles support constant width borders using setBorderWidth(float) and setBorder(int). They also
support borders that vary in width/color on each side using methods like setBorderWidthLeft(float) or
setBorderColorLeft(java.awt.Color).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ColorThis is the color of the background of this rectangle.protected intThis represents the status of the 4 sides of the rectangle.protected ColorThe color of the border of this rectangle.protected ColorThe color of the bottom border of this rectangle.protected ColorThe color of the left border of this rectangle.protected ColorThe color of the right border of this rectangle.protected ColorThe color of the top border of this rectangle.protected floatThis is the width of the border around this rectangle.protected floatThe width of the bottom border of this rectangle.protected floatThe width of the left border of this rectangle.protected floatThe width of the right border of this rectangle.protected floatThe width of the top border of this rectangle.static final intThis represents one side of the border of theRectangle.static final intThis represents a type of border.static final intThis represents one side of the border of theRectangle.protected floatthe lower left x-coordinate.protected floatthe lower left y-coordinate.static final intThis represents a rectangle without borders.static final intThis represents one side of the border of theRectangle.protected intThe rotation of the Rectanglestatic final intThis represents one side of the border of theRectangle.static final intThis is the value that will be used as undefined .protected floatthe upper right x-coordinate.protected floatthe upper right y-coordinate.protected booleanWhether variable width/color borders are used.Fields inherited from interface org.openpdf.text.Element
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, KEYWORDS, MARKED, MODIFICATIONDATE, PRODUCER, RECTANGLE, SUBJECT, TABLE, TITLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCopies each of the parameters, except the position, from aRectangleobjectGets the backgroundcolor.Gets the color of the border.Gets the color of the bottom border.Gets the color of the left border.Gets the color of the right border.Gets the color of the top border.floatGets the borderwidth.floatGets the width of the bottom border.floatGets the width of the left border.floatGets the width of the right border.floatGets the width of the top border.floatReturns the lower left y-coordinate.floatReturns the height of the rectangle.floatgetLeft()Returns the lower left x-coordinate.floatgetRight()Returns the upper right x-coordinate.intGets the rotation of the rectanglefloatgetTop()Returns the upper right y-coordinate.floatgetWidth()Returns the width of the rectangle.booleanhasBorder(int type) Indicates whether the specified type of border is set.booleanIndicates whether some type of border is set.booleanChecks if this element is a content object.booleanChecks if this element is nestable.booleanIndicates whether variable width borders are being used.voidsetBottom(float lly) Sets the lower left y-coordinate.voidsetLeft(float llx) Sets the lower left x-coordinate.voidsetRight(float urx) Sets the upper right x-coordinate.voidsetTop(float ury) Sets the upper right y-coordinate.toString()Gets the content of the text element.inttype()Gets the type of the text element.
-
Field Details
-
UNDEFINED
public static final int UNDEFINEDThis is the value that will be used as undefined .- See Also:
-
TOP
public static final int TOPThis represents one side of the border of theRectangle.- See Also:
-
BOTTOM
public static final int BOTTOMThis represents one side of the border of theRectangle.- See Also:
-
LEFT
public static final int LEFTThis represents one side of the border of theRectangle.- See Also:
-
RIGHT
public static final int RIGHTThis represents one side of the border of theRectangle.- See Also:
-
NO_BORDER
public static final int NO_BORDERThis represents a rectangle without borders.- See Also:
-
BOX
public static final int BOXThis represents a type of border.- See Also:
-
llx
protected float llxthe lower left x-coordinate. -
lly
protected float llythe lower left y-coordinate. -
urx
protected float urxthe upper right x-coordinate. -
ury
protected float urythe upper right y-coordinate. -
rotation
protected int rotationThe rotation of the Rectangle -
backgroundColor
This is the color of the background of this rectangle. -
border
protected int borderThis represents the status of the 4 sides of the rectangle. -
useVariableBorders
protected boolean useVariableBordersWhether variable width/color borders are used. -
borderWidth
protected float borderWidthThis is the width of the border around this rectangle. -
borderWidthLeft
protected float borderWidthLeftThe width of the left border of this rectangle. -
borderWidthRight
protected float borderWidthRightThe width of the right border of this rectangle. -
borderWidthTop
protected float borderWidthTopThe width of the top border of this rectangle. -
borderWidthBottom
protected float borderWidthBottomThe width of the bottom border of this rectangle. -
borderColor
The color of the border of this rectangle. -
borderColorLeft
The color of the left border of this rectangle. -
borderColorRight
The color of the right border of this rectangle. -
borderColorTop
The color of the top border of this rectangle. -
borderColorBottom
The color of the bottom border of this rectangle.
-
-
Constructor Details
-
Rectangle
public Rectangle(float llx, float lly, float urx, float ury) Constructs aRectangle-object.- Parameters:
llx- lower left xlly- lower left yurx- upper right xury- upper right y
-
Rectangle
public Rectangle(float urx, float ury) Constructs aRectangle-object starting from the origin (0, 0).- Parameters:
urx- upper right xury- upper right y
-
Rectangle
Constructs aRectangle-object.- Parameters:
rect- anotherRectangle
-
-
Method Details
-
type
public int type()Gets the type of the text element. -
isContent
public boolean isContent()Description copied from interface:ElementChecks if this element is a content object. If not, it's a metadata object. -
isNestable
public boolean isNestable()Description copied from interface:ElementChecks if this element is nestable.- Specified by:
isNestablein interfaceElement- Returns:
- true if this element can be nested inside other elements.
- Since:
- iText 2.0.8
- See Also:
-
getLeft
public float getLeft()Returns the lower left x-coordinate.- Returns:
- the lower left x-coordinate
-
setLeft
public void setLeft(float llx) Sets the lower left x-coordinate.- Parameters:
llx- the new value
-
getRight
public float getRight()Returns the upper right x-coordinate.- Returns:
- the upper right x-coordinate
-
setRight
public void setRight(float urx) Sets the upper right x-coordinate.- Parameters:
urx- the new value
-
getWidth
public float getWidth()Returns the width of the rectangle.- Returns:
- the width
-
getTop
public float getTop()Returns the upper right y-coordinate.- Returns:
- the upper right y-coordinate
-
setTop
public void setTop(float ury) Sets the upper right y-coordinate.- Parameters:
ury- the new value
-
getBottom
public float getBottom()Returns the lower left y-coordinate.- Returns:
- the lower left y-coordinate
-
setBottom
public void setBottom(float lly) Sets the lower left y-coordinate.- Parameters:
lly- the new value
-
getHeight
public float getHeight()Returns the height of the rectangle.- Returns:
- the height
-
getRotation
public int getRotation()Gets the rotation of the rectangle- Returns:
- a rotation value
-
getBackgroundColor
Gets the backgroundcolor.- Returns:
- a
Color
-
hasBorders
public boolean hasBorders()Indicates whether some type of border is set.- Returns:
- a boolean
-
hasBorder
public boolean hasBorder(int type) Indicates whether the specified type of border is set.- Parameters:
type- the type of border- Returns:
- a boolean
-
isUseVariableBorders
public boolean isUseVariableBorders()Indicates whether variable width borders are being used. Returns true ifsetBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, or setBorderWidthBottomhas been called.- Returns:
- true if variable width borders are in use
-
getBorderWidth
public float getBorderWidth()Gets the borderwidth.- Returns:
- a value
-
getBorderWidthLeft
public float getBorderWidthLeft()Gets the width of the left border.- Returns:
- a width
-
getBorderWidthRight
public float getBorderWidthRight()Gets the width of the right border.- Returns:
- a width
-
getBorderWidthTop
public float getBorderWidthTop()Gets the width of the top border.- Returns:
- a width
-
getBorderWidthBottom
public float getBorderWidthBottom()Gets the width of the bottom border.- Returns:
- a width
-
getBorderColor
Gets the color of the border.- Returns:
- a
Color
-
getBorderColorLeft
Gets the color of the left border.- Returns:
- a
Color
-
getBorderColorRight
Gets the color of the right border.- Returns:
- a
Color
-
getBorderColorTop
Gets the color of the top border.- Returns:
- a
Color
-
getBorderColorBottom
Gets the color of the bottom border.- Returns:
- a
Color
-
cloneNonPositionParameters
Copies each of the parameters, except the position, from aRectangleobject- Parameters:
rect-Rectangleto copy from
-
toString
Description copied from interface:ElementGets the content of the text element.
-