Class AxialShadingContext
java.lang.Object
org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext
org.apache.pdfbox.pdmodel.graphics.shading.AxialShadingContext
- All Implemented Interfaces:
PaintContext
AWT PaintContext for axial shading.
Performance improvement done as part of GSoC2014, Tilman Hausherr is the mentor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PDShadingType2
private final int[]
private final float[]
private final float
private final double
private final float[]
private final boolean[]
private final int
private static final org.apache.commons.logging.Log
private AffineTransform
private final double
private final double
-
Constructor Summary
ConstructorsConstructorDescriptionAxialShadingContext
(PDShadingType2 shading, ColorModel colorModel, AffineTransform xform, Matrix matrix, Rectangle deviceBounds) Constructor creates an instance to be used for fill operations. -
Method Summary
Methods inherited from class org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext
convertToRGB, getBackground, getRgbBackground, getShading, getShadingColorSpace
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
axialShadingType
-
coords
private final float[] coords -
domain
private final float[] domain -
extend
private final boolean[] extend -
x1x0
private final double x1x0 -
y1y0
private final double y1y0 -
d1d0
private final float d1d0 -
denom
private final double denom -
factor
private final int factor -
colorTable
private final int[] colorTable -
rat
-
-
Constructor Details
-
AxialShadingContext
public AxialShadingContext(PDShadingType2 shading, ColorModel colorModel, AffineTransform xform, Matrix matrix, Rectangle deviceBounds) throws IOException Constructor creates an instance to be used for fill operations.- Parameters:
shading
- the shading type to be usedcolorModel
- the color model to be usedxform
- transformation for user to device spacematrix
- the pattern matrix concatenated with that of the parent content streamdeviceBounds
- the bounds of the area to paint, in device units- Throws:
IOException
- if there is an error getting the color space or doing color conversion.
-
-
Method Details
-
calcColorTable
Calculate the color on the axial line and store them in an array.- Returns:
- an array, index denotes the relative position, the corresponding value is the color on the axial line
- Throws:
IOException
- if the color conversion fails.
-
dispose
public void dispose()- Specified by:
dispose
in interfacePaintContext
- Overrides:
dispose
in classShadingContext
-
getColorModel
- Specified by:
getColorModel
in interfacePaintContext
- Overrides:
getColorModel
in classShadingContext
-
getRaster
- Specified by:
getRaster
in interfacePaintContext
-
getCoords
public float[] getCoords()Returns the coords values. -
getDomain
public float[] getDomain()Returns the domain values. -
getExtend
public boolean[] getExtend()Returns the extend values. -
getFunction
Returns the function.- Throws:
IOException
- if we were not able to create the function.
-