Class AxialShadingContext
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext
-
- org.apache.pdfbox.pdmodel.graphics.shading.AxialShadingContext
-
- All Implemented Interfaces:
java.awt.PaintContext
public class AxialShadingContext extends ShadingContext
AWT PaintContext for axial shading. Performance improvement done as part of GSoC2014, Tilman Hausherr is the mentor.
-
-
Field Summary
Fields Modifier and Type Field Description private PDShadingType2axialShadingTypeprivate int[]colorTableprivate float[]coordsprivate floatd1d0private doubledenomprivate float[]domainprivate boolean[]extendprivate intfactorprivate static org.apache.commons.logging.LogLOGprivate java.awt.geom.AffineTransformratprivate doublex1x0private doubley1y0
-
Constructor Summary
Constructors Constructor Description AxialShadingContext(PDShadingType2 shading, java.awt.image.ColorModel colorModel, java.awt.geom.AffineTransform xform, Matrix matrix, java.awt.Rectangle deviceBounds)Constructor creates an instance to be used for fill operations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private int[]calcColorTable()Calculate the color on the axial line and store them in an array.voiddispose()float[]getCoords()Returns the coords values.float[]getDomain()Returns the domain values.boolean[]getExtend()Returns the extend values.PDFunctiongetFunction()Returns the function.java.awt.image.RastergetRaster(int x, int y, int w, int h)-
Methods inherited from class org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext
convertToRGB, getBackground, getColorModel, getRgbBackground, getShading, getShadingColorSpace
-
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
axialShadingType
private PDShadingType2 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
private java.awt.geom.AffineTransform rat
-
-
Constructor Detail
-
AxialShadingContext
public AxialShadingContext(PDShadingType2 shading, java.awt.image.ColorModel colorModel, java.awt.geom.AffineTransform xform, Matrix matrix, java.awt.Rectangle deviceBounds) throws java.io.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:
java.io.IOException- if there is an error getting the color space or doing color conversion.
-
-
Method Detail
-
calcColorTable
private int[] calcColorTable() throws java.io.IOExceptionCalculate 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:
java.io.IOException- if the color conversion fails.
-
dispose
public void dispose()
- Specified by:
disposein interfacejava.awt.PaintContext- Overrides:
disposein classShadingContext
-
getRaster
public java.awt.image.Raster getRaster(int x, int y, int w, int h)
-
getCoords
public float[] getCoords()
Returns the coords values.- Returns:
- the coords values
-
getDomain
public float[] getDomain()
Returns the domain values.- Returns:
- the domain values
-
getExtend
public boolean[] getExtend()
Returns the extend values.- Returns:
- the extend values
-
getFunction
public PDFunction getFunction() throws java.io.IOException
Returns the function.- Returns:
- the function
- Throws:
java.io.IOException- if we were not able to create the function.
-
-