Class ShadingContext
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext
-
- Direct Known Subclasses:
AxialShadingContext
,RadialShadingContext
,TriangleBasedShadingContext
,Type1ShadingContext
public abstract class ShadingContext extends java.lang.Object
A base class to handle what is common to all shading types.
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
background
private java.awt.image.ColorModel
outputColorModel
private int
rgbBackground
private PDShading
shading
private PDColorSpace
shadingColorSpace
-
Constructor Summary
Constructors Constructor Description ShadingContext(PDShading shading, java.awt.image.ColorModel cm, java.awt.geom.AffineTransform xform, Matrix matrix)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
convertToRGB(float[] values)
Convert color values from shading colorspace to RGB color values encoded into an integer.(package private) void
dispose()
(package private) float[]
getBackground()
(package private) java.awt.image.ColorModel
getColorModel()
(package private) int
getRgbBackground()
(package private) PDShading
getShading()
(package private) PDColorSpace
getShadingColorSpace()
-
-
-
Field Detail
-
background
private float[] background
-
rgbBackground
private int rgbBackground
-
shading
private final PDShading shading
-
outputColorModel
private java.awt.image.ColorModel outputColorModel
-
shadingColorSpace
private PDColorSpace shadingColorSpace
-
-
Constructor Detail
-
ShadingContext
public ShadingContext(PDShading shading, java.awt.image.ColorModel cm, java.awt.geom.AffineTransform xform, Matrix matrix) throws java.io.IOException
Constructor.- Parameters:
shading
- the shading type to be usedcm
- the color model to be usedxform
- transformation for user to device spacematrix
- the pattern matrix concatenated with that of the parent content stream- Throws:
java.io.IOException
- if there is an error getting the color space or doing background color conversion.
-
-
Method Detail
-
getShadingColorSpace
PDColorSpace getShadingColorSpace()
-
getShading
PDShading getShading()
-
getBackground
float[] getBackground()
-
getRgbBackground
int getRgbBackground()
-
convertToRGB
final int convertToRGB(float[] values) throws java.io.IOException
Convert color values from shading colorspace to RGB color values encoded into an integer.- Parameters:
values
- color values in shading colorspace.- Returns:
- RGB values encoded in an integer.
- Throws:
java.io.IOException
- if the color conversion fails.
-
getColorModel
java.awt.image.ColorModel getColorModel()
-
dispose
void dispose()
-
-