abstract class MultipleGradientContext
extends java.lang.Object
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 int |
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 |
MAX_GRADIENT_ARRAY_SIZE
Maximum length of the fast single-array.
|
private float[] |
normalizedIntervals
Normalized intervals array.
|
private int |
transparencyTest
Used to determine if gradient colors are all opaque.
|
Modifier | Constructor and Description |
---|---|
protected |
MultipleGradientContext(Gradient mgp,
BaseTransform t,
float[] fractions,
Color[] colors,
int cycleMethod)
Constructor for MultipleGradientContext superclass.
|
Modifier and Type | Method and Description |
---|---|
private void |
calculateLookupData(Color[] colors)
This function is the meat of this class.
|
private void |
calculateMultipleArrayGradient(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(Color[] colors,
float Imin)
FAST LOOKUP METHOD
This method calculates the gradient color values and places them in a
single int array, gradient[].
|
protected abstract void |
fillRaster(int[] pixels,
int off,
int adjust,
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.
|
protected int cycleMethod
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
protected static final int GRADIENT_SIZE
protected static final int GRADIENT_SIZE_INDEX
private static final int MAX_GRADIENT_ARRAY_SIZE
protected MultipleGradientContext(Gradient mgp, BaseTransform t, float[] fractions, Color[] colors, int cycleMethod)
private void calculateLookupData(Color[] colors)
private void calculateSingleArrayGradient(Color[] colors, float Imin)
Imin
- the size of the smallest intervalprivate void calculateMultipleArrayGradient(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 nullprotected final int indexIntoGradientsArrays(float position)
position
- the unmanipulated position, which will be mapped
into the range 0 to 1protected abstract void fillRaster(int[] pixels, int off, int adjust, int x, int y, int w, int h)