Package org.apache.pdfbox.rendering
Class TilingPaint
java.lang.Object
org.apache.pdfbox.rendering.TilingPaint
- All Implemented Interfaces:
Paint
,Transparency
AWT Paint for a tiling pattern, which consists of a small repeating graphical figure.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final org.apache.commons.logging.Log
private static final int
private final Paint
private final Matrix
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
-
Constructor Summary
ConstructorsConstructorDescriptionTilingPaint
(PageDrawer drawer, PDTilingPattern pattern, AffineTransform xform) Creates a new colored tiling Paint, i.e.TilingPaint
(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace colorSpace, PDColor color, AffineTransform xform) Creates a new tiling Paint. -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
ceiling
(double num) Returns the closest integer which is larger than the given number.createContext
(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) Not called in TexturePaint subclasses, which is why we wrap TexturePaint.private Rectangle2D
getAnchorRect
(PDTilingPattern pattern) Returns the anchor rectangle, which includes the XStep/YStep and scaling.private BufferedImage
getImage
(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace colorSpace, PDColor color, AffineTransform xform, Rectangle2D anchorRect) Returns the pattern image in parent stream coordinates.int
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
paint
-
patternMatrix
-
MAXEDGE
private static final int MAXEDGE -
DEFAULTMAXEDGE
- See Also:
-
-
Constructor Details
-
TilingPaint
TilingPaint(PageDrawer drawer, PDTilingPattern pattern, AffineTransform xform) throws 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:
IOException
- if something goes wrong while drawing the pattern
-
TilingPaint
TilingPaint(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace colorSpace, PDColor color, AffineTransform xform) throws 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:
IOException
- if something goes wrong while drawing the pattern
-
-
Method Details
-
createContext
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) Not called in TexturePaint subclasses, which is why we wrap TexturePaint.- Specified by:
createContext
in interfacePaint
-
getImage
private BufferedImage getImage(PageDrawer drawer, PDTilingPattern pattern, PDColorSpace colorSpace, PDColor color, AffineTransform xform, Rectangle2D anchorRect) throws IOException Returns the pattern image in parent stream coordinates.- Throws:
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 interfaceTransparency
-
getAnchorRect
Returns the anchor rectangle, which includes the XStep/YStep and scaling.- Throws:
IOException
-