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

public abstract Class ShadingContext

extends Object
implements PaintContext
Class Inheritance
All Implemented Interfaces
java.awt.PaintContext
Known Direct Subclasses
org.apache.pdfbox.pdmodel.graphics.shading.TriangleBasedShadingContext, org.apache.pdfbox.pdmodel.graphics.shading.Type1ShadingContext, org.apache.pdfbox.pdmodel.graphics.shading.AxialShadingContext, org.apache.pdfbox.pdmodel.graphics.shading.RadialShadingContext
Imports
java.awt.PaintContext, .Transparency, java.awt.color.ColorSpace, java.awt.geom.AffineTransform, java.awt.image.ColorModel, .ComponentColorModel, .DataBuffer, java.io.IOException, org.apache.pdfbox.cos.COSArray, org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace, org.apache.pdfbox.util.Matrix

A base class to handle what is common to all shading types.
Authors
Shaola Ren, Tilman Hausherr

Field Summary

Modifier and TypeField and Description
private float[]
private ColorModel
private int
private final PDShading
private PDColorSpace

Constructor Summary

AccessConstructor and Description
public
ShadingContext(PDShading
the shading type to be used
shading
,
ColorModel
the color model to be used
cm
,
AffineTransform
transformation for user to device space
xform
,
Matrix
the pattern matrix concatenated with that of the parent content stream
matrix
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv final int

Returns:

RGB values encoded in an integer.
convertToRGB
(float[]
color values in shading colorspace.
values
)

Convert color values from shading colorspace to RGB color values encoded into an integer.

public void
dispose()

Implements java.awt.PaintContext.dispose.

Releases the resources allocated for the operation.

pack-priv float[]
public ColorModel
getColorModel()

Implements java.awt.PaintContext.getColorModel.

Returns the ColorModel of the output.

pack-priv int
pack-priv PDShading
pack-priv PDColorSpace
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

backgroundback to summary
private float[] background
outputColorModelback to summary
private ColorModel outputColorModel
rgbBackgroundback to summary
private int rgbBackground
shadingback to summary
private final PDShading shading
shadingColorSpaceback to summary
private PDColorSpace shadingColorSpace

Constructor Detail

ShadingContextback to summary
public ShadingContext(PDShading shading, ColorModel cm, AffineTransform xform, Matrix matrix) throws IOException

Constructor.

Parameters
shading:PDShading

the shading type to be used

cm: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

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

Method Detail

convertToRGBback to summary
pack-priv final int convertToRGB(float[] values) throws IOException

Convert color values from shading colorspace to RGB color values encoded into an integer.

Parameters
values:float[]

color values in shading colorspace.

Returns:int

RGB values encoded in an integer.

Exceptions
IOException:
if the color conversion fails.
disposeback to summary
public void dispose()

Implements java.awt.PaintContext.dispose.

Doc from java.awt.PaintContext.dispose.

Releases the resources allocated for the operation.

Annotations
@Override
getBackgroundback to summary
pack-priv float[] getBackground()
getColorModelback to summary
public ColorModel getColorModel()

Implements java.awt.PaintContext.getColorModel.

Doc from java.awt.PaintContext.getColorModel.

Returns the ColorModel of the output. Note that this ColorModel might be different from the hint specified in the createContext method of Paint. Not all PaintContext objects are capable of generating color patterns in an arbitrary ColorModel.

Returns:ColorModel

the ColorModel of the output.

Annotations
@Override
getRgbBackgroundback to summary
pack-priv int getRgbBackground()
getShadingback to summary
pack-priv PDShading getShading()
getShadingColorSpaceback to summary
pack-priv PDColorSpace getShadingColorSpace()