Class PDMeshBasedShadingType
java.lang.Object
org.apache.pdfbox.pdmodel.graphics.shading.PDShading
org.apache.pdfbox.pdmodel.graphics.shading.PDTriangleBasedShadingType
org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType4
org.apache.pdfbox.pdmodel.graphics.shading.PDMeshBasedShadingType
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDShadingType6
,PDShadingType7
Common resources for shading types 6 and 7
-
Field Summary
FieldsFields inherited from class org.apache.pdfbox.pdmodel.graphics.shading.PDShading
SHADING_TYPE1, SHADING_TYPE2, SHADING_TYPE3, SHADING_TYPE4, SHADING_TYPE5, SHADING_TYPE6, SHADING_TYPE7
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncollectPatches
(AffineTransform xform, Matrix matrix, int controlPoints) Create a patch list from a data stream, the returned list contains all the patches contained in the data stream.(package private) 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.abstract Rectangle2D
getBounds
(AffineTransform xform, Matrix matrix) Calculate a bounding rectangle around the areas of this shading context.(package private) Rectangle2D
getBounds
(AffineTransform xform, Matrix matrix, int controlPoints) 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) Read a single patch from a data stream, a patch contains information of its coordinates and color parameters.Methods inherited from class org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType4
collectTriangles, getBitsPerFlag, getShadingType, setBitsPerFlag, toPaint
Methods inherited from class org.apache.pdfbox.pdmodel.graphics.shading.PDTriangleBasedShadingType
getBitsPerComponent, getBitsPerCoordinate, getDecodeForParameter, getNumberOfColorComponents, interpolate, readVertex, setBitsPerComponent, setBitsPerCoordinate, setDecodeValues
Methods inherited from class org.apache.pdfbox.pdmodel.graphics.shading.PDShading
create, evalFunction, evalFunction, getAntiAlias, getBackground, getBBox, getColorSpace, getCOSObject, getFunction, getType, setAntiAlias, setBackground, setBBox, setColorSpace, setFunction, setFunction, setShadingType
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG
-
-
Constructor Details
-
PDMeshBasedShadingType
PDMeshBasedShadingType(COSDictionary shadingDictionary)
-
-
Method Details
-
collectPatches
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
- transformation for user to device spacematrix
- the pattern matrix concatenated with that of the parent content streamcontrolPoints
- number of control points, 12 for type 6 shading and 16 for type 7 shading- Returns:
- the obtained patch list
- Throws:
IOException
- when something went wrong
-
readPatch
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
- the image source data streamisFree
- whether this is a free patchimplicitEdge
- implicit edge when a patch is not free, otherwise it's not usedimplicitCornerColor
- implicit colors when a patch is not free, otherwise it's not usedmaxSrcCoord
- the maximum coordinate value calculated from source datamaxSrcColor
- the maximum color value calculated from source datarangeX
- range for coordinate xrangeY
- range for coordinate ycolRange
- range for colormatrix
- the pattern matrix concatenated with that of the parent content streamxform
- transformation for user to device spacecontrolPoints
- number of control points, 12 for type 6 shading and 16 for type 7 shading- Returns:
- a single patch
- Throws:
IOException
- when something went wrong
-
generatePatch
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
- 12 or 16 control pointscolor
- 4 corner colors- Returns:
- a patch instance
-
getBounds
Description copied from class:PDShading
Calculate a bounding rectangle around the areas of this shading context.- Overrides:
getBounds
in classPDTriangleBasedShadingType
- Returns:
- Bounding rectangle or null, if not supported by this shading type.
- Throws:
IOException
-
getBounds
- Throws:
IOException
-