com.lowagie.text.pdf

Class PdfGraphics2D

public class PdfGraphics2D extends Graphics2D

Nested Class Summary
static classPdfGraphics2D.FakeComponent
static classPdfGraphics2D.HyperLinkKey
Field Summary
static intAFM_DIVISOR
floatalpha
Colorbackground
BaseFontbaseFont
HashMapbaseFonts
Storage for BaseFont objects created.
PdfContentBytecb
Areaclip
Compositecomposite
booleanconvertImagesToJPEG
protected intcurrentFillGState
protected intcurrentStrokeGState
static intCLIP
Graphics2Ddg2
booleandisposeCalled
protected PdfGState[]fillGState
Fontfont
FontMapperfontMapper
floatfontSize
static intFILL
floatheight
static AffineTransformIDENTITY
floatjpegQuality
booleankid
ArrayListkids
MediaTrackermediaTracker
StrokeoldStroke
booleanonlyShapes
StrokeoriginalStroke
Paintpaint
PaintpaintFill
PaintpaintStroke
PaintrealPaint
RenderingHintsrhints
Strokestroke
protected PdfGState[]strokeGState
BasicStrokestrokeOne
static intSTROKE
AffineTransformtransform
protected booleanunderline
floatwidth
Constructor Summary
PdfGraphics2D()
PdfGraphics2D(PdfContentByte cb, float width, float height, FontMapper fontMapper, boolean onlyShapes, boolean convertImagesToJPEG, float quality)
Constructor for PDFGraphics2D.
Method Summary
voidaddRenderingHints(Map hints)
static doubleasPoints(double d, int i)
Calculates position and/or stroke thickness depending on the font size
booleancheckNewPaint(Paint oldPaint)
voidclearRect(int x, int y, int width, int height)
voidclip(Shape s)
voidclipRect(int x, int y, int width, int height)
voidcopyArea(int x, int y, int width, int height, int dx, int dy)
Graphicscreate()
voiddispose()
protected voiddoAttributes(AttributedCharacterIterator iter)
This routine goes through the attributes and sets the font before calling the actual string drawing routine
voiddraw(Shape s)
voiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
voiddrawGlyphVector(GlyphVector g, float x, float y)
booleandrawImage(Image img, AffineTransform xform, ImageObserver obs)
voiddrawImage(BufferedImage img, BufferedImageOp op, int x, int y)
booleandrawImage(Image img, int x, int y, ImageObserver observer)
booleandrawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
booleandrawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
booleandrawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
booleandrawImage(Image img, Image mask, AffineTransform xform, Color bgColor, ImageObserver obs)
voiddrawLine(int x1, int y1, int x2, int y2)
voiddrawOval(int x, int y, int width, int height)
voiddrawPolygon(int[] xPoints, int[] yPoints, int nPoints)
voiddrawPolyline(int[] x, int[] y, int nPoints)
voiddrawRect(int x, int y, int width, int height)
voiddrawRenderableImage(RenderableImage img, AffineTransform xform)
voiddrawRenderedImage(RenderedImage img, AffineTransform xform)
voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
voiddrawString(String s, int x, int y)
voiddrawString(String s, float x, float y)
voiddrawString(AttributedCharacterIterator iterator, int x, int y)
voiddrawString(AttributedCharacterIterator iter, float x, float y)
voidfill(Shape s)
voidfillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
voidfillOval(int x, int y, int width, int height)
voidfillPolygon(int[] xPoints, int[] yPoints, int nPoints)
voidfillRect(int x, int y, int width, int height)
voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
voidfollowPath(Shape s, int drawType)
ColorgetBackground()
BaseFontgetCachedBaseFont(Font f)
ShapegetClip()
RectanglegetClipBounds()
ColorgetColor()
CompositegetComposite()
PdfContentBytegetContent()
GraphicsConfigurationgetDeviceConfiguration()
FontgetFont()
FontMetricsgetFontMetrics(Font f)
FontRenderContextgetFontRenderContext()
PaintgetPaint()
Method contributed by Alexej Suchov
ObjectgetRenderingHint(Key arg0)
RenderingHintsgetRenderingHints()
StrokegetStroke()
AffineTransformgetTransform()
booleanhit(Rectangle rect, Shape s, boolean onStroke)
voidinternalDispose(ByteBuffer buf)
AffineTransformnormalizeMatrix()
floatnormalizeY(float y)
voidnormalizeY(float[] coords)
voidrotate(double theta)
voidrotate(double theta, double x, double y)
voidscale(double sx, double sy)
voidsetBackground(Color color)
voidsetClip(int x, int y, int width, int height)
voidsetClip(Shape s)
voidsetColor(Color color)
voidsetComposite(Composite comp)
Method contributed by Alexej Suchov
voidsetFillPaint()
voidsetFont(Font f)
Sets the current font.
voidsetPaint(Paint paint)
Method contributed by Alexej Suchov
voidsetPaint(boolean invert, double xoffset, double yoffset, boolean fill)
voidsetPaintMode()
voidsetRenderingHint(Key arg0, Object arg1)
Sets a rendering hint
voidsetRenderingHints(Map hints)
voidsetStroke(Stroke s)
voidsetStrokeDiff(Stroke newStroke, Stroke oldStroke)
voidsetStrokePaint()
voidsetTransform(AffineTransform t)
voidsetXORMode(Color c1)
voidshear(double shx, double shy)
voidtransform(AffineTransform tx)
StroketransformStroke(Stroke stroke)
voidtranslate(int x, int y)
voidtranslate(double tx, double ty)
voidwaitForImage(Image image)

Field Detail

AFM_DIVISOR

public static final int AFM_DIVISOR

alpha

private float alpha

background

private Color background

baseFont

private BaseFont baseFont

baseFonts

private HashMap baseFonts
Storage for BaseFont objects created.

cb

private PdfContentByte cb

clip

private Area clip

composite

private Composite composite

convertImagesToJPEG

private boolean convertImagesToJPEG

currentFillGState

protected int currentFillGState

currentStrokeGState

protected int currentStrokeGState

CLIP

private static final int CLIP

dg2

private Graphics2D dg2

disposeCalled

private boolean disposeCalled

fillGState

protected PdfGState[] fillGState

font

private Font font

fontMapper

private FontMapper fontMapper

fontSize

private float fontSize

FILL

private static final int FILL

height

private float height

IDENTITY

private static final AffineTransform IDENTITY

jpegQuality

private float jpegQuality

kid

private boolean kid

kids

private ArrayList kids

mediaTracker

private MediaTracker mediaTracker

oldStroke

private Stroke oldStroke

onlyShapes

private boolean onlyShapes

originalStroke

private Stroke originalStroke

paint

private Paint paint

paintFill

private Paint paintFill

paintStroke

private Paint paintStroke

realPaint

private Paint realPaint

rhints

private RenderingHints rhints

stroke

private Stroke stroke

strokeGState

protected PdfGState[] strokeGState

strokeOne

private BasicStroke strokeOne

STROKE

private static final int STROKE

transform

private AffineTransform transform

underline

protected boolean underline

width

private float width

Constructor Detail

PdfGraphics2D

private PdfGraphics2D()

PdfGraphics2D

PdfGraphics2D(PdfContentByte cb, float width, float height, FontMapper fontMapper, boolean onlyShapes, boolean convertImagesToJPEG, float quality)
Constructor for PDFGraphics2D.

Method Detail

addRenderingHints

public void addRenderingHints(Map hints)

See Also: Graphics2D#addRenderingHints(Map)

asPoints

public static double asPoints(double d, int i)
Calculates position and/or stroke thickness depending on the font size

Parameters: d value to be converted i font size

Returns: position and/or stroke thickness depending on the font size

checkNewPaint

private boolean checkNewPaint(Paint oldPaint)

clearRect

public void clearRect(int x, int y, int width, int height)

See Also: Graphics#clearRect(int, int, int, int)

clip

public void clip(Shape s)

See Also: Graphics2D#clip(Shape)

clipRect

public void clipRect(int x, int y, int width, int height)

See Also: Graphics#clipRect(int, int, int, int)

copyArea

public void copyArea(int x, int y, int width, int height, int dx, int dy)

See Also: Graphics#copyArea(int, int, int, int, int, int)

create

public Graphics create()

See Also: Graphics#create()

dispose

public void dispose()

See Also: Graphics#dispose()

doAttributes

protected void doAttributes(AttributedCharacterIterator iter)
This routine goes through the attributes and sets the font before calling the actual string drawing routine

Parameters: iter

draw

public void draw(Shape s)

See Also: Graphics2D#draw(Shape)

drawArc

public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)

See Also: Graphics#drawArc(int, int, int, int, int, int)

drawGlyphVector

public void drawGlyphVector(GlyphVector g, float x, float y)

See Also: Graphics2D#drawGlyphVector(GlyphVector, float, float)

drawImage

public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs)

See Also: Graphics2D#drawImage(Image, AffineTransform, ImageObserver)

drawImage

public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y)

See Also: Graphics2D#drawImage(BufferedImage, BufferedImageOp, int, int)

drawImage

public boolean drawImage(Image img, int x, int y, ImageObserver observer)

See Also: Graphics#drawImage(Image, int, int, ImageObserver)

drawImage

public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)

See Also: Graphics#drawImage(Image, int, int, int, int, ImageObserver)

drawImage

public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)

See Also: Graphics#drawImage(Image, int, int, Color, ImageObserver)

drawImage

public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)

See Also: Graphics#drawImage(Image, int, int, int, int, Color, ImageObserver)

drawImage

public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)

See Also: Graphics#drawImage(Image, int, int, int, int, int, int, int, int, ImageObserver)

drawImage

public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)

See Also: Graphics#drawImage(Image, int, int, int, int, int, int, int, int, Color, ImageObserver)

drawImage

private boolean drawImage(Image img, Image mask, AffineTransform xform, Color bgColor, ImageObserver obs)

drawLine

public void drawLine(int x1, int y1, int x2, int y2)

See Also: Graphics#drawLine(int, int, int, int)

drawOval

public void drawOval(int x, int y, int width, int height)

See Also: Graphics#drawOval(int, int, int, int)

drawPolygon

public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)

See Also: Graphics#drawPolygon(int[], int[], int)

drawPolyline

public void drawPolyline(int[] x, int[] y, int nPoints)

See Also: Graphics#drawPolyline(int[], int[], int)

drawRect

public void drawRect(int x, int y, int width, int height)

See Also: Graphics#fillRect(int, int, int, int)

drawRenderableImage

public void drawRenderableImage(RenderableImage img, AffineTransform xform)

See Also: Graphics2D#drawRenderableImage(RenderableImage, AffineTransform)

drawRenderedImage

public void drawRenderedImage(RenderedImage img, AffineTransform xform)

See Also: Graphics2D#drawRenderedImage(RenderedImage, AffineTransform)

drawRoundRect

public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)

See Also: Graphics#drawRoundRect(int, int, int, int, int, int)

drawString

public void drawString(String s, int x, int y)

See Also: Graphics#drawString(String, int, int)

drawString

public void drawString(String s, float x, float y)

See Also: Graphics2D#drawString(String, float, float)

drawString

public void drawString(AttributedCharacterIterator iterator, int x, int y)

See Also: Graphics#drawString(AttributedCharacterIterator, int, int)

drawString

public void drawString(AttributedCharacterIterator iter, float x, float y)

See Also: Graphics2D#drawString(AttributedCharacterIterator, float, float)

fill

public void fill(Shape s)

See Also: Graphics2D#fill(Shape)

fillArc

public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)

See Also: Graphics#fillArc(int, int, int, int, int, int)

fillOval

public void fillOval(int x, int y, int width, int height)

See Also: Graphics#fillOval(int, int, int, int)

fillPolygon

public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)

See Also: Graphics#fillPolygon(int[], int[], int)

fillRect

public void fillRect(int x, int y, int width, int height)

See Also: Graphics#fillRect(int, int, int, int)

fillRoundRect

public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)

See Also: Graphics#fillRoundRect(int, int, int, int, int, int)

followPath

private void followPath(Shape s, int drawType)

getBackground

public Color getBackground()

See Also: Graphics2D#getBackground()

getCachedBaseFont

private BaseFont getCachedBaseFont(Font f)

getClip

public Shape getClip()

See Also: Graphics#getClip()

getClipBounds

public Rectangle getClipBounds()

See Also: Graphics#getClipBounds()

getColor

public Color getColor()

See Also: Graphics#getColor()

getComposite

public Composite getComposite()

See Also: Graphics2D#getComposite()

getContent

public PdfContentByte getContent()

getDeviceConfiguration

public GraphicsConfiguration getDeviceConfiguration()

See Also: Graphics2D#getDeviceConfiguration()

getFont

public Font getFont()

See Also: Graphics#getFont()

getFontMetrics

public FontMetrics getFontMetrics(Font f)

See Also: Graphics#getFontMetrics(Font)

getFontRenderContext

public FontRenderContext getFontRenderContext()

See Also: Graphics2D#getFontRenderContext()

getPaint

public Paint getPaint()
Method contributed by Alexej Suchov

See Also: Graphics2D#getPaint()

getRenderingHint

public Object getRenderingHint(Key arg0)

Parameters: arg0 a key

Returns: the rendering hint

getRenderingHints

public RenderingHints getRenderingHints()

See Also: Graphics2D#getRenderingHints()

getStroke

public Stroke getStroke()

See Also: Graphics2D#getStroke()

getTransform

public AffineTransform getTransform()

See Also: Graphics2D#getTransform()

hit

public boolean hit(Rectangle rect, Shape s, boolean onStroke)

See Also: Graphics2D#hit(Rectangle, Shape, boolean)

internalDispose

private void internalDispose(ByteBuffer buf)

normalizeMatrix

private AffineTransform normalizeMatrix()

normalizeY

private float normalizeY(float y)

normalizeY

private void normalizeY(float[] coords)

rotate

public void rotate(double theta)

See Also: Graphics2D#rotate(double)

rotate

public void rotate(double theta, double x, double y)

See Also: Graphics2D#rotate(double, double, double)

scale

public void scale(double sx, double sy)

See Also: Graphics2D#scale(double, double)

setBackground

public void setBackground(Color color)

See Also: Graphics2D#setBackground(Color)

setClip

public void setClip(int x, int y, int width, int height)

See Also: Graphics#setClip(int, int, int, int)

setClip

public void setClip(Shape s)

See Also: Graphics#setClip(Shape)

setColor

public void setColor(Color color)

See Also: Graphics#setColor(Color)

setComposite

public void setComposite(Composite comp)
Method contributed by Alexej Suchov

See Also: Graphics2D#setComposite(Composite)

setFillPaint

private void setFillPaint()

setFont

public void setFont(Font f)
Sets the current font.

setPaint

public void setPaint(Paint paint)
Method contributed by Alexej Suchov

See Also: Graphics2D#setPaint(Paint)

setPaint

private void setPaint(boolean invert, double xoffset, double yoffset, boolean fill)

setPaintMode

public void setPaintMode()

See Also: Graphics#setPaintMode()

setRenderingHint

public void setRenderingHint(Key arg0, Object arg1)
Sets a rendering hint

Parameters: arg0 arg1

setRenderingHints

public void setRenderingHints(Map hints)

See Also: Graphics2D#setRenderingHints(Map)

setStroke

public void setStroke(Stroke s)

See Also: Graphics2D#setStroke(Stroke)

setStrokeDiff

private void setStrokeDiff(Stroke newStroke, Stroke oldStroke)

setStrokePaint

private void setStrokePaint()

setTransform

public void setTransform(AffineTransform t)

See Also: Graphics2D#setTransform(AffineTransform)

setXORMode

public void setXORMode(Color c1)

See Also: Graphics#setXORMode(Color)

shear

public void shear(double shx, double shy)

See Also: Graphics2D#shear(double, double)

transform

public void transform(AffineTransform tx)

See Also: Graphics2D#transform(AffineTransform)

transformStroke

private Stroke transformStroke(Stroke stroke)

translate

public void translate(int x, int y)

See Also: Graphics#translate(int, int)

translate

public void translate(double tx, double ty)

See Also: Graphics2D#translate(double, double)

waitForImage

private void waitForImage(Image image)