Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.graphics.shading

pack-priv abstract Class PDMeshBasedShadingType

extends PDShadingType4
Class Inheritance
Known Direct Subclasses
org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType6, org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType7
Imports
java.awt.geom.AffineTransform, .Point2D, .Rectangle2D, java.io.EOFException, .InputStream, .IOException, java.util.ArrayList, .Collections, .List, javax.imageio.stream.ImageInputStream, .MemoryCacheImageInputStream, org.apache.commons.logging.Log, .LogFactory, org.apache.pdfbox.cos.COSDictionary, .COSStream, org.apache.pdfbox.pdmodel.common.PDRange, org.apache.pdfbox.util.Matrix

Common resources for shading types 6 and 7

Field Summary

Modifier and TypeField and Description
private static final Log

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv final List<Patch>

Returns:

the obtained patch list
collectPatches
(AffineTransform
transformation for user to device space
xform
,
Matrix
the pattern matrix concatenated with that of the parent content stream
matrix
,
int
number of control points, 12 for type 6 shading and 16 for type 7 shading
controlPoints
)

Create a patch list from a data stream, the returned list contains all the patches contained in the data stream.

pack-priv abstract Patch

Returns:

a patch instance
generatePatch
(Point2D[]
12 or 16 control points
points
,
float[][]
4 corner colors
color
)

Create a patch using control points and 4 corner color values, in Type6ShadingContext, a CoonsPatch is returned; in Type6ShadingContext, a TensorPatch is returned.

public abstract Rectangle2D
getBounds(AffineTransform
the affine transformation
xform
,
Matrix
the pattern matrix
matrix
)

Overrides org.apache.pdfbox.pdmodel.graphics.shading.PDTriangleBasedShadingType.getBounds.

Calculate a bounding rectangle around the areas of this shading context.

pack-priv Rectangle2D
getBounds(AffineTransform xform, Matrix matrix, int controlPoints)

protected Patch

Returns:

a single patch
readPatch
(ImageInputStream
the image source data stream
input
,
boolean
whether this is a free patch
isFree
,
Point2D[]
implicit edge when a patch is not free, otherwise it's not used
implicitEdge
,
float[][]
implicit colors when a patch is not free, otherwise it's not used
implicitCornerColor
,
long
the maximum coordinate value calculated from source data
maxSrcCoord
,
long
the maximum color value calculated from source data
maxSrcColor
,
PDRange
range for coordinate x
rangeX
,
PDRange
range for coordinate y
rangeY
,
PDRange[]
range for color
colRange
,
Matrix
the pattern matrix concatenated with that of the parent content stream
matrix
,
AffineTransform
transformation for user to device space
xform
,
int
number of control points, 12 for type 6 shading and 16 for type 7 shading
controlPoints
)

Read a single patch from a data stream, a patch contains information of its coordinates and color parameters.

Inherited from org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType4:
collectTrianglesgetBitsPerFlaggetShadingTypesetBitsPerFlagtoPaint

Field Detail

LOGback to summary
private static final Log LOG

Hides org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType4.LOG.

Constructor Detail

PDMeshBasedShadingTypeback to summary
pack-priv PDMeshBasedShadingType(COSDictionary shadingDictionary)

Method Detail

collectPatchesback to summary
pack-priv final List<Patch> collectPatches(AffineTransform xform, Matrix matrix, int controlPoints) throws IOException

Create a patch list from a data stream, the returned list contains all the patches contained in the data stream.

Parameters
xform:AffineTransform

transformation for user to device space

matrix:Matrix

the pattern matrix concatenated with that of the parent content stream

controlPoints:int

number of control points, 12 for type 6 shading and 16 for type 7 shading

Returns:List<Patch>

the obtained patch list

Annotations
@SuppressWarnings:squid:S2583, squid:S1166
Exceptions
IOException:
when something went wrong
generatePatchback to summary
pack-priv abstract Patch generatePatch(Point2D[] points, float[][] color)

Create a patch using control points and 4 corner color values, in Type6ShadingContext, a CoonsPatch is returned; in Type6ShadingContext, a TensorPatch is returned.

Parameters
points:Point2D[]

12 or 16 control points

color:float[][]

4 corner colors

Returns:Patch

a patch instance

getBoundsback to summary
public abstract Rectangle2D getBounds(AffineTransform xform, Matrix matrix) throws IOException

Overrides org.apache.pdfbox.pdmodel.graphics.shading.PDTriangleBasedShadingType.getBounds.

Doc from org.apache.pdfbox.pdmodel.graphics.shading.PDShading.getBounds.

Calculate a bounding rectangle around the areas of this shading context.

Parameters
xform:AffineTransform

the affine transformation

matrix:Matrix

the pattern matrix

Returns:Rectangle2D

Bounding rectangle or null, if not supported by this shading type.

Annotations
@Override
Exceptions
IOException:
if the bounds could not be created
getBoundsback to summary
pack-priv Rectangle2D getBounds(AffineTransform xform, Matrix matrix, int controlPoints) throws IOException
readPatchback to summary
protected Patch readPatch(ImageInputStream input, boolean isFree, Point2D[] implicitEdge, float[][] implicitCornerColor, long maxSrcCoord, long maxSrcColor, PDRange rangeX, PDRange rangeY, PDRange[] colRange, Matrix matrix, AffineTransform xform, int controlPoints) throws IOException

Read a single patch from a data stream, a patch contains information of its coordinates and color parameters.

Parameters
input:ImageInputStream

the image source data stream

isFree:boolean

whether this is a free patch

implicitEdge:Point2D[]

implicit edge when a patch is not free, otherwise it's not used

implicitCornerColor:float[][]

implicit colors when a patch is not free, otherwise it's not used

maxSrcCoord:long

the maximum coordinate value calculated from source data

maxSrcColor:long

the maximum color value calculated from source data

rangeX:PDRange

range for coordinate x

rangeY:PDRange

range for coordinate y

colRange:PDRange[]

range for color

matrix:Matrix

the pattern matrix concatenated with that of the parent content stream

xform:AffineTransform

transformation for user to device space

controlPoints:int

number of control points, 12 for type 6 shading and 16 for type 7 shading

Returns:Patch

a single patch

Exceptions
IOException:
when something went wrong