Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.graphics.shading

public Class RadialShadingContext

extends ShadingContext
Class Inheritance
Imports
java.awt.Rectangle, java.awt.geom.AffineTransform, .NoninvertibleTransformException, java.awt.image.ColorModel, .Raster, .WritableRaster, java.io.IOException, org.apache.commons.logging.Log, .LogFactory, org.apache.pdfbox.cos.COSArray, .COSBoolean, org.apache.pdfbox.pdmodel.common.function.PDFunction, org.apache.pdfbox.util.Matrix

AWT PaintContext for radial shading. Performance improvement done as part of GSoC2014, Tilman Hausherr is the mentor.
Author
Shaola Ren

Field Summary

Modifier and TypeField and Description
private final int[]
private final float[]
private final float
private final double
private final float[]
private final boolean[]
private final int
private static final Log
private final double
private final double
private PDShadingType3
private AffineTransform
private final double
private final double

Constructor Summary

AccessConstructor and Description
public
RadialShadingContext(PDShadingType3
the shading type to be used
shading
,
ColorModel
the color model to be used
colorModel
,
AffineTransform
transformation for user to device space
xform
,
Matrix
the pattern matrix concatenated with that of the parent content stream
matrix
,
Rectangle
the bounds of the area to paint, in device units
deviceBounds
)

Constructor creates an instance to be used for fill operations.

Method Summary

Modifier and TypeMethod and Description
private int[]

Returns:

an array, index denotes the relative position, the corresponding value the color
calcColorTable
()

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)

public void
dispose()

Overrides org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext.dispose.

Implements java.awt.PaintContext.dispose.

Releases the resources allocated for the operation.

public float[]

Returns:

the coords values
getCoords
()

Returns the coords values.

public float[]

Returns:

the domain values
getDomain
()

Returns the domain values.

public boolean[]

Returns:

the extend values
getExtend
()

Returns the extend values.

public PDFunction

Returns:

the function
getFunction
()

Returns the function.

public Raster
getRaster(int
the x coordinate of the area in device space for which colors are generated.
x
,
int
the y coordinate of the area in device space for which colors are generated.
y
,
int
the width of the area in device space
w
,
int
the height of the area in device space
h
)

Implements java.awt.PaintContext.getRaster.

Returns a Raster containing the colors generated for the graphics operation.

Inherited from org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext:
convertToRGBgetBackgroundgetColorModelgetRgbBackgroundgetShadinggetShadingColorSpace

Field Detail

colorTableback to summary
private final int[] colorTable
coordsback to summary
private final float[] coords
d1d0back to summary
private final float d1d0
denomback to summary
private final double denom
domainback to summary
private final float[] domain
extendback to summary
private final boolean[] extend
factorback to summary
private final int factor
LOGback to summary
private static final Log LOG
r0pow2back to summary
private final double r0pow2
r1r0back to summary
private final double r1r0
radialShadingTypeback to summary
private PDShadingType3 radialShadingType
ratback to summary
private AffineTransform rat
x1x0back to summary
private final double x1x0
y1y0back to summary
private final double y1y0

Constructor Detail

RadialShadingContextback to summary
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:PDShadingType3

the shading type to be used

colorModel:ColorModel

the color model to be used

xform:AffineTransform

transformation for user to device space

matrix:Matrix

the pattern matrix concatenated with that of the parent content stream

deviceBounds:Rectangle

the bounds of the area to paint, in device units

Exceptions
IOException:
if there is an error getting the color space or doing color conversion.

Method Detail

calcColorTableback to summary
private int[] calcColorTable() throws IOException

Calculate the color on the line that connects two circles' centers and store the result in an array.

Returns:int[]

an array, index denotes the relative position, the corresponding value the color

calculateInputValuesback to summary
private float[] calculateInputValues(double x, double y)
disposeback to summary
public void dispose()

Overrides org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext.dispose.

Implements java.awt.PaintContext.dispose.

Doc from java.awt.PaintContext.dispose.

Releases the resources allocated for the operation.

Annotations
@Override
getCoordsback to summary
public float[] getCoords()

Returns the coords values.

Returns:float[]

the coords values

getDomainback to summary
public float[] getDomain()

Returns the domain values.

Returns:float[]

the domain values

getExtendback to summary
public boolean[] getExtend()

Returns the extend values.

Returns:boolean[]

the extend values

getFunctionback to summary
public PDFunction getFunction() throws IOException

Returns the function.

Returns:PDFunction

the function

Exceptions
IOException:
if we were not able to create the function.
getRasterback to summary
public Raster getRaster(int x, int y, int w, int h)

Implements java.awt.PaintContext.getRaster.

Doc from java.awt.PaintContext.getRaster.

Returns a Raster containing the colors generated for the graphics operation.

Parameters
x:int

the x coordinate of the area in device space for which colors are generated.

y:int

the y coordinate of the area in device space for which colors are generated.

w:int

the width of the area in device space

h:int

the height of the area in device space

Returns:Raster

a Raster representing the specified rectangular area and containing the colors generated for the graphics operation.

Annotations
@Override