Package com.itextpdf.awt
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 class
static class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
private float
protected Color
protected BaseFont
Storage for BaseFont objects created.protected PdfContentByte
protected Area
private static final int
private Composite
private boolean
protected int
protected int
private Graphics2D
protected boolean
private static final int
protected PdfGState[]
protected Font
protected FontMapper
protected float
protected float
private static final AffineTransform
private float
private boolean
private ArrayList<PdfGraphics2D.Kid>
private MediaTracker
private Stroke
private boolean
protected Stroke
protected Paint
private Paint
private Paint
private Paint
protected RenderingHints
protected boolean
protected Stroke
private static final int
protected PdfGState[]
private BasicStroke
protected AffineTransform
protected boolean
protected float
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
PdfGraphics2D
(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 TypeMethodDescriptionvoid
addRenderingHints
(Map<?, ?> hints) static double
asPoints
(double d, int i) Calculates position and/or stroke thickness depending on the font sizeprivate boolean
checkNewPaint
(Paint oldPaint) void
clearRect
(int x, int y, int width, int height) void
void
clipRect
(int x, int y, int width, int height) void
copyArea
(int x, int y, int width, int height, int dx, int dy) create()
void
dispose()
protected void
This routine goes through the attributes and sets the font before calling the actual string drawing routinevoid
void
drawArc
(int x, int y, int width, int height, int startAngle, int arcAngle) void
drawGlyphVector
(GlyphVector g, float x, float y) void
drawImage
(BufferedImage img, BufferedImageOp op, int x, int y) boolean
drawImage
(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) boolean
drawImage
(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) boolean
drawImage
(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) boolean
drawImage
(Image img, int x, int y, int width, int height, ImageObserver observer) boolean
drawImage
(Image img, int x, int y, Color bgcolor, ImageObserver observer) boolean
drawImage
(Image img, int x, int y, ImageObserver observer) boolean
drawImage
(Image img, AffineTransform xform, ImageObserver obs) private boolean
drawImage
(Image img, Image mask, AffineTransform xform, Color bgColor, ImageObserver obs) void
drawLine
(int x1, int y1, int x2, int y2) void
drawOval
(int x, int y, int width, int height) void
drawPolygon
(int[] xPoints, int[] yPoints, int nPoints) void
drawPolyline
(int[] x, int[] y, int nPoints) void
drawRect
(int x, int y, int width, int height) void
drawRenderableImage
(RenderableImage img, AffineTransform xform) void
drawRenderedImage
(RenderedImage img, AffineTransform xform) void
drawRoundRect
(int x, int y, int width, int height, int arcWidth, int arcHeight) void
drawString
(String s, float x, float y) void
drawString
(String s, int x, int y) void
drawString
(AttributedCharacterIterator iter, float x, float y) void
drawString
(AttributedCharacterIterator iterator, int x, int y) void
void
fillArc
(int x, int y, int width, int height, int startAngle, int arcAngle) void
fillOval
(int x, int y, int width, int height) void
fillPolygon
(int[] xPoints, int[] yPoints, int nPoints) void
fillRect
(int x, int y, int width, int height) void
fillRoundRect
(int x, int y, int width, int height, int arcWidth, int arcHeight) private void
followPath
(Shape s, int drawType) private BaseFont
getClip()
getColor()
private Graphics2D
getDG2()
Method that creates a Graphics2D object.getFont()
getPaint()
Method contributed by Alexej SuchovgetRenderingHint
(RenderingHints.Key hintKey) boolean
private void
protected AffineTransform
private float
normalizeY
(float y) private void
normalizeY
(float[] coords) static BaseColor
prepareColor
(Color color) void
rotate
(double theta) void
rotate
(double theta, double x, double y) void
scale
(double sx, double sy) void
setBackground
(Color color) void
setClip
(int x, int y, int width, int height) void
void
void
setComposite
(Composite comp) Method contributed by Alexej Suchovprivate void
void
Sets the current font.private void
setPaint
(boolean invert, double xoffset, double yoffset, boolean fill) void
Method contributed by Alexej Suchovvoid
void
setRenderingHint
(RenderingHints.Key hintKey, Object hintValue) Sets a rendering hintvoid
setRenderingHints
(Map<?, ?> hints) void
private void
setStrokeDiff
(Stroke newStroke, Stroke oldStroke) private void
void
void
setXORMode
(Color c1) void
shear
(double shx, double shy) void
private Stroke
transformStroke
(Stroke stroke) void
translate
(double tx, double ty) void
translate
(int x, int y) private void
waitForImage
(Image image) Methods inherited from class java.awt.Graphics2D
draw3DRect, fill3DRect
Methods inherited from class java.awt.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
Storage for BaseFont objects created. -
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:
draw
in classGraphics2D
- See Also:
-
drawImage
- Specified by:
drawImage
in classGraphics2D
- See Also:
-
drawImage
- Specified by:
drawImage
in classGraphics2D
- See Also:
-
drawRenderedImage
- Specified by:
drawRenderedImage
in classGraphics2D
- See Also:
-
drawRenderableImage
- Specified by:
drawRenderableImage
in classGraphics2D
- See Also:
-
drawString
- Specified by:
drawString
in 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:
drawString
in classGraphics2D
- See Also:
-
drawString
- Specified by:
drawString
in classGraphics2D
- See Also:
-
drawString
- Specified by:
drawString
in classGraphics2D
- See Also:
-
drawGlyphVector
- Specified by:
drawGlyphVector
in classGraphics2D
- See Also:
-
fill
- Specified by:
fill
in classGraphics2D
- See Also:
-
hit
- Specified by:
hit
in classGraphics2D
- See Also:
-
getDeviceConfiguration
- Specified by:
getDeviceConfiguration
in classGraphics2D
- See Also:
-
setComposite
Method contributed by Alexej Suchov- Specified by:
setComposite
in classGraphics2D
- See Also:
-
setPaint
Method contributed by Alexej Suchov- Specified by:
setPaint
in classGraphics2D
- See Also:
-
transformStroke
-
setStrokeDiff
-
setStroke
- Specified by:
setStroke
in classGraphics2D
- See Also:
-
setRenderingHint
Sets a rendering hint- Specified by:
setRenderingHint
in classGraphics2D
- Parameters:
hintKey
-hintValue
-
-
getRenderingHint
- Specified by:
getRenderingHint
in classGraphics2D
- Parameters:
hintKey
- a key- Returns:
- the rendering hint
-
setRenderingHints
- Specified by:
setRenderingHints
in classGraphics2D
- See Also:
-
addRenderingHints
- Specified by:
addRenderingHints
in classGraphics2D
- See Also:
-
getRenderingHints
- Specified by:
getRenderingHints
in classGraphics2D
- See Also:
-
translate
public void translate(int x, int y) - Specified by:
translate
in classGraphics2D
- See Also:
-
translate
public void translate(double tx, double ty) - Specified by:
translate
in classGraphics2D
- See Also:
-
rotate
public void rotate(double theta) - Specified by:
rotate
in classGraphics2D
- See Also:
-
rotate
public void rotate(double theta, double x, double y) - Specified by:
rotate
in classGraphics2D
- See Also:
-
scale
public void scale(double sx, double sy) - Specified by:
scale
in classGraphics2D
- See Also:
-
shear
public void shear(double shx, double shy) - Specified by:
shear
in classGraphics2D
- See Also:
-
transform
- Specified by:
transform
in classGraphics2D
- See Also:
-
setTransform
- Specified by:
setTransform
in classGraphics2D
- See Also:
-
getTransform
- Specified by:
getTransform
in classGraphics2D
- See Also:
-
getPaint
Method contributed by Alexej Suchov- Specified by:
getPaint
in classGraphics2D
- See Also:
-
getComposite
- Specified by:
getComposite
in classGraphics2D
- See Also:
-
setBackground
- Specified by:
setBackground
in classGraphics2D
- See Also:
-
getBackground
- Specified by:
getBackground
in classGraphics2D
- See Also:
-
getStroke
- Specified by:
getStroke
in classGraphics2D
- See Also:
-
getFontRenderContext
- Specified by:
getFontRenderContext
in classGraphics2D
- See Also:
-
create
-
getContent
-
getColor
-
setColor
-
setPaintMode
public void setPaintMode()- Specified by:
setPaintMode
in classGraphics
- See Also:
-
setXORMode
- Specified by:
setXORMode
in classGraphics
- See Also:
-
getFont
-
setFont
Sets the current font. -
getCachedBaseFont
-
getFontMetrics
- Specified by:
getFontMetrics
in classGraphics
- See Also:
-
getClipBounds
- Specified by:
getClipBounds
in classGraphics
- See Also:
-
clipRect
public void clipRect(int x, int y, int width, int height) -
setClip
public void setClip(int x, int y, int width, int height) -
clip
- Specified by:
clip
in classGraphics2D
- See Also:
-
getClip
-
setClip
-
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy) -
drawLine
public void drawLine(int x1, int y1, int x2, int y2) -
drawRect
public void drawRect(int x, int y, int width, int height) -
fillRect
public void fillRect(int x, int y, int width, int height) -
clearRect
public void clearRect(int x, int y, int width, int height) -
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) - Specified by:
drawRoundRect
in classGraphics
- See Also:
-
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) - Specified by:
fillRoundRect
in classGraphics
- See Also:
-
drawOval
public void drawOval(int x, int y, int width, int height) -
fillOval
public void fillOval(int x, int y, int width, int height) -
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) -
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) -
drawPolyline
public void drawPolyline(int[] x, int[] y, int nPoints) - Specified by:
drawPolyline
in classGraphics
- See Also:
-
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) - Specified by:
drawPolygon
in classGraphics
- See Also:
-
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) - Specified by:
fillPolygon
in 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
public void 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
-