- java.lang.Object
-
- java.awt.Graphics
-
- java.awt.Graphics2D
-
- com.itextpdf.text.pdf.PdfGraphics2D
-
- Direct Known Subclasses:
PdfPrinterGraphics2D
public class PdfGraphics2D extends java.awt.Graphics2D
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPdfGraphics2D.HyperLinkKey
-
Field Summary
Fields Modifier and Type Field Description static intAFM_DIVISORprotected intcurrentFillGStateprotected intcurrentStrokeGStateprotected PdfGState[]fillGStateprotected PdfGState[]strokeGStateprotected booleanunderline
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRenderingHints(java.util.Map hints)static doubleasPoints(double d, int i)Calculates position and/or stroke thickness depending on the font sizevoidclearRect(int x, int y, int width, int height)voidclip(java.awt.Shape s)voidclipRect(int x, int y, int width, int height)voidcopyArea(int x, int y, int width, int height, int dx, int dy)java.awt.Graphicscreate()voiddispose()protected voiddoAttributes(java.text.AttributedCharacterIterator iter)This routine goes through the attributes and sets the font before calling the actual string drawing routinevoiddraw(java.awt.Shape s)voiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle)voiddrawGlyphVector(java.awt.font.GlyphVector g, float x, float y)voiddrawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)booleandrawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.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(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)voiddrawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)voiddrawString(java.lang.String s, float x, float y)voiddrawString(java.lang.String s, int x, int y)voiddrawString(java.text.AttributedCharacterIterator iter, float x, float y)voiddrawString(java.text.AttributedCharacterIterator iterator, int x, int y)voidfill(java.awt.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)java.awt.ColorgetBackground()java.awt.ShapegetClip()java.awt.RectanglegetClipBounds()java.awt.ColorgetColor()java.awt.CompositegetComposite()PdfContentBytegetContent()java.awt.GraphicsConfigurationgetDeviceConfiguration()java.awt.FontgetFont()java.awt.FontMetricsgetFontMetrics(java.awt.Font f)java.awt.font.FontRenderContextgetFontRenderContext()java.awt.PaintgetPaint()Method contributed by Alexej Suchovjava.lang.ObjectgetRenderingHint(java.awt.RenderingHints.Key arg0)java.awt.RenderingHintsgetRenderingHints()java.awt.StrokegetStroke()java.awt.geom.AffineTransformgetTransform()booleanhit(java.awt.Rectangle rect, java.awt.Shape s, boolean onStroke)voidrotate(double theta)voidrotate(double theta, double x, double y)voidscale(double sx, double sy)voidsetBackground(java.awt.Color color)voidsetClip(int x, int y, int width, int height)voidsetClip(java.awt.Shape s)voidsetColor(java.awt.Color color)voidsetComposite(java.awt.Composite comp)Method contributed by Alexej SuchovvoidsetFont(java.awt.Font f)Sets the current font.voidsetPaint(java.awt.Paint paint)Method contributed by Alexej SuchovvoidsetPaintMode()voidsetRenderingHint(java.awt.RenderingHints.Key arg0, java.lang.Object arg1)Sets a rendering hintvoidsetRenderingHints(java.util.Map hints)voidsetStroke(java.awt.Stroke s)voidsetTransform(java.awt.geom.AffineTransform t)voidsetXORMode(java.awt.Color c1)voidshear(double shx, double shy)voidtransform(java.awt.geom.AffineTransform tx)voidtranslate(double tx, double ty)voidtranslate(int x, int y)
-
-
-
Field Detail
-
underline
protected boolean underline
-
fillGState
protected PdfGState[] fillGState
-
strokeGState
protected PdfGState[] strokeGState
-
currentFillGState
protected int currentFillGState
-
currentStrokeGState
protected int currentStrokeGState
-
AFM_DIVISOR
public static final int AFM_DIVISOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
draw
public void draw(java.awt.Shape s)
- Specified by:
drawin classjava.awt.Graphics2D- See Also:
Graphics2D.draw(Shape)
-
drawImage
public boolean drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver obs)- Specified by:
drawImagein classjava.awt.Graphics2D- See Also:
Graphics2D.drawImage(Image, AffineTransform, ImageObserver)
-
drawImage
public void drawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)- Specified by:
drawImagein classjava.awt.Graphics2D- See Also:
Graphics2D.drawImage(BufferedImage, BufferedImageOp, int, int)
-
drawRenderedImage
public void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)- Specified by:
drawRenderedImagein classjava.awt.Graphics2D- See Also:
Graphics2D.drawRenderedImage(RenderedImage, AffineTransform)
-
drawRenderableImage
public void drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)- Specified by:
drawRenderableImagein classjava.awt.Graphics2D- See Also:
Graphics2D.drawRenderableImage(RenderableImage, AffineTransform)
-
drawString
public void drawString(java.lang.String s, int x, int y)- Specified by:
drawStringin classjava.awt.Graphics2D- See Also:
Graphics.drawString(String, int, int)
-
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 convertedi- font size- Returns:
- position and/or stroke thickness depending on the font size
-
doAttributes
protected void doAttributes(java.text.AttributedCharacterIterator iter)
This routine goes through the attributes and sets the font before calling the actual string drawing routine- Parameters:
iter-
-
drawString
public void drawString(java.lang.String s, float x, float y)- Specified by:
drawStringin classjava.awt.Graphics2D- See Also:
Graphics2D.drawString(String, float, float)
-
drawString
public void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)- Specified by:
drawStringin classjava.awt.Graphics2D- See Also:
Graphics.drawString(AttributedCharacterIterator, int, int)
-
drawString
public void drawString(java.text.AttributedCharacterIterator iter, float x, float y)- Specified by:
drawStringin classjava.awt.Graphics2D- See Also:
Graphics2D.drawString(AttributedCharacterIterator, float, float)
-
drawGlyphVector
public void drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)- Specified by:
drawGlyphVectorin classjava.awt.Graphics2D- See Also:
Graphics2D.drawGlyphVector(GlyphVector, float, float)
-
fill
public void fill(java.awt.Shape s)
- Specified by:
fillin classjava.awt.Graphics2D- See Also:
Graphics2D.fill(Shape)
-
hit
public boolean hit(java.awt.Rectangle rect, java.awt.Shape s, boolean onStroke)- Specified by:
hitin classjava.awt.Graphics2D- See Also:
Graphics2D.hit(Rectangle, Shape, boolean)
-
getDeviceConfiguration
public java.awt.GraphicsConfiguration getDeviceConfiguration()
- Specified by:
getDeviceConfigurationin classjava.awt.Graphics2D- See Also:
Graphics2D.getDeviceConfiguration()
-
setComposite
public void setComposite(java.awt.Composite comp)
Method contributed by Alexej Suchov- Specified by:
setCompositein classjava.awt.Graphics2D- See Also:
Graphics2D.setComposite(Composite)
-
setPaint
public void setPaint(java.awt.Paint paint)
Method contributed by Alexej Suchov- Specified by:
setPaintin classjava.awt.Graphics2D- See Also:
Graphics2D.setPaint(Paint)
-
setStroke
public void setStroke(java.awt.Stroke s)
- Specified by:
setStrokein classjava.awt.Graphics2D- See Also:
Graphics2D.setStroke(Stroke)
-
setRenderingHint
public void setRenderingHint(java.awt.RenderingHints.Key arg0, java.lang.Object arg1)Sets a rendering hint- Specified by:
setRenderingHintin classjava.awt.Graphics2D- Parameters:
arg0-arg1-
-
getRenderingHint
public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key arg0)
- Specified by:
getRenderingHintin classjava.awt.Graphics2D- Parameters:
arg0- a key- Returns:
- the rendering hint
-
setRenderingHints
public void setRenderingHints(java.util.Map hints)
- Specified by:
setRenderingHintsin classjava.awt.Graphics2D- See Also:
Graphics2D.setRenderingHints(Map)
-
addRenderingHints
public void addRenderingHints(java.util.Map hints)
- Specified by:
addRenderingHintsin classjava.awt.Graphics2D- See Also:
Graphics2D.addRenderingHints(Map)
-
getRenderingHints
public java.awt.RenderingHints getRenderingHints()
- Specified by:
getRenderingHintsin classjava.awt.Graphics2D- See Also:
Graphics2D.getRenderingHints()
-
translate
public void translate(int x, int y)- Specified by:
translatein classjava.awt.Graphics2D- See Also:
Graphics.translate(int, int)
-
translate
public void translate(double tx, double ty)- Specified by:
translatein classjava.awt.Graphics2D- See Also:
Graphics2D.translate(double, double)
-
rotate
public void rotate(double theta)
- Specified by:
rotatein classjava.awt.Graphics2D- See Also:
Graphics2D.rotate(double)
-
rotate
public void rotate(double theta, double x, double y)- Specified by:
rotatein classjava.awt.Graphics2D- See Also:
Graphics2D.rotate(double, double, double)
-
scale
public void scale(double sx, double sy)- Specified by:
scalein classjava.awt.Graphics2D- See Also:
Graphics2D.scale(double, double)
-
shear
public void shear(double shx, double shy)- Specified by:
shearin classjava.awt.Graphics2D- See Also:
Graphics2D.shear(double, double)
-
transform
public void transform(java.awt.geom.AffineTransform tx)
- Specified by:
transformin classjava.awt.Graphics2D- See Also:
Graphics2D.transform(AffineTransform)
-
setTransform
public void setTransform(java.awt.geom.AffineTransform t)
- Specified by:
setTransformin classjava.awt.Graphics2D- See Also:
Graphics2D.setTransform(AffineTransform)
-
getTransform
public java.awt.geom.AffineTransform getTransform()
- Specified by:
getTransformin classjava.awt.Graphics2D- See Also:
Graphics2D.getTransform()
-
getPaint
public java.awt.Paint getPaint()
Method contributed by Alexej Suchov- Specified by:
getPaintin classjava.awt.Graphics2D- See Also:
Graphics2D.getPaint()
-
getComposite
public java.awt.Composite getComposite()
- Specified by:
getCompositein classjava.awt.Graphics2D- See Also:
Graphics2D.getComposite()
-
setBackground
public void setBackground(java.awt.Color color)
- Specified by:
setBackgroundin classjava.awt.Graphics2D- See Also:
Graphics2D.setBackground(Color)
-
getBackground
public java.awt.Color getBackground()
- Specified by:
getBackgroundin classjava.awt.Graphics2D- See Also:
Graphics2D.getBackground()
-
getStroke
public java.awt.Stroke getStroke()
- Specified by:
getStrokein classjava.awt.Graphics2D- See Also:
Graphics2D.getStroke()
-
getFontRenderContext
public java.awt.font.FontRenderContext getFontRenderContext()
- Specified by:
getFontRenderContextin classjava.awt.Graphics2D- See Also:
Graphics2D.getFontRenderContext()
-
create
public java.awt.Graphics create()
- Specified by:
createin classjava.awt.Graphics- See Also:
Graphics.create()
-
getContent
public PdfContentByte getContent()
-
getColor
public java.awt.Color getColor()
- Specified by:
getColorin classjava.awt.Graphics- See Also:
Graphics.getColor()
-
setColor
public void setColor(java.awt.Color color)
- Specified by:
setColorin classjava.awt.Graphics- See Also:
Graphics.setColor(Color)
-
setPaintMode
public void setPaintMode()
- Specified by:
setPaintModein classjava.awt.Graphics- See Also:
Graphics.setPaintMode()
-
setXORMode
public void setXORMode(java.awt.Color c1)
- Specified by:
setXORModein classjava.awt.Graphics- See Also:
Graphics.setXORMode(Color)
-
getFont
public java.awt.Font getFont()
- Specified by:
getFontin classjava.awt.Graphics- See Also:
Graphics.getFont()
-
setFont
public void setFont(java.awt.Font f)
Sets the current font.- Specified by:
setFontin classjava.awt.Graphics
-
getFontMetrics
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
- Specified by:
getFontMetricsin classjava.awt.Graphics- See Also:
Graphics.getFontMetrics(Font)
-
getClipBounds
public java.awt.Rectangle getClipBounds()
- Specified by:
getClipBoundsin classjava.awt.Graphics- See Also:
Graphics.getClipBounds()
-
clipRect
public void clipRect(int x, int y, int width, int height)- Specified by:
clipRectin classjava.awt.Graphics- See Also:
Graphics.clipRect(int, int, int, int)
-
setClip
public void setClip(int x, int y, int width, int height)- Specified by:
setClipin classjava.awt.Graphics- See Also:
Graphics.setClip(int, int, int, int)
-
clip
public void clip(java.awt.Shape s)
- Specified by:
clipin classjava.awt.Graphics2D- See Also:
Graphics2D.clip(Shape)
-
getClip
public java.awt.Shape getClip()
- Specified by:
getClipin classjava.awt.Graphics- See Also:
Graphics.getClip()
-
setClip
public void setClip(java.awt.Shape s)
- Specified by:
setClipin classjava.awt.Graphics- See Also:
Graphics.setClip(Shape)
-
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy)- Specified by:
copyAreain classjava.awt.Graphics- See Also:
Graphics.copyArea(int, int, int, int, int, int)
-
drawLine
public void drawLine(int x1, int y1, int x2, int y2)- Specified by:
drawLinein classjava.awt.Graphics- See Also:
Graphics.drawLine(int, int, int, int)
-
drawRect
public void drawRect(int x, int y, int width, int height)- Overrides:
drawRectin classjava.awt.Graphics- See Also:
Graphics.fillRect(int, int, int, int)
-
fillRect
public void fillRect(int x, int y, int width, int height)- Specified by:
fillRectin classjava.awt.Graphics- See Also:
Graphics.fillRect(int, int, int, int)
-
clearRect
public void clearRect(int x, int y, int width, int height)- Specified by:
clearRectin classjava.awt.Graphics- See Also:
Graphics.clearRect(int, int, int, int)
-
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)- Specified by:
drawRoundRectin classjava.awt.Graphics- See Also:
Graphics.drawRoundRect(int, int, int, int, int, int)
-
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)- Specified by:
fillRoundRectin classjava.awt.Graphics- See Also:
Graphics.fillRoundRect(int, int, int, int, int, int)
-
drawOval
public void drawOval(int x, int y, int width, int height)- Specified by:
drawOvalin classjava.awt.Graphics- See Also:
Graphics.drawOval(int, int, int, int)
-
fillOval
public void fillOval(int x, int y, int width, int height)- Specified by:
fillOvalin classjava.awt.Graphics- See Also:
Graphics.fillOval(int, int, int, int)
-
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)- Specified by:
drawArcin classjava.awt.Graphics- See Also:
Graphics.drawArc(int, int, int, int, int, int)
-
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)- Specified by:
fillArcin classjava.awt.Graphics- See Also:
Graphics.fillArc(int, int, int, int, int, int)
-
drawPolyline
public void drawPolyline(int[] x, int[] y, int nPoints)- Specified by:
drawPolylinein classjava.awt.Graphics- See Also:
Graphics.drawPolyline(int[], int[], int)
-
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)- Specified by:
drawPolygonin classjava.awt.Graphics- See Also:
Graphics.drawPolygon(int[], int[], int)
-
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)- Specified by:
fillPolygonin classjava.awt.Graphics- See Also:
Graphics.fillPolygon(int[], int[], int)
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics- See Also:
Graphics.drawImage(Image, int, int, ImageObserver)
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics- See Also:
Graphics.drawImage(Image, int, int, int, int, ImageObserver)
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics- See Also:
Graphics.drawImage(Image, int, int, Color, ImageObserver)
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics- See Also:
Graphics.drawImage(Image, int, int, int, int, Color, ImageObserver)
-
drawImage
public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics- See Also:
Graphics.drawImage(Image, int, int, int, int, int, int, int, int, ImageObserver)
-
drawImage
public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics- See Also:
Graphics.drawImage(Image, int, int, int, int, int, int, int, int, Color, ImageObserver)
-
dispose
public void dispose()
- Specified by:
disposein classjava.awt.Graphics- See Also:
Graphics.dispose()
-
-