Top Description Fields Constructors Methods
org.apache.pdfbox.rendering

pack-priv Class TilingPaint

extends Object
implements Paint
Class Inheritance
All Implemented Interfaces
java.awt.Paint, java.awt.Transparency
Imports
java.awt.Graphics2D, .Paint, .PaintContext, .Rectangle, .RenderingHints, .TexturePaint, .Transparency, java.awt.geom.AffineTransform, .Rectangle2D, java.awt.image.BufferedImage, .ColorModel, java.io.IOException, java.math.BigDecimal, .RoundingMode, org.apache.commons.logging.Log, .LogFactory, org.apache.pdfbox.pdmodel.common.PDRectangle, org.apache.pdfbox.pdmodel.graphics.color.PDColor, .PDColorSpace, org.apache.pdfbox.pdmodel.graphics.pattern.PDTilingPattern, org.apache.pdfbox.util.Matrix

AWT Paint for a tiling pattern, which consists of a small repeating graphical figure.
Author
John Hewson

Field Summary

Modifier and TypeField and Description
private static final String
private static final Log
private static final int
private final Paint
private final Matrix

Constructor Summary

AccessConstructor and Description
pack-priv
TilingPaint(PageDrawer
renderer to render the page
drawer
,
PDTilingPattern
tiling pattern dictionary
pattern
,
AffineTransform
device scale transform
xform
)

Creates a new colored tiling Paint, i.e. one that has its own colors.

pack-priv
TilingPaint(PageDrawer
renderer to render the page
drawer
,
PDTilingPattern
tiling pattern dictionary
pattern
,
PDColorSpace
color space for this tiling
colorSpace
,
PDColor
color for this tiling
color
,
AffineTransform
device scale transform
xform
)

Creates a new tiling Paint.

Method Summary

Modifier and TypeMethod and Description
private static int
ceiling(double num)

Returns the closest integer which is larger than the given number.

public PaintContext
createContext(ColorModel
the preferred ColorModel which represents the most convenient format for the caller to receive the pixel data, or null if there is no preference.
cm
,
Rectangle
the device space bounding box of the graphics primitive being rendered. Implementations of the Paint interface are allowed to throw NullPointerException for a null deviceBounds.
deviceBounds
,
Rectangle2D
the user space bounding box of the graphics primitive being rendered. Implementations of the Paint interface are allowed to throw NullPointerException for a null userBounds.
userBounds
,
AffineTransform
the AffineTransform from user space into device space. Implementations of the Paint interface are allowed to throw NullPointerException for a null xform.
xform
,
RenderingHints
the set of hints that the context object can use to choose between rendering alternatives. Implementations of the Paint interface are allowed to throw NullPointerException for a null hints.
hints
)

Implements java.awt.Paint.createContext.

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.

public int
getTransparency()

Implements java.awt.Transparency.getTransparency.

Returns the type of this Transparency.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULTMAXEDGEback to summary
private static final String DEFAULTMAXEDGE
LOGback to summary
private static final Log LOG
MAXEDGEback to summary
private static final int MAXEDGE
paintback to summary
private final Paint paint
patternMatrixback to summary
private final Matrix patternMatrix

Constructor Detail

TilingPaintback to summary
pack-priv 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:PageDrawer

renderer to render the page

pattern:PDTilingPattern

tiling pattern dictionary

xform:AffineTransform

device scale transform

Exceptions
IOException:
if something goes wrong while drawing the pattern
TilingPaintback to summary
pack-priv 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:PageDrawer

renderer to render the page

pattern:PDTilingPattern

tiling pattern dictionary

colorSpace:PDColorSpace

color space for this tiling

color:PDColor

color for this tiling

xform:AffineTransform

device scale transform

Exceptions
IOException:
if something goes wrong while drawing the pattern

Method Detail

ceilingback to summary
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.

createContextback to summary
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)

Implements java.awt.Paint.createContext.

Not called in TexturePaint subclasses, which is why we wrap TexturePaint.

Parameters
cm:ColorModel

Doc from java.awt.Paint.createContext.

the preferred ColorModel which represents the most convenient format for the caller to receive the pixel data, or null if there is no preference.

deviceBounds:Rectangle

Doc from java.awt.Paint.createContext.

the device space bounding box of the graphics primitive being rendered. Implementations of the Paint interface are allowed to throw NullPointerException for a null deviceBounds.

userBounds:Rectangle2D

Doc from java.awt.Paint.createContext.

the user space bounding box of the graphics primitive being rendered. Implementations of the Paint interface are allowed to throw NullPointerException for a null userBounds.

xform:AffineTransform

Doc from java.awt.Paint.createContext.

the AffineTransform from user space into device space. Implementations of the Paint interface are allowed to throw NullPointerException for a null xform.

hints:RenderingHints

Doc from java.awt.Paint.createContext.

the set of hints that the context object can use to choose between rendering alternatives. Implementations of the Paint interface are allowed to throw NullPointerException for a null hints.

Returns:PaintContext

Doc from java.awt.Paint.createContext.

the PaintContext for generating color patterns.

Annotations
@Override
getAnchorRectback to summary
private Rectangle2D getAnchorRect(PDTilingPattern pattern) throws IOException

Returns the anchor rectangle, which includes the XStep/YStep and scaling.

getImageback to summary
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.

getTransparencyback to summary
public int getTransparency()

Implements java.awt.Transparency.getTransparency.

Doc from java.awt.Transparency.getTransparency.

Returns the type of this Transparency.

Returns:int

the field type of this Transparency, which is either OPAQUE, BITMASK or TRANSLUCENT.

Annotations
@Override