| java.lang.Object com.xoetrope.batik.ext.awt.MultipleGradientPaintContext
All known Subclasses: com.xoetrope.batik.ext.awt.RadialGradientPaintContext, com.xoetrope.batik.ext.awt.LinearGradientPaintContext,
MultipleGradientPaintContext | abstract class MultipleGradientPaintContext implements PaintContext(Code) | | This is the superclass for all PaintContexts which use a multiple color
gradient to fill in their raster. It provides the actual color interpolation
functionality. Subclasses only have to deal with using the gradient to fill
pixels in a raster.
author: Nicholas Talian, Vincent Hardy, Jim Graham, Jerry Evans author: Vincent Hardy version: $Id: MultipleGradientPaintContext.java,v 1.2 2006/08/31 09:28:47 val Exp $ |
Method Summary | |
final protected void | calculateGradientFractions(Color[] loColors, Color[] hiColors) This function is the meat of this class. | final public void | dispose() Release the resources allocated for the operation. | abstract protected void | fillRaster(int pixels, int off, int adjust, int x, int y, int w, int h) Subclasses should implement this. | final protected static synchronized WritableRaster | getCachedRaster(ColorModel cm, int w, int h) Took this cacheRaster code from GradientPaint. | final public ColorModel | getColorModel() Return the ColorModel of the output. | final public Raster | getRaster(int x, int y, int w, int h) Superclass getRaster... | final protected int | indexGradientAntiAlias(float position, float sz) Helper function to index into the gradients array. | final protected int | indexIntoGradientsArrays(float position) Helper function to index into the gradients array. | final protected static synchronized void | putCachedRaster(ColorModel cm, WritableRaster ras) Took this cacheRaster code from GradientPaint. |
DEBUG | final protected static boolean DEBUG(Code) | | |
GRADIENT_SIZE | final protected static int GRADIENT_SIZE(Code) | | Constant number of max colors between any 2 arbitrary colors.
Used for creating and indexing gradients arrays.
|
GRADIENT_SIZE_INDEX | final protected static int GRADIENT_SIZE_INDEX(Code) | | |
a00a01a10a11a02a12 | protected float a00a01a10a11a02a12(Code) | | Elements of the inverse transform matrix.
|
cached | protected static WeakReference cached(Code) | | The cached raster, which is reusable among instances
|
dataModel | protected ColorModel dataModel(Code) | | The color model data is generated in (always un premult).
|
fastGradientArraySize | protected int fastGradientArraySize(Code) | | Size of gradients array for scaling the 0-1 index when looking up
colors the fast way.
|
fractions | protected float[] fractions(Code) | | fractions array
|
gradient | protected int[] gradient(Code) | | Array which contains the interpolated color values for each interval,
used by calculateSingleArrayGradient(). It is protected for possible
direct access by subclasses.
|
gradientAverage | protected int gradientAverage(Code) | | This holds the blend of all colors in the gradient.
we use this at extreamly low resolutions to ensure we
get a decent blend of the colors.
|
gradientOverflow | protected int gradientOverflow(Code) | | This holds the color to use when we are off the top of the
gradient
|
gradientUnderflow | protected int gradientUnderflow(Code) | | This holds the color to use when we are off the bottom of the
gradient
|
gradients | protected int[][] gradients(Code) | | Array of gradient arrays, one array for each interval. Used by
calculateMultipleArrayGradient().
|
gradientsLength | protected int gradientsLength(Code) | | Length of the 2D slow lookup gradients array.
|
hasDiscontinuity | protected boolean hasDiscontinuity(Code) | | This boolean indicates if the gradient appears to have sudden
discontinuities in it, this may be because of multiple stops
at the same location or use of the REPEATE mode.
|
isSimpleLookup | protected boolean isSimpleLookup(Code) | | This boolean specifies wether we are in simple lookup mode, where an
input value between 0 and 1 may be used to directly index into a single
array of gradient colors. If this boolean value is false, then we have
to use a 2-step process where we have to determine which gradient array
we fall into, then determine the index into that array.
|
model | protected ColorModel model(Code) | | PaintContext's output ColorModel ARGB if colors are not all
opaque, RGB otherwise. Linear and premult are matched to
output ColorModel.
|
normalizedIntervals | protected float[] normalizedIntervals(Code) | | Normalized intervals array
|
saved | protected WritableRaster saved(Code) | | Raster is reused whenever possible
|
MultipleGradientPaintContext | public MultipleGradientPaintContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform t, RenderingHints hints, float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethodEnum cycleMethod, MultipleGradientPaint.ColorSpaceEnum colorSpace) throws NoninvertibleTransformException(Code) | | Constructor for superclass. Does some initialization, but leaves most
of the heavy-duty math for calculateGradient(), so the subclass may do
some other manipulation beforehand if necessary. This is not possible
if this computation is done in the superclass constructor which always
gets called first.
|
calculateGradientFractions | final protected void calculateGradientFractions(Color[] loColors, Color[] hiColors)(Code) | | This function is the meat of this class. It calculates an array of
gradient colors based on an array of fractions and color values at those
fractions.
|
dispose | final public void dispose()(Code) | | Release the resources allocated for the operation.
|
fillRaster | abstract protected void fillRaster(int pixels, int off, int adjust, int x, int y, int w, int h)(Code) | | Subclasses should implement this.
|
getCachedRaster | final protected static synchronized WritableRaster getCachedRaster(ColorModel cm, int w, int h)(Code) | | Took this cacheRaster code from GradientPaint. It appears to recycle
rasters for use by any other instance, as long as they are sufficiently
large.
|
getColorModel | final public ColorModel getColorModel()(Code) | | Return the ColorModel of the output.
|
getRaster | final public Raster getRaster(int x, int y, int w, int h)(Code) | | Superclass getRaster...
|
indexGradientAntiAlias | final protected int indexGradientAntiAlias(float position, float sz)(Code) | | Helper function to index into the gradients array. This is necessary
because each interval has an array of colors with uniform size 255.
However, the color intervals are not necessarily of uniform length, so
a conversion is required. This version also does anti-aliasing by
averaging the gradient over position+/-(sz/2).
Parameters: position - the unmanipulated position. want to map this into therange 0 to 1 Parameters: sz - the size in gradient space to average. |
indexIntoGradientsArrays | final protected int indexIntoGradientsArrays(float position)(Code) | | Helper function to index into the gradients array. This is necessary
because each interval has an array of colors with uniform size 255.
However, the color intervals are not necessarily of uniform length, so
a conversion is required.
Parameters: position - the unmanipulated position. want to map this into therange 0 to 1 |
putCachedRaster | final protected static synchronized void putCachedRaster(ColorModel cm, WritableRaster ras)(Code) | | Took this cacheRaster code from GradientPaint. It appears to recycle
rasters for use by any other instance, as long as they are sufficiently
large.
|
|
|