com.lowagie.text.pdf
Class PdfGraphics2D

java.lang.Object
  extended byjava.awt.Graphics
      extended byjava.awt.Graphics2D
          extended bycom.lowagie.text.pdf.PdfGraphics2D

public class PdfGraphics2D
extends Graphics2D


Nested Class Summary
private static class PdfGraphics2D.fakeComponent
           
(package private)  class PdfGraphics2D.PdfFontMetrics
           
 
Field Summary
static int AFM_DIVISOR
           
private  Color background
           
private  BaseFont baseFont
           
private  HashMap baseFonts
          Storage for BaseFont objects created.
private  PdfContentByte cb
           
private  Area clip
           
private static int CLIP
           
protected  int currentFillGState
           
protected  int currentStrokeGState
           
private  Graphics dg2
           
private  boolean disposeCalled
           
private static int FILL
           
protected  PdfGState[] fillGState
           
private  Font font
           
private  FontMapper fontMapper
           
private  PdfGraphics2D.PdfFontMetrics fontMetrics
           
private  float fontSize
           
private  float height
           
private static AffineTransform IDENTITY
           
private  boolean kid
           
private  ArrayList kids
           
private  MediaTracker mediaTracker
           
private  Stroke oldStroke
           
private  boolean onlyShapes
           
private  Stroke originalStroke
           
private  Paint paint
           
private  Paint paintFill
           
private  Paint paintStroke
           
private  RenderingHints rhints
           
private  Stroke stroke
           
private static int STROKE
           
protected  PdfGState[] strokeGState
           
private  BasicStroke strokeOne
           
private  AffineTransform transform
           
protected  boolean underline
           
private  float width
           
 
Constructor Summary
private PdfGraphics2D()
           
(package private) PdfGraphics2D(PdfContentByte cb, float width, float height)
           
(package private) PdfGraphics2D(PdfContentByte cb, float width, float height, FontMapper fontMapper)
          Constructor for PDFGraphics2D.
 
Method Summary
 void addRenderingHints(Map hints)
           
static double asPoints(double d, int i)
           
private  boolean checkNewPaint(Paint oldPaint)
           
 void clearRect(int x, int y, int width, int height)
           
 void clip(Shape s)
           
 void clipRect(int x, int y, int width, int height)
           
 void copyArea(int x, int y, int width, int height, int dx, int dy)
           
 Graphics create()
           
 void dispose()
           
protected  void doAttributes(AttributedCharacterIterator iter)
          This routine goes through the attributes and sets the font before calling the actual string drawing routine
 void draw(Shape s)
           
 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, AffineTransform xform, ImageObserver obs)
           
private  boolean drawImage(Image img, Image mask, AffineTransform xform, Color bgColor, ImageObserver obs)
           
 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, 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 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)
           
 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(AttributedCharacterIterator iter, float x, float y)
           
 void drawString(AttributedCharacterIterator iterator, int x, int y)
           
 void drawString(String s, float x, float y)
           
 void drawString(String s, int x, int y)
           
 void fill(Shape s)
           
 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)
           
 Color getBackground()
           
private  BaseFont getCachedBaseFont(Font f)
           
 Shape getClip()
           
 Rectangle getClipBounds()
           
 Color getColor()
           
 Composite getComposite()
           
 PdfContentByte getContent()
           
 GraphicsConfiguration getDeviceConfiguration()
           
 Font getFont()
           
 FontMetrics getFontMetrics(Font f)
           
 FontRenderContext getFontRenderContext()
           
 Paint getPaint()
           
 Object getRenderingHint(RenderingHints.Key arg0)
           
 RenderingHints getRenderingHints()
           
 Stroke getStroke()
           
 AffineTransform getTransform()
           
 boolean hit(Rectangle rect, Shape s, boolean onStroke)
           
private  AffineTransform normalizeMatrix()
           
private  float normalizeY(float y)
           
private  void normalizeY(float[] coords)
           
 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 setClip(Shape s)
           
 void setColor(Color color)
           
 void setComposite(Composite comp)
           
private  void setFillPaint()
           
 void setFont(Font f)
          Sets the current font.
private  void setPaint(boolean invert, double xoffset, double yoffset, boolean fill)
           
 void setPaint(Paint paint)
           
 void setPaintMode()
           
 void setRenderingHint(RenderingHints.Key arg0, Object arg1)
           
 void setRenderingHints(Map hints)
           
 void setStroke(Stroke s)
           
private  void setStrokeDiff(Stroke newStroke, Stroke oldStroke)
           
private  void setStrokePaint()
           
 void setTransform(AffineTransform t)
           
 void setXORMode(Color c1)
           
 void shear(double shx, double shy)
           
 void transform(AffineTransform tx)
           
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
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILL

private static final int FILL
See Also:
Constant Field Values

STROKE

private static final int STROKE
See Also:
Constant Field Values

CLIP

private static final int CLIP
See Also:
Constant Field Values

strokeOne

private BasicStroke strokeOne

IDENTITY

private static AffineTransform IDENTITY

font

private Font font

baseFont

private BaseFont baseFont

fontSize

private float fontSize

transform

private AffineTransform transform

paint

private Paint paint

background

private Color background

width

private float width

height

private float height

clip

private Area clip

rhints

private RenderingHints rhints

stroke

private Stroke stroke

originalStroke

private Stroke originalStroke

cb

private PdfContentByte cb

baseFonts

private HashMap baseFonts
Storage for BaseFont objects created.


disposeCalled

private boolean disposeCalled

fontMapper

private FontMapper fontMapper

fontMetrics

private PdfGraphics2D.PdfFontMetrics fontMetrics

kids

private ArrayList kids

kid

private boolean kid

dg2

private Graphics dg2

onlyShapes

private boolean onlyShapes

oldStroke

private Stroke oldStroke

paintFill

private Paint paintFill

paintStroke

private Paint paintStroke

mediaTracker

private MediaTracker mediaTracker

underline

protected boolean underline

fillGState

protected PdfGState[] fillGState

strokeGState

protected PdfGState[] strokeGState

currentFillGState

protected int currentFillGState

currentStrokeGState

protected int currentStrokeGState

AFM_DIVISOR

public static int AFM_DIVISOR
Constructor Detail

PdfGraphics2D

private PdfGraphics2D()

PdfGraphics2D

PdfGraphics2D(PdfContentByte cb,
              float width,
              float height,
              FontMapper fontMapper)
Constructor for PDFGraphics2D.


PdfGraphics2D

PdfGraphics2D(PdfContentByte cb,
              float width,
              float height)
Method Detail

draw

public void draw(Shape s)
See Also:
Graphics2D.draw(Shape)

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)

drawRenderedImage

public void drawRenderedImage(RenderedImage img,
                              AffineTransform xform)
See Also:
Graphics2D.drawRenderedImage(RenderedImage, AffineTransform)

drawRenderableImage

public void drawRenderableImage(RenderableImage img,
                                AffineTransform xform)
See Also:
Graphics2D.drawRenderableImage(RenderableImage, AffineTransform)

drawString

public void drawString(String s,
                       int x,
                       int y)
See Also:
Graphics.drawString(String, int, int)

asPoints

public static double asPoints(double d,
                              int i)
Parameters:
d - value to be converted
i - font size
Returns:

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 -

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)

drawGlyphVector

public void drawGlyphVector(GlyphVector g,
                            float x,
                            float y)
See Also:
Graphics2D.drawGlyphVector(GlyphVector, float, float)

fill

public void fill(Shape s)
See Also:
Graphics2D.fill(Shape)

hit

public boolean hit(Rectangle rect,
                   Shape s,
                   boolean onStroke)
See Also:
Graphics2D.hit(Rectangle, Shape, boolean)

getDeviceConfiguration

public GraphicsConfiguration getDeviceConfiguration()
See Also:
Graphics2D.getDeviceConfiguration()

setComposite

public void setComposite(Composite comp)
See Also:
Graphics2D.setComposite(Composite)

setPaint

public void setPaint(Paint paint)
See Also:
Graphics2D.setPaint(Paint)

transformStroke

private Stroke transformStroke(Stroke stroke)

setStrokeDiff

private void setStrokeDiff(Stroke newStroke,
                           Stroke oldStroke)

setStroke

public void setStroke(Stroke s)
See Also:
Graphics2D.setStroke(Stroke)

setRenderingHint

public void setRenderingHint(RenderingHints.Key arg0,
                             Object arg1)
See Also:
Graphics2D#setRenderingHint(Key, Object)

getRenderingHint

public Object getRenderingHint(RenderingHints.Key arg0)
See Also:
Graphics2D#getRenderingHint(Key)

setRenderingHints

public void setRenderingHints(Map hints)
See Also:
Graphics2D.setRenderingHints(Map)

addRenderingHints

public void addRenderingHints(Map hints)
See Also:
Graphics2D.addRenderingHints(Map)

getRenderingHints

public RenderingHints getRenderingHints()
See Also:
Graphics2D.getRenderingHints()

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)

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)

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)

setTransform

public void setTransform(AffineTransform t)
See Also:
Graphics2D.setTransform(AffineTransform)

getTransform

public AffineTransform getTransform()
See Also:
Graphics2D.getTransform()

getPaint

public Paint getPaint()
See Also:
Graphics2D.getPaint()

getComposite

public Composite getComposite()
See Also:
Graphics2D.getComposite()

setBackground

public void setBackground(Color color)
See Also:
Graphics2D.setBackground(Color)

getBackground

public Color getBackground()
See Also:
Graphics2D.getBackground()

getStroke

public Stroke getStroke()
See Also:
Graphics2D.getStroke()

getFontRenderContext

public FontRenderContext getFontRenderContext()
See Also:
Graphics2D.getFontRenderContext()

create

public Graphics create()
See Also:
Graphics.create()

getContent

public PdfContentByte getContent()

getColor

public Color getColor()
See Also:
Graphics.getColor()

setColor

public void setColor(Color color)
See Also:
Graphics.setColor(Color)

setPaintMode

public void setPaintMode()
See Also:
Graphics.setPaintMode()

setXORMode

public void setXORMode(Color c1)
See Also:
Graphics.setXORMode(Color)

getFont

public Font getFont()
See Also:
Graphics.getFont()

setFont

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


getCachedBaseFont

private BaseFont getCachedBaseFont(Font f)

getFontMetrics

public FontMetrics getFontMetrics(Font f)
See Also:
Graphics.getFontMetrics(Font)

getClipBounds

public Rectangle getClipBounds()
See Also:
Graphics.getClipBounds()

clipRect

public void clipRect(int x,
                     int y,
                     int width,
                     int height)
See Also:
Graphics.clipRect(int, int, int, int)

setClip

public void setClip(int x,
                    int y,
                    int width,
                    int height)
See Also:
Graphics.setClip(int, int, int, int)

clip

public void clip(Shape s)
See Also:
Graphics2D.clip(Shape)

getClip

public Shape getClip()
See Also:
Graphics.getClip()

setClip

public void setClip(Shape s)
See Also:
Graphics.setClip(Shape)

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)

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)
See Also:
Graphics.drawLine(int, int, int, int)

drawRect

public void drawRect(int x,
                     int y,
                     int width,
                     int height)
See Also:
Graphics.fillRect(int, int, int, int)

fillRect

public void fillRect(int x,
                     int y,
                     int width,
                     int height)
See Also:
Graphics.fillRect(int, int, int, int)

clearRect

public void clearRect(int x,
                      int y,
                      int width,
                      int height)
See Also:
Graphics.clearRect(int, int, int, int)

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)

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)

drawOval

public void drawOval(int x,
                     int y,
                     int width,
                     int height)
See Also:
Graphics.drawOval(int, int, int, int)

fillOval

public void fillOval(int x,
                     int y,
                     int width,
                     int height)
See Also:
Graphics.fillOval(int, int, int, int)

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)

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)

drawPolyline

public void drawPolyline(int[] x,
                         int[] y,
                         int nPoints)
See Also:
Graphics.drawPolyline(int[], int[], int)

drawPolygon

public void drawPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
See Also:
Graphics.drawPolygon(int[], int[], int)

fillPolygon

public void fillPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
See Also:
Graphics.fillPolygon(int[], 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)

dispose

public void dispose()
See Also:
Graphics.dispose()

followPath

private void followPath(Shape s,
                        int drawType)

normalizeY

private float normalizeY(float y)

normalizeY

private void normalizeY(float[] coords)

normalizeMatrix

private AffineTransform normalizeMatrix()

drawImage

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

checkNewPaint

private boolean checkNewPaint(Paint oldPaint)

setFillPaint

private void setFillPaint()

setStrokePaint

private void setStrokePaint()

setPaint

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

waitForImage

private void waitForImage(Image image)