Groovy Documentation

eu.hansolo.gradients
[Java] Class BiLinearGradientPaint.BiLinearGradientPaintContext

java.lang.Object
  eu.hansolo.gradients.BiLinearGradientPaint.BiLinearGradientPaintContext
All Implemented Interfaces:
PaintContext

private final class BiLinearGradientPaint.BiLinearGradientPaintContext

Constructor Summary
BiLinearGradientPaint.BiLinearGradientPaintContext()

 
Method Summary
private Color bilinearInterpolateColor(Color COLOR_00, Color COLOR_10, Color COLOR_01, Color COLOR_11, float FRACTION_X, float FRACTION_Y)

Returns the color calculated by a bilinear interpolation by the two fractions in x and y direction.

void dispose()

ColorModel getColorModel()

Raster getRaster(int X, int Y, int TILE_WIDTH, int TILE_HEIGHT)

private Color interpolateColor(Color COLOR1, Color COLOR2, float fraction)

Returns the interpolated color that you get if you multiply the delta between color2 and color1 with the given fraction (for each channel).

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

BiLinearGradientPaint.BiLinearGradientPaintContext

public BiLinearGradientPaint.BiLinearGradientPaintContext()


 
Method Detail

bilinearInterpolateColor

private Color bilinearInterpolateColor(Color COLOR_00, Color COLOR_10, Color COLOR_01, Color COLOR_11, float FRACTION_X, float FRACTION_Y)
Returns the color calculated by a bilinear interpolation by the two fractions in x and y direction. To get the color of the point defined by FRACTION_X and FRACTION_Y with in the rectangle defined by the for given colors we first calculate the interpolated color between COLOR_00 and COLOR_10 (x-direction) with the given FRACTION_X. After that we calculate the interpolated color between COLOR_01 and COLOR_11 (x-direction) with the given FRACTION_X. Now we interpolate between the two results of the former calculations (y-direction) with the given FRACTION_Y.
Parameters:
COLOR_00 - The color on the lower left corner of the square
COLOR_10 - The color on the lower right corner of the square
COLOR_01 - The color on the upper left corner of the square
COLOR_11 - The color on the upper right corner of the square
FRACTION_X - The fraction of the point in x direction (between COLOR_00 and COLOR_10 or COLOR_01 and COLOR_11) range: 0.0f .. 1.0f
FRACTION_Y - The fraction of the point in y direction (between COLOR_00 and COLOR_01 or COLOR_10 and COLOR_11) range: 0.0f .. 1.0f
Returns:
the color of the point defined by fraction_x and fraction_y in the square defined by the for colors


dispose

@Override
public void dispose()


getColorModel

@Override
public ColorModel getColorModel()


getRaster

@Override
public Raster getRaster(int X, int Y, int TILE_WIDTH, int TILE_HEIGHT)


interpolateColor

private Color interpolateColor(Color COLOR1, Color COLOR2, float fraction)
Returns the interpolated color that you get if you multiply the delta between color2 and color1 with the given fraction (for each channel). The fraction should be a value between 0 and 1.
Parameters:
COLOR1 - The first color as integer in the hex format 0xALPHA RED GREEN BLUE, e.g. 0xFF00FF00 for a pure green
COLOR2 - The second color as integer in the hex format 0xALPHA RED GREEN BLUE e.g. 0xFFFF0000 for a pure red
fraction - The fraction between those two colors that we would like to get e.g. 0.5f will result in the color 0xFF808000
Returns:
the interpolated color between color1 and color2 calculated by the given fraction


 

Groovy Documentation