Package org.apache.pdfbox.rendering
Class TilingPaint
- java.lang.Object
-
- org.apache.pdfbox.rendering.TilingPaint
-
- All Implemented Interfaces:
java.awt.Paint
,java.awt.Transparency
class TilingPaint extends java.lang.Object implements java.awt.Paint
AWT Paint for a tiling pattern, which consists of a small repeating graphical figure.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
DEFAULTMAXEDGE
private static org.apache.commons.logging.Log
LOG
private static int
MAXEDGE
private java.awt.Paint
paint
private Matrix
patternMatrix
-
Constructor Summary
Constructors Constructor Description TilingPaint(PageDrawer drawer, PDTilingPattern pattern, java.awt.geom.AffineTransform xform)
Creates a new colored tiling Paint, i.e.TilingPaint(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace colorSpace, PDColor color, java.awt.geom.AffineTransform xform)
Creates a new tiling Paint.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
ceiling(double num)
Returns the closest integer which is larger than the given number.java.awt.PaintContext
createContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, java.awt.RenderingHints hints)
Not called in TexturePaint subclasses, which is why we wrap TexturePaint.private java.awt.geom.Rectangle2D
getAnchorRect(PDTilingPattern pattern)
Returns the anchor rectangle, which includes the XStep/YStep and scaling.private java.awt.image.BufferedImage
getImage(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace colorSpace, PDColor color, java.awt.geom.AffineTransform xform, java.awt.geom.Rectangle2D anchorRect)
Returns the pattern image in parent stream coordinates.int
getTransparency()
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
paint
private final java.awt.Paint paint
-
patternMatrix
private final Matrix patternMatrix
-
MAXEDGE
private static final int MAXEDGE
-
DEFAULTMAXEDGE
private static final java.lang.String DEFAULTMAXEDGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TilingPaint
TilingPaint(PageDrawer drawer, PDTilingPattern pattern, java.awt.geom.AffineTransform xform) throws java.io.IOException
Creates a new colored tiling Paint, i.e. one that has its own colors.- Parameters:
drawer
- renderer to render the pagepattern
- tiling pattern dictionaryxform
- device scale transform- Throws:
java.io.IOException
- if something goes wrong while drawing the pattern
-
TilingPaint
TilingPaint(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace colorSpace, PDColor color, java.awt.geom.AffineTransform xform) throws java.io.IOException
Creates a new tiling Paint. The parameters color and colorSpace must be null for a colored tiling Paint (because it has its own colors), and non null for an uncolored tiling Paint.- Parameters:
drawer
- renderer to render the pagepattern
- tiling pattern dictionarycolorSpace
- color space for this tilingcolor
- color for this tilingxform
- device scale transform- Throws:
java.io.IOException
- if something goes wrong while drawing the pattern
-
-
Method Detail
-
createContext
public java.awt.PaintContext createContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, java.awt.RenderingHints hints)
Not called in TexturePaint subclasses, which is why we wrap TexturePaint.- Specified by:
createContext
in interfacejava.awt.Paint
-
getImage
private java.awt.image.BufferedImage getImage(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace colorSpace, PDColor color, java.awt.geom.AffineTransform xform, java.awt.geom.Rectangle2D anchorRect) throws java.io.IOException
Returns the pattern image in parent stream coordinates.- Throws:
java.io.IOException
-
ceiling
private static int ceiling(double num)
Returns the closest integer which is larger than the given number. Uses BigDecimal to avoid floating point error which would cause gaps in the tiling.
-
getTransparency
public int getTransparency()
- Specified by:
getTransparency
in interfacejava.awt.Transparency
-
getAnchorRect
private java.awt.geom.Rectangle2D getAnchorRect(PDTilingPattern pattern)
Returns the anchor rectangle, which includes the XStep/YStep and scaling.
-
-