Class PdfGraphics2D
java.lang.Object
java.awt.Graphics
java.awt.Graphics2D
com.itextpdf.awt.PdfGraphics2D
- Direct Known Subclasses:
PdfPrinterGraphics2D
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classstatic classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprivate floatprotected Colorprotected BaseFontStorage for BaseFont objects created.protected PdfContentByteprotected Areaprivate static final intprivate Compositeprivate booleanprotected intprotected intprivate Graphics2Dprotected booleanprivate static final intprotected PdfGState[]protected Fontprotected FontMapperprotected floatprotected floatprivate static final AffineTransformprivate floatprivate booleanprivate ArrayList<PdfGraphics2D.Kid> private MediaTrackerprivate Strokeprivate booleanprotected Strokeprotected Paintprivate Paintprivate Paintprivate Paintprotected RenderingHintsprotected booleanprotected Strokeprivate static final intprotected PdfGState[]private BasicStrokeprotected AffineTransformprotected booleanprotected float -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePdfGraphics2D(PdfContentByte cb, float width, float height) PdfGraphics2D(PdfContentByte cb, float width, float height, boolean onlyShapes) PdfGraphics2D(PdfContentByte cb, float width, float height, FontMapper fontMapper) PdfGraphics2D(PdfContentByte cb, float width, float height, FontMapper fontMapper, boolean onlyShapes, boolean convertImagesToJPEG, float quality) Constructor for PDFGraphics2D. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRenderingHints(Map<?, ?> hints) static doubleasPoints(double d, int i) Calculates position and/or stroke thickness depending on the font sizeprivate booleancheckNewPaint(Paint oldPaint) voidclearRect(int x, int y, int width, int height) voidvoidclipRect(int x, int y, int width, int height) voidcopyArea(int x, int y, int width, int height, int dx, int dy) create()voiddispose()protected voidThis routine goes through the attributes and sets the font before calling the actual string drawing routinevoidvoiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle) voiddrawGlyphVector(GlyphVector g, float x, float y) voiddrawImage(BufferedImage img, BufferedImageOp op, int x, int y) 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, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) booleandrawImage(Image img, int x, int y, int width, int height, Color bgcolor, 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, ImageObserver observer) booleandrawImage(Image img, AffineTransform xform, ImageObserver obs) private 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, float x, float y) voiddrawString(String s, int x, int y) voiddrawString(AttributedCharacterIterator iter, float x, float y) voiddrawString(AttributedCharacterIterator iterator, int x, int y) voidvoidfillArc(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) private voidfollowPath(Shape s, int drawType) ////////////////////////////////////////////private BaseFontgetClip()getColor()private Graphics2DgetDG2()Method that creates a Graphics2D object.getFont()getPaint()Method contributed by Alexej SuchovgetRenderingHint(RenderingHints.Key hintKey) booleanprivate voidprotected AffineTransformprivate floatnormalizeY(float y) private voidnormalizeY(float[] coords) static BaseColorprepareColor(Color color) 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) voidvoidvoidsetComposite(Composite comp) Method contributed by Alexej Suchovprivate voidvoidSets the current font.private voidsetPaint(boolean invert, double xoffset, double yoffset, boolean fill) voidMethod contributed by Alexej SuchovvoidvoidsetRenderingHint(RenderingHints.Key hintKey, Object hintValue) Sets a rendering hintvoidsetRenderingHints(Map<?, ?> hints) voidprivate voidsetStrokeDiff(Stroke newStroke, Stroke oldStroke) private voidvoidvoidsetXORMode(Color c1) voidshear(double shx, double shy) voidprivate StroketransformStroke(Stroke stroke) voidtranslate(double tx, double ty) voidtranslate(int x, int y) private voidwaitForImage(Image image) Methods inherited from class Graphics2D
draw3DRect, fill3DRectMethods inherited from class Graphics
create, drawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString
-
Field Details
-
FILL
private static final int FILL- See Also:
-
STROKE
private static final int STROKE- See Also:
-
CLIP
private static final int CLIP- See Also:
-
strokeOne
-
IDENTITY
-
font
-
baseFont
-
fontSize
protected float fontSize -
transform
-
paint
-
background
-
width
protected float width -
height
protected float height -
clip
-
rhints
-
stroke
-
originalStroke
-
cb
-
baseFonts
-
disposeCalled
protected boolean disposeCalled -
fontMapper
-
kids
-
kid
private boolean kid -
dg2
-
onlyShapes
private boolean onlyShapes -
oldStroke
-
paintFill
-
paintStroke
-
mediaTracker
-
underline
protected boolean underline -
strikethrough
protected boolean strikethrough- Since:
- 5.0.3
-
fillGState
-
strokeGState
-
currentFillGState
protected int currentFillGState -
currentStrokeGState
protected int currentStrokeGState -
AFM_DIVISOR
public static final int AFM_DIVISOR- See Also:
-
convertImagesToJPEG
private boolean convertImagesToJPEG -
jpegQuality
private float jpegQuality -
alpha
private float alpha -
composite
-
realPaint
-
-
Constructor Details
-
PdfGraphics2D
private PdfGraphics2D() -
PdfGraphics2D
-
PdfGraphics2D
-
PdfGraphics2D
-
PdfGraphics2D
public PdfGraphics2D(PdfContentByte cb, float width, float height, FontMapper fontMapper, boolean onlyShapes, boolean convertImagesToJPEG, float quality) Constructor for PDFGraphics2D.
-
-
Method Details
-
getDG2
Method that creates a Graphics2D object. Contributed by Peter Harvey: he moved code from the constructor to a separate method- Since:
- 5.0.2
-
draw
- Specified by:
drawin classGraphics2D- See Also:
-
drawImage
- Specified by:
drawImagein classGraphics2D- See Also:
-
drawImage
- Specified by:
drawImagein classGraphics2D- See Also:
-
drawRenderedImage
- Specified by:
drawRenderedImagein classGraphics2D- See Also:
-
drawRenderableImage
- Specified by:
drawRenderableImagein classGraphics2D- See Also:
-
drawString
- Specified by:
drawStringin classGraphics2D- See Also:
-
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
This routine goes through the attributes and sets the font before calling the actual string drawing routine- Parameters:
iter-
-
drawString
- Specified by:
drawStringin classGraphics2D- See Also:
-
drawString
- Specified by:
drawStringin classGraphics2D- See Also:
-
drawString
- Specified by:
drawStringin classGraphics2D- See Also:
-
drawGlyphVector
- Specified by:
drawGlyphVectorin classGraphics2D- See Also:
-
fill
- Specified by:
fillin classGraphics2D- See Also:
-
hit
- Specified by:
hitin classGraphics2D- See Also:
-
getDeviceConfiguration
- Specified by:
getDeviceConfigurationin classGraphics2D- See Also:
-
setComposite
Method contributed by Alexej Suchov- Specified by:
setCompositein classGraphics2D- See Also:
-
setPaint
Method contributed by Alexej Suchov- Specified by:
setPaintin classGraphics2D- See Also:
-
transformStroke
-
setStrokeDiff
-
setStroke
- Specified by:
setStrokein classGraphics2D- See Also:
-
setRenderingHint
Sets a rendering hint- Specified by:
setRenderingHintin classGraphics2D- Parameters:
hintKey-hintValue-
-
getRenderingHint
- Specified by:
getRenderingHintin classGraphics2D- Parameters:
hintKey- a key- Returns:
- the rendering hint
-
setRenderingHints
- Specified by:
setRenderingHintsin classGraphics2D- See Also:
-
addRenderingHints
- Specified by:
addRenderingHintsin classGraphics2D- See Also:
-
getRenderingHints
- Specified by:
getRenderingHintsin classGraphics2D- See Also:
-
translate
public void translate(int x, int y) - Specified by:
translatein classGraphics2D- See Also:
-
translate
public void translate(double tx, double ty) - Specified by:
translatein classGraphics2D- See Also:
-
rotate
public void rotate(double theta) - Specified by:
rotatein classGraphics2D- See Also:
-
rotate
public void rotate(double theta, double x, double y) - Specified by:
rotatein classGraphics2D- See Also:
-
scale
public void scale(double sx, double sy) - Specified by:
scalein classGraphics2D- See Also:
-
shear
public void shear(double shx, double shy) - Specified by:
shearin classGraphics2D- See Also:
-
transform
- Specified by:
transformin classGraphics2D- See Also:
-
setTransform
- Specified by:
setTransformin classGraphics2D- See Also:
-
getTransform
- Specified by:
getTransformin classGraphics2D- See Also:
-
getPaint
Method contributed by Alexej Suchov- Specified by:
getPaintin classGraphics2D- See Also:
-
getComposite
- Specified by:
getCompositein classGraphics2D- See Also:
-
setBackground
- Specified by:
setBackgroundin classGraphics2D- See Also:
-
getBackground
- Specified by:
getBackgroundin classGraphics2D- See Also:
-
getStroke
- Specified by:
getStrokein classGraphics2D- See Also:
-
getFontRenderContext
- Specified by:
getFontRenderContextin classGraphics2D- See Also:
-
create
-
getContent
-
getColor
-
setColor
-
setPaintMode
public void setPaintMode()- Specified by:
setPaintModein classGraphics- See Also:
-
setXORMode
- Specified by:
setXORModein classGraphics- See Also:
-
getFont
-
setFont
-
getCachedBaseFont
-
getFontMetrics
- Specified by:
getFontMetricsin classGraphics- See Also:
-
getClipBounds
- Specified by:
getClipBoundsin classGraphics- See Also:
-
clipRect
-
setClip
-
clip
- Specified by:
clipin classGraphics2D- See Also:
-
getClip
-
setClip
-
copyArea
-
drawLine
-
drawRect
-
fillRect
-
clearRect
-
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) - Specified by:
drawRoundRectin classGraphics- See Also:
-
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) - Specified by:
fillRoundRectin classGraphics- See Also:
-
drawOval
-
fillOval
-
drawArc
-
fillArc
-
drawPolyline
public void drawPolyline(int[] x, int[] y, int nPoints) - Specified by:
drawPolylinein classGraphics- See Also:
-
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) - Specified by:
drawPolygonin classGraphics- See Also:
-
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) - Specified by:
fillPolygonin classGraphics- See Also:
-
drawImage
-
drawImage
-
drawImage
-
drawImage
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) -
drawImage
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) -
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) -
dispose
-
internalDispose
-
followPath
//////////////////////////////////////////// -
normalizeY
private float normalizeY(float y) -
normalizeY
private void normalizeY(float[] coords) -
normalizeMatrix
-
drawImage
private boolean drawImage(Image img, Image mask, AffineTransform xform, Color bgColor, ImageObserver obs) -
checkNewPaint
-
setFillPaint
private void setFillPaint() -
setStrokePaint
private void setStrokePaint() -
prepareColor
-
setPaint
private void setPaint(boolean invert, double xoffset, double yoffset, boolean fill) -
waitForImage
-