Class RadialShadingContext
java.lang.Object
org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext
org.apache.pdfbox.pdmodel.graphics.shading.RadialShadingContext
- All Implemented Interfaces:
PaintContext
AWT PaintContext for radial shading.
Performance improvement done as part of GSoC2014, Tilman Hausherr is the mentor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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 final double
private final double
private PDShadingType3
private AffineTransform
private final double
private final double
-
Constructor Summary
ConstructorsConstructorDescriptionRadialShadingContext
(PDShadingType3 shading, ColorModel colorModel, AffineTransform xform, Matrix matrix, Rectangle deviceBounds) Constructor creates an instance to be used for fill operations. -
Method Summary
Modifier and TypeMethodDescriptionprivate int[]
Calculate the color on the line that connects two circles' centers and store the result in an array.private float[]
calculateInputValues
(double x, double y) void
dispose()
float[]
Returns the coords values.float[]
Returns the domain values.boolean[]
Returns the extend values.Returns the function.getRaster
(int x, int y, int w, int h) 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 -
radialShadingType
-
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 -
r1r0
private final double r1r0 -
r0pow2
private final double r0pow2 -
d1d0
private final float d1d0 -
denom
private final double denom -
factor
private final int factor -
colorTable
private final int[] colorTable -
rat
-
-
Constructor Details
-
RadialShadingContext
public RadialShadingContext(PDShadingType3 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 line that connects two circles' centers and store the result in an array.- Returns:
- an array, index denotes the relative position, the corresponding value the color
- Throws:
IOException
-
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
-
calculateInputValues
private float[] calculateInputValues(double x, double y) -
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.
-