public class PdfBrush extends Object implements Cloneable
// Create a page PdfPage page = new PdfPage(); // Create a brush and set its properties PdfBrush brush = new PdfBrush(); brush.fillColor = Color.RED; brush.brushPattern = PdfBrush.PATTERN_CROSS; // Create a pen and set its properties PdfPen pen = new PdfPen(); pen.capStyle = PdfPen.CAPSTYLE_ROUND; pen.miterLimit = PdfPen.DEFAULT_MITERLIMIT * 2; pen.width = PdfPen.DEFAULT_WIDTH * 50; pen.joinStyle = PdfPen.JOINSTYLE_BEVEL; pen.strokeColor = Color.GREEN; // Set the pen and brush to the page page.setBrush(brush); page.setPen(pen); // Render a PDF element on the page // with the pen and brush page.drawSquare(100, 100, 50, true, true); // Make some changes to the properties of the pen and brush brush.fillColor = Color.YELLOW; brush.brushPattern = PdfBrush.PATTERN_SOLID; pen.strokeColor = Color.RED; // Render another PDF element on the page // with the modified pend and brush page.drawCircle(300, 100, 50, true, true);
Modifier and Type | Field and Description |
---|---|
int |
brushPattern
Fill pattern used by the brush.
|
Color |
fillColor
Color used by the brush.
|
static int |
PATTERN_BACKWARD_DIAGONAL
Constant specfying the fill pattern consisting of vertical
lines with their tops angled to the right.
|
static int |
PATTERN_CROSS
Constant specfying the fill pattern that is a combination of
PATTERN_VERTICAL and PATTERN_HORIZONTAL . |
static int |
PATTERN_DIAGONAL_CROSS
Constant specfying the fill pattern that is a combination of
PATTERN_FORWARD_DIAGONAL and
PATTERN_BACKWARD_DIAGONAL . |
static int |
PATTERN_FORWARD_DIAGONAL
Constant specfying the fill pattern consisting of vertical
lines with their tops angled to the left.
|
static int |
PATTERN_HORIZONTAL
Constant specfying a fill pattern consisting of horizontal lines.
|
static int |
PATTERN_SOLID
Constant specfying the fill pattern that is made of solid
color.
|
static int |
PATTERN_VERTICAL
Constant specfying a fill pattern consisting of vertical lines.
|
public static final int PATTERN_HORIZONTAL
public static final int PATTERN_VERTICAL
public static final int PATTERN_FORWARD_DIAGONAL
public static final int PATTERN_BACKWARD_DIAGONAL
public static final int PATTERN_CROSS
PATTERN_VERTICAL
and PATTERN_HORIZONTAL
.public static final int PATTERN_DIAGONAL_CROSS
PATTERN_FORWARD_DIAGONAL
and
PATTERN_BACKWARD_DIAGONAL
.public static final int PATTERN_SOLID
public Color fillColor
public int brushPattern
public PdfBrush()
public PdfBrush(Color fillColor)