Gnostice PDFOne
Pro. Ed. v5.0.0


com.gnostice.pdfone.graphics
Class PdfPen

java.lang.Object
  extended bycom.gnostice.pdfone.graphics.PdfPen
All Implemented Interfaces:
Cloneable

public class PdfPen
extends Object
implements Cloneable

This class represents the pen with which text and shapes are stroked.

// 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);

See Also:
PdfBrush
Sample Code
See example.

Field Summary
 int capStyle
          Line-end style for strokes made by the pen.
static int CAPSTYLE_BUTT
          Constant specifying lines whose ends are squared off without any projection.
static int CAPSTYLE_PROJECTING_SQUARE
          Constant specifying lines whose ends are projected to a distance that is half the width of the line.
static int CAPSTYLE_ROUND
          Constant specifying lines whose ends are rounded off.
 float[] dashArray
           
 double dashGap
           
 double dashLength
           
 double dashPhase
           
static int DEFAULT_MITERLIMIT
          Constant for a miter limit that specifies that the miter length can be at most 10 times the line width.
static double DEFAULT_WIDTH
          Constant specifying a line width that is 1/10th of applicable measurement unit.
 int joinStyle
          Line-join style for strokes made by the pen.
static int JOINSTYLE_BEVEL
          Constant specifying line-join style where the ends are squared of with CAPSTYLE_BUTT style.
static int JOINSTYLE_MITER
          Constant specifying line-join style where the outer edges of the lines are projected until they meet.
static int JOINSTYLE_ROUND
          Constant specifying line-join style where the join is rounded off with an arc whose center is at the point where the lines meet and the diameter is equal to the width of the line.
 double miterLimit
          Ratio of the length of the miter and the line width for this pen.
 Color strokeColor
          Color of the strokes made by the pen.
 double width
          Width of the strokes made by the pen.
 
Constructor Summary
PdfPen()
           
PdfPen(Color strokeColor)
           
 
Method Summary
 Object clone()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH

public static final double DEFAULT_WIDTH
Constant specifying a line width that is 1/10th of applicable measurement unit.

See Also:
Constant Field Values

DEFAULT_MITERLIMIT

public static final int DEFAULT_MITERLIMIT
Constant for a miter limit that specifies that the miter length can be at most 10 times the line width.

See Also:
Constant Field Values

CAPSTYLE_BUTT

public static final int CAPSTYLE_BUTT
Constant specifying lines whose ends are squared off without any projection.

See Also:
Constant Field Values

CAPSTYLE_ROUND

public static final int CAPSTYLE_ROUND
Constant specifying lines whose ends are rounded off.

See Also:
Constant Field Values

CAPSTYLE_PROJECTING_SQUARE

public static final int CAPSTYLE_PROJECTING_SQUARE
Constant specifying lines whose ends are projected to a distance that is half the width of the line.

See Also:
Constant Field Values

JOINSTYLE_MITER

public static final int JOINSTYLE_MITER
Constant specifying line-join style where the outer edges of the lines are projected until they meet. When lines meet at very sharp angles, the miter can be very long and a or @link #JOINSTYLE_ROUND is recommended.

See Also:
Constant Field Values

JOINSTYLE_ROUND

public static final int JOINSTYLE_ROUND
Constant specifying line-join style where the join is rounded off with an arc whose center is at the point where the lines meet and the diameter is equal to the width of the line.

See Also:
Constant Field Values

JOINSTYLE_BEVEL

public static final int JOINSTYLE_BEVEL
Constant specifying line-join style where the ends are squared of with CAPSTYLE_BUTT style.

See Also:
Constant Field Values

dashLength

public double dashLength

dashGap

public double dashGap

dashArray

public float[] dashArray

dashPhase

public double dashPhase

width

public double width
Width of the strokes made by the pen.


capStyle

public int capStyle
Line-end style for strokes made by the pen.


joinStyle

public int joinStyle
Line-join style for strokes made by the pen.


miterLimit

public double miterLimit
Ratio of the length of the miter and the line width for this pen. When two lines meet at a very sharp angle that makes the miter to extend far beyond the width of the line itself, a miter limit is useful for keeping the miter unobtrusive.


strokeColor

public Color strokeColor
Color of the strokes made by the pen.

Constructor Detail

PdfPen

public PdfPen()

PdfPen

public PdfPen(Color strokeColor)
Method Detail

clone

public Object clone()

Gnostice PDFOne
Pro. Ed. v5.0.0

To contact our support team, send an e-mail to support@gnostice.com.
 
© 2010 Gnostice Information Technologies Private Limited. All rights reserved.
www.gnostice.com