Top Description Inners Fields Constructors Methods
de.rototor.pdfbox.graphics2d

public Class PdfBoxGraphics2DPaintApplier

extends Object
implements IPdfBoxGraphics2DPaintApplier
Class Inheritance
All Implemented Interfaces
de.rototor.pdfbox.graphics2d.IPdfBoxGraphics2DPaintApplier
Imports
org.apache.pdfbox.cos.COSArray, .COSBase, .COSBoolean, .COSDictionary, .COSFloat, .COSInteger, .COSName, .COSStream, org.apache.pdfbox.multipdf.PDFCloneUtility, org.apache.pdfbox.pdmodel.PDDocument, .PDPageContentStream, .PDResources, org.apache.pdfbox.pdmodel.common.COSObjectable, .PDRectangle, org.apache.pdfbox.pdmodel.common.function.PDFunctionType3, org.apache.pdfbox.pdmodel.graphics.PDXObject, org.apache.pdfbox.pdmodel.graphics.color.PDColor, .PDColorSpace, .PDDeviceGray, .PDPattern, org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject, .PDTransparencyGroup, org.apache.pdfbox.pdmodel.graphics.image.LosslessFactory, .PDImageXObject, org.apache.pdfbox.pdmodel.graphics.pattern.PDShadingPattern, .PDTilingPattern, org.apache.pdfbox.pdmodel.graphics.shading.PDShading, .PDShadingType3, .ShadingPaint, org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState, org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream, org.apache.pdfbox.util.Matrix, java.awt.*, java.awt.geom.AffineTransform, .Point2D, .Rectangle2D, java.awt.image.BufferedImage, java.io.IOException, java.lang.reflect.Method, java.util.ArrayList, .Arrays, .HashMap, .List, .Map

Default paint mapper.

Note

Objects of this class are stateful and *not* thread safe!

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
private class
private static class
pack-priv static class
public static class
PdfBoxGraphics2DPaintApplier.PaintApplierState

Internal State of the PaintApplyer.

private static class
pack-priv static interface

Field Summary

Modifier and TypeField and Description
private Object
private Object
private Object
private Object
private Object
private static final double
EPSILON

Very small number, everything smaller than this is zero for us.

private final PdfBoxGraphics2DPaintApplier.ExtGStateCache
private final PdfBoxGraphics2DPaintApplier.PDShadingCache

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
private void
public PDShading
applyPaint(Paint
the paint which should be applied
paint
,
PDPageContentStream
the content stream to apply the paint on
contentStream
,
AffineTransform
the current transform of the Graphics2D relative to the contentStream default coordinate space. This is always a copy of the current transform, so we can modify it.
tf
,
IPdfBoxGraphics2DPaintApplier.IPaintEnv
Environment for mapping the paint.
env
)

Implements de.rototor.pdfbox.graphics2d.IPdfBoxGraphics2DPaintApplier.applyPaint.

Apply the paint on the ContentStream

protected PDShading
applyPaint(Paint paint, PdfBoxGraphics2DPaintApplier.PaintApplierState state)

Apply paint and graphic state

private void
private void
private void
private PDShading
private PDShading
private PDShading
private COSArray

Returns:

the Type2 function COSArray
buildType2Functions
(List<Color>
the color to encode
colors
,
COSArray
the domain which should already been setuped. It will be used for the Type2 function
domain
,
COSArray
will get the domain information per color channel, i.e. colors.length x [0, 1]
encode
,
PdfBoxGraphics2DPaintApplier.PaintApplierState
our internal state, this is needed for color mapping
state
)

Build a type2 function to interpolate between the given colors.

private PDFunctionType3

Returns:

the type3 function
buildType3Function
(Color[]
The colors to encode
colors
,
float[]
the fractions for encoding
fractions
,
PdfBoxGraphics2DPaintApplier.PaintApplierState
our state, this is needed for color mapping
state
)

Encode a color gradient as a type3 function

private Point2D
private MultipleGradientPaint.ColorSpaceType
private MultipleGradientPaint.CycleMethod

Returns:

the CycleMethod
getCycleMethod
(Paint
the paint to get the cycleMethod from (if not in any other way possible using reflection)
paint
)

Map the cycleMethod of the GradientPaint to the java.awt.MultipleGradientPaint.CycleMethod enum.

protected static <
the type of the property you want to get.
T
>
T

Returns:

the value read from the object
getPropertyValue
(Object
The object to get a property from.
obj
,
String
method name of the getter, i.e. "getXY".
propertyGetter
)

Get a property value from an object using reflection

pack-priv static boolean
private PDShading
private PDShading
private PDShading
linearGradientUserSpaceOnUseShading(Paint paint, PdfBoxGraphics2DPaintApplier.PaintApplierState state)

This is the default gradient mode for both SVG and java.awt gradients.

pack-priv static PdfBoxGraphics2DColor
pack-priv static PdfBoxGraphics2DColor[]
private PDColor
private boolean
needBoundsKeyFrameEntry(float[] fractions)

private PDShadingType3
private void
private COSArray
private void
setupShadingCoords(PDShadingType3 shading, Point2D startPoint, Point2D endPoint)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait