Package org.web3d.util
Class ColorUtils
java.lang.Object
org.web3d.util.ColorUtils
An interpolator that works with color components.
The interpolation routine is just a simple linear interpolation between each of the points. The interpolator may take arbitrarily spaced keyframes and compute correct values.
Color interpolation can be done in the standard RGB space (LINEAR) or using the additional type of HSV_LINEAR. This internally converts all color values to HSV space and then interpolates over that instead.
The RGB<->HSV color space conversions have been taken from Foley & van Dam Computer Graphics Principles and Practice, 2nd Edition, Addison Wesley, 1990.
- Version:
- $Revision: 1.3 $
- Author:
- Justin Couch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
convertHSVtoRGB
(float[] hsv, float[] rgb) Change an RGB color to HSV color.static void
convertHSVtoRGB
(float h, float s, float v, float[] rgb) Change an RGB color to HSV color.static void
convertRGBtoHSV
(float[] rgb, float[] hsv) Change an RGB color to HSV color.static void
convertRGBtoHSV
(float r, float g, float b, float[] hsv) Change an RGB color to HSV color.
-
Constructor Details
-
ColorUtils
public ColorUtils()
-
-
Method Details
-
convertRGBtoHSV
public static void convertRGBtoHSV(float[] rgb, float[] hsv) Change an RGB color to HSV color. The value is left in the sharedVector array for copying. We don't bother converting the alpha as that stays the same regardless of color space.- Parameters:
rgb
- The array of RGB components to converthsv
- An array to return the colour values with
-
convertRGBtoHSV
public static void convertRGBtoHSV(float r, float g, float b, float[] hsv) Change an RGB color to HSV color. The value is left in the sharedVector array for copying. We don't bother converting the alpha as that stays the same regardless of color space.- Parameters:
r
- The r component of the color at this keyg
- The g component of the color at this keyb
- The b component of the color at this keyhsv
- An array to return the HSV colour values in
-
convertHSVtoRGB
public static void convertHSVtoRGB(float[] hsv, float[] rgb) Change an RGB color to HSV color. The value is left in the sharedVector array for copying. We don't bother converting the alpha as that stays the same regardless of color space.- Parameters:
hsv
- The three components of the color at this keyrgb
- An array to return the RGB colour values in
-
convertHSVtoRGB
public static void convertHSVtoRGB(float h, float s, float v, float[] rgb) Change an RGB color to HSV color. The value is left in the sharedVector array for copying. We don't bother converting the alpha as that stays the same regardless of color space.- Parameters:
h
- The h component of the color at this keys
- The s component of the color at this keyv
- The v component of the color at this keyrgb
- An array to return the RGB colour values in
-