abstract class MultipleGradientPaintContext
extends java.lang.Object
implements java.awt.PaintContext
Modifier and Type | Field and Description |
---|---|
protected float |
a00
Elements of the inverse transform matrix.
|
protected float |
a01
Elements of the inverse transform matrix.
|
protected float |
a02
Elements of the inverse transform matrix.
|
protected float |
a10
Elements of the inverse transform matrix.
|
protected float |
a11
Elements of the inverse transform matrix.
|
protected float |
a12
Elements of the inverse transform matrix.
|
protected static java.lang.ref.WeakReference<java.awt.image.Raster> |
cached
The cached raster, which is reusable among instances.
|
protected static java.awt.image.ColorModel |
cachedModel
The cached ColorModel.
|
protected MultipleGradientPaint.ColorSpaceType |
colorSpace
The ColorSpace in which to perform the interpolation
|
protected MultipleGradientPaint.CycleMethod |
cycleMethod
The method to use when painting out of the gradient bounds.
|
protected int |
fastGradientArraySize
Size of gradients array for scaling the 0-1 index when looking up
colors the fast way.
|
private float[] |
fractions
Fractions array.
|
protected int[] |
gradient
Array which contains the interpolated color values for each interval,
used by calculateSingleArrayGradient().
|
protected static int |
GRADIENT_SIZE
Constant number of max colors between any 2 arbitrary colors.
|
protected static int |
GRADIENT_SIZE_INDEX |
private int[][] |
gradients
Array of gradient arrays, one array for each interval.
|
protected boolean |
isSimpleLookup
This boolean specifies whether 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.
|
private static int[] |
LinearRGBtoSRGB |
private static int |
MAX_GRADIENT_ARRAY_SIZE
Maximum length of the fast single-array.
|
protected java.awt.image.ColorModel |
model
The PaintContext's ColorModel.
|
private float[] |
normalizedIntervals
Normalized intervals array.
|
protected java.awt.image.Raster |
saved
Raster is reused whenever possible.
|
private static int[] |
SRGBtoLinearRGB
Color space conversion lookup tables.
|
private int |
transparencyTest
Used to determine if gradient colors are all opaque.
|
private static java.awt.image.ColorModel |
xrgbmodel
Color model used if gradient colors are all opaque.
|
Modifier | Constructor and Description |
---|---|
protected |
MultipleGradientPaintContext(MultipleGradientPaint mgp,
java.awt.image.ColorModel cm,
java.awt.Rectangle deviceBounds,
java.awt.geom.Rectangle2D userBounds,
java.awt.geom.AffineTransform t,
java.awt.RenderingHints hints,
float[] fractions,
java.awt.Color[] colors,
MultipleGradientPaint.CycleMethod cycleMethod,
MultipleGradientPaint.ColorSpaceType colorSpace)
Constructor for MultipleGradientPaintContext superclass.
|
Modifier and Type | Method and Description |
---|---|
private void |
calculateLookupData(java.awt.Color[] colors)
This function is the meat of this class.
|
private void |
calculateMultipleArrayGradient(java.awt.Color[] colors)
SLOW LOOKUP METHOD
This method calculates the gradient color values for each interval and
places each into its own 255 size array.
|
private void |
calculateSingleArrayGradient(java.awt.Color[] colors,
float Imin)
FAST LOOKUP METHOD
This method calculates the gradient color values and places them in a
single int array, gradient[].
|
private int |
convertEntireColorLinearRGBtoSRGB(int rgb)
Yet another helper function.
|
private static int |
convertLinearRGBtoSRGB(int color)
Helper function to convert a color component in linear RGB space to
SRGB space.
|
private static int |
convertSRGBtoLinearRGB(int color)
Helper function to convert a color component in sRGB space to linear
RGB space.
|
void |
dispose() |
protected abstract void |
fillRaster(int[] pixels,
int off,
int adjust,
int x,
int y,
int w,
int h) |
private static java.awt.image.Raster |
getCachedRaster(java.awt.image.ColorModel cm,
int w,
int h)
Took this cacheRaster code from GradientPaint.
|
java.awt.image.ColorModel |
getColorModel() |
java.awt.image.Raster |
getRaster(int x,
int y,
int w,
int h) |
protected int |
indexIntoGradientsArrays(float position)
Helper function to index into the gradients array.
|
private void |
interpolate(int rgb1,
int rgb2,
int[] output)
Yet another helper function.
|
private static void |
putCachedRaster(java.awt.image.ColorModel cm,
java.awt.image.Raster ras)
Took this cacheRaster code from GradientPaint.
|
protected java.awt.image.ColorModel model
private static java.awt.image.ColorModel xrgbmodel
protected static java.awt.image.ColorModel cachedModel
protected static java.lang.ref.WeakReference<java.awt.image.Raster> cached
protected java.awt.image.Raster saved
protected MultipleGradientPaint.CycleMethod cycleMethod
protected MultipleGradientPaint.ColorSpaceType colorSpace
protected float a00
protected float a01
protected float a10
protected float a11
protected float a02
protected float a12
protected boolean isSimpleLookup
protected int fastGradientArraySize
protected int[] gradient
private int[][] gradients
private float[] normalizedIntervals
private float[] fractions
private int transparencyTest
private static final int[] SRGBtoLinearRGB
private static final int[] LinearRGBtoSRGB
protected static final int GRADIENT_SIZE
protected static final int GRADIENT_SIZE_INDEX
private static final int MAX_GRADIENT_ARRAY_SIZE
protected MultipleGradientPaintContext(MultipleGradientPaint mgp, java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform t, java.awt.RenderingHints hints, float[] fractions, java.awt.Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace)
private void calculateLookupData(java.awt.Color[] colors)
private void calculateSingleArrayGradient(java.awt.Color[] colors, float Imin)
Imin
- the size of the smallest intervalprivate void calculateMultipleArrayGradient(java.awt.Color[] colors)
private void interpolate(int rgb1, int rgb2, int[] output)
rgb1
- the start colorrgb2
- the end coloroutput
- the output array of colors; must not be nullprivate int convertEntireColorLinearRGBtoSRGB(int rgb)
protected final int indexIntoGradientsArrays(float position)
position
- the unmanipulated position, which will be mapped
into the range 0 to 1private static int convertSRGBtoLinearRGB(int color)
private static int convertLinearRGBtoSRGB(int color)
public final java.awt.image.Raster getRaster(int x, int y, int w, int h)
getRaster
in interface java.awt.PaintContext
protected abstract void fillRaster(int[] pixels, int off, int adjust, int x, int y, int w, int h)
private static java.awt.image.Raster getCachedRaster(java.awt.image.ColorModel cm, int w, int h)
private static void putCachedRaster(java.awt.image.ColorModel cm, java.awt.image.Raster ras)
public final void dispose()
dispose
in interface java.awt.PaintContext
public final java.awt.image.ColorModel getColorModel()
getColorModel
in interface java.awt.PaintContext