public abstract class Border extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Border.Side
Enumerates the different sides of the rectangle.
|
Modifier and Type | Field and Description |
---|---|
static int |
_3D_GROOVE
The 3D groove border.
|
static int |
_3D_INSET
The 3D inset border.
|
static int |
_3D_OUTSET
The 3D outset border.
|
static int |
_3D_RIDGE
The 3D ridge border.
|
static int |
DASHED
The dashed border.
|
static int |
DASHED_FIXED
The fixed dashed border.
|
static int |
DOTTED
The dotted border.
|
static int |
DOUBLE
The double border.
|
static Border |
NO_BORDER
The null Border, i.e.
|
static int |
ROUND_DOTS
The round-dots border.
|
static int |
SOLID
The solid border.
|
protected TransparentColor |
transparentColor
The color of the border.
|
protected int |
type
The type of the border.
|
protected float |
width
The width of the border.
|
Modifier | Constructor and Description |
---|---|
protected |
Border(Color color,
float width)
|
protected |
Border(Color color,
float width,
float opacity)
|
protected |
Border(float width)
Creates a
border with the given width. |
Modifier and Type | Method and Description |
---|---|
abstract void |
draw(PdfCanvas canvas,
float x1,
float y1,
float x2,
float y2,
Border.Side defaultSide,
float borderWidthBefore,
float borderWidthAfter)
All borders are supposed to be drawn in such way, that inner content of the element is on the right from the
drawing direction.
|
void |
draw(PdfCanvas canvas,
float x1,
float y1,
float x2,
float y2,
float borderRadius,
Border.Side defaultSide,
float borderWidthBefore,
float borderWidthAfter)
All borders are supposed to be drawn in such way, that inner content of the element is on the right from the
drawing direction.
|
void |
draw(PdfCanvas canvas,
float x1,
float y1,
float x2,
float y2,
float horizontalRadius1,
float verticalRadius1,
float horizontalRadius2,
float verticalRadius2,
Border.Side defaultSide,
float borderWidthBefore,
float borderWidthAfter)
All borders are supposed to be drawn in such way, that inner content of the element is on the right from the
drawing direction.
|
void |
draw(PdfCanvas canvas,
Rectangle rectangle)
Draw borders around the target rectangle.
|
abstract void |
drawCellBorder(PdfCanvas canvas,
float x1,
float y1,
float x2,
float y2,
Border.Side defaultSide)
Draws the border of a cell.
|
protected void |
drawDiscontinuousBorders(PdfCanvas canvas,
Rectangle boundingRectangle,
float[] horizontalRadii,
float[] verticalRadii,
Border.Side defaultSide,
float borderWidthBefore,
float borderWidthAfter)
Perform drawing operations to draw discontinuous borders.
|
boolean |
equals(Object anObject)
Indicates whether the border is equal to the given border.
|
protected Border.Side |
getBorderSide(float x1,
float y1,
float x2,
float y2,
Border.Side defaultSide)
Returns the
side corresponded to the line between two points. |
Color |
getColor()
|
protected float |
getDotsGap(double distance,
float initialGap)
Adjusts the size of the gap between dots
|
protected Point |
getIntersectionPoint(Point lineBeg,
Point lineEnd,
Point clipLineBeg,
Point clipLineEnd) |
float |
getOpacity()
Gets the opacity of the
border |
protected float[] |
getStartingPointsForBorderSide(float x1,
float y1,
float x2,
float y2,
Border.Side defaultSide)
Calculate adjusted starting points for discontinuous borders, given two opposing points (A and B) that define the bounding rectangle
|
abstract int |
getType()
Returns the type of the
border |
float |
getWidth()
Gets the width of the
border |
int |
hashCode() |
void |
setColor(Color color)
|
void |
setWidth(float width)
Sets the width of the
border |
public static final Border NO_BORDER
public static final int SOLID
SolidBorder
,
Constant Field Valuespublic static final int DASHED
DashedBorder
,
Constant Field Valuespublic static final int DOTTED
DottedBorder
,
Constant Field Valuespublic static final int DOUBLE
DoubleBorder
,
Constant Field Valuespublic static final int ROUND_DOTS
RoundDotsBorder
,
Constant Field Valuespublic static final int _3D_GROOVE
GrooveBorder
,
Constant Field Valuespublic static final int _3D_INSET
InsetBorder
,
Constant Field Valuespublic static final int _3D_OUTSET
OutsetBorder
,
Constant Field Valuespublic static final int _3D_RIDGE
RidgeBorder
,
Constant Field Valuespublic static final int DASHED_FIXED
FixedDashedBorder
,
Constant Field Valuesprotected TransparentColor transparentColor
TransparentColor
protected float width
protected int type
protected Border(float width)
width
- the width which the border should haveprotected Border(Color color, float width)
color
- the color which the border should havewidth
- the width which the border should haveprotected Border(Color color, float width, float opacity)
color
- the color which the border should havewidth
- the width which the border should haveopacity
- the opacity which border should have; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparentpublic abstract void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
Given points specify the line which lies on the border of the content area, therefore the border itself should be drawn to the left from the drawing direction.
borderWidthBefore
and borderWidthAfter
parameters are used to
define the widths of the borders that are before and after the current border, e.g. for
the bottom border, borderWidthBefore
specifies width of the right border and
borderWidthAfter
- width of the left border. Those width are used to handle areas
of border joins.
canvas
- PdfCanvas to be written tox1
- x coordinate of the beginning point of the element side, that should be borderedy1
- y coordinate of the beginning point of the element side, that should be borderedx2
- x coordinate of the ending point of the element side, that should be borderedy2
- y coordinate of the ending point of the element side, that should be bordereddefaultSide
- the Border.Side
, that we will fallback to, if it cannot be determined by border coordinatesborderWidthBefore
- defines width of the border that is before the current oneborderWidthAfter
- defines width of the border that is after the current onepublic void draw(PdfCanvas canvas, Rectangle rectangle)
canvas
- PdfCanvas to be written torectangle
- border positions rectanglepublic void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float borderRadius, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
Given points specify the line which lies on the border of the content area, therefore the border itself should be drawn to the left from the drawing direction.
borderWidthBefore
and borderWidthAfter
parameters are used to
define the widths of the borders that are before and after the current border, e.g. for
the bottom border, borderWidthBefore
specifies width of the right border and
borderWidthAfter
- width of the left border. Those width are used to handle areas
of border joins.
borderRadius
is used to draw rounded borders.
canvas
- PdfCanvas to be written tox1
- x coordinate of the beginning point of the element side, that should be borderedy1
- y coordinate of the beginning point of the element side, that should be borderedx2
- x coordinate of the ending point of the element side, that should be borderedy2
- y coordinate of the ending point of the element side, that should be borderedborderRadius
- defines the radius of the element's cornersdefaultSide
- the Border.Side
, that we will fallback to, if it cannot be determined by border coordinatesborderWidthBefore
- defines width of the border that is before the current oneborderWidthAfter
- defines width of the border that is after the current onepublic void draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float horizontalRadius1, float verticalRadius1, float horizontalRadius2, float verticalRadius2, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
Given points specify the line which lies on the border of the content area, therefore the border itself should be drawn to the left from the drawing direction.
borderWidthBefore
and borderWidthAfter
parameters are used to
define the widths of the borders that are before and after the current border, e.g. for
the bottom border, borderWidthBefore
specifies width of the right border and
borderWidthAfter
- width of the left border. Those width are used to handle areas
of border joins.
horizontalRadius1
, verticalRadius1
, horizontalRadius2
and verticalRadius2
are used to draw rounded borders.
canvas
- PdfCanvas to be written tox1
- x coordinate of the beginning point of the element side, that should be borderedy1
- y coordinate of the beginning point of the element side, that should be borderedx2
- x coordinate of the ending point of the element side, that should be borderedy2
- y coordinate of the ending point of the element side, that should be borderedhorizontalRadius1
- defines the horizontal radius of the border's first cornerverticalRadius1
- defines the vertical radius of the border's first cornerhorizontalRadius2
- defines the horizontal radius of the border's second cornerverticalRadius2
- defines the vertical radius of the border's second cornerdefaultSide
- the Border.Side
, that we will fallback to, if it cannot be determined by border coordinatesborderWidthBefore
- defines width of the border that is before the current oneborderWidthAfter
- defines width of the border that is after the current onepublic abstract void drawCellBorder(PdfCanvas canvas, float x1, float y1, float x2, float y2, Border.Side defaultSide)
canvas
- PdfCanvas to be written tox1
- x coordinate of the beginning point of the element side, that should be borderedy1
- y coordinate of the beginning point of the element side, that should be borderedx2
- x coordinate of the ending point of the element side, that should be borderedy2
- y coordinate of the ending point of the element side, that should be bordereddefaultSide
- the Border.Side
, that we will fallback to, if it cannot be determined by border coordinatespublic abstract int getType()
border
public float getOpacity()
border
public float getWidth()
border
public void setColor(Color color)
color
- The colorpublic void setWidth(float width)
border
width
- The widthpublic boolean equals(Object anObject)
protected Border.Side getBorderSide(float x1, float y1, float x2, float y2, Border.Side defaultSide)
side
corresponded to the line between two points.
Notice that we consider the rectangle traversal to be clockwise.
In case side couldn't be detected we will fallback to default sidex1
- the abscissa of the left-bottom pointy1
- the ordinate of the left-bottom pointx2
- the abscissa of the right-top pointy2
- the ordinate of the right-top pointdefaultSide
- the default side of borderside
protected Point getIntersectionPoint(Point lineBeg, Point lineEnd, Point clipLineBeg, Point clipLineEnd)
protected float getDotsGap(double distance, float initialGap)
distance
- the border
lengthinitialGap
- the initial size of the gapprotected void drawDiscontinuousBorders(PdfCanvas canvas, Rectangle boundingRectangle, float[] horizontalRadii, float[] verticalRadii, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
DashedBorder
, DottedBorder
and RoundDotsBorder
.canvas
- canvas to draw onboundingRectangle
- rectangle representing the bounding box of the drawing operationshorizontalRadii
- the horizontal radius of the border's two cornersverticalRadii
- the vertical radius of the border's two cornersdefaultSide
- the Border.Side
, that we will fallback to, if it cannot be determined by border coordinatesborderWidthBefore
- defines width of the border that is before the current oneborderWidthAfter
- defines width of the border that is after the current oneprotected float[] getStartingPointsForBorderSide(float x1, float y1, float x2, float y2, Border.Side defaultSide)
x1
- x-coordinate of point Ay1
- y-ordinate of point Ax2
- x-coordinate of point By2
- y-ordinate of point BdefaultSide
- default side of the border used to determine the side given by points A and BCopyright © 1998–2021 iText Group NV. All rights reserved.