Package org.lwjgl.util
Class Color
java.lang.Object
org.lwjgl.util.Color
- All Implemented Interfaces:
Serializable,ReadableColor,WritableColor
A mutable Color class
- Version:
- $Revision$ $Id$
- Author:
- $Author$
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanEqualsvoidfromHSB(float hue, float saturation, float brightness) HSB to RGB conversion, pinched from java.awt.Color.intgetAlpha()AccessorbyteReturn the red componentintgetBlue()AccessorbyteReturn the red componentintgetGreen()AccessorbyteReturn the red componentintgetRed()AccessorbyteReturn the red componentinthashCode()HashcodevoidreadABGR(ByteBuffer src) Read a color from a byte buffervoidreadARGB(ByteBuffer src) Read a color from a byte buffervoidreadBGR(ByteBuffer src) Read a color from a byte buffervoidreadBGRA(ByteBuffer src) Read a color from a byte buffervoidreadRGB(ByteBuffer src) Read a color from a byte buffervoidreadRGBA(ByteBuffer src) Read a color from a byte buffervoidset(byte r, byte g, byte b) Set a colorvoidset(byte r, byte g, byte b, byte a) Set a colorvoidset(int r, int g, int b) Set a colorvoidset(int r, int g, int b, int a) Set a colorvoidsetAlpha(byte alpha) Set the Alpha componentvoidsetAlpha(int alpha) Set the Alpha componentvoidsetBlue(byte blue) Set the Blue componentvoidsetBlue(int blue) Set the Blue componentvoidsetColor(ReadableColor src) Set this color's color by copying another colorvoidsetGreen(byte green) Set the Green componentvoidsetGreen(int green) Set the Green componentvoidsetRed(byte red) Set the Red componentvoidsetRed(int red) Set the Red componentfloat[]toHSB(float[] dest) RGB to HSB conversion, pinched from java.awt.Color.toString()StringifyvoidwriteABGR(ByteBuffer dest) Write the ABGR color directly out to a ByteBuffervoidwriteARGB(ByteBuffer dest) Write the ARGB color directly out to a ByteBuffervoidwriteBGR(ByteBuffer dest) Write the BGR color directly out to a ByteBuffervoidwriteBGRA(ByteBuffer dest) Write the BGRA color directly out to a ByteBuffervoidwriteRGB(ByteBuffer dest) Write the RGB color directly out to a ByteBuffervoidwriteRGBA(ByteBuffer dest) Write the RGBA color directly out to a ByteBuffer
-
Constructor Details
-
Color
public Color()Constructor for Color. -
Color
public Color(int r, int g, int b) Constructor for Color. Alpha defaults to 255. -
Color
public Color(byte r, byte g, byte b) Constructor for Color. Alpha defaults to 255. -
Color
public Color(int r, int g, int b, int a) Constructor for Color. -
Color
public Color(byte r, byte g, byte b, byte a) Constructor for Color. -
Color
Constructor for Color
-
-
Method Details
-
set
public void set(int r, int g, int b, int a) Set a color- Specified by:
setin interfaceWritableColor
-
set
public void set(byte r, byte g, byte b, byte a) Set a color- Specified by:
setin interfaceWritableColor
-
set
public void set(int r, int g, int b) Set a color- Specified by:
setin interfaceWritableColor
-
set
public void set(byte r, byte g, byte b) Set a color- Specified by:
setin interfaceWritableColor
-
getRed
public int getRed()Accessor- Specified by:
getRedin interfaceReadableColor- Returns:
- int
-
getGreen
public int getGreen()Accessor- Specified by:
getGreenin interfaceReadableColor- Returns:
- int
-
getBlue
public int getBlue()Accessor- Specified by:
getBluein interfaceReadableColor- Returns:
- int
-
getAlpha
public int getAlpha()Accessor- Specified by:
getAlphain interfaceReadableColor- Returns:
- int
-
setRed
public void setRed(int red) Set the Red component- Specified by:
setRedin interfaceWritableColor
-
setGreen
public void setGreen(int green) Set the Green component- Specified by:
setGreenin interfaceWritableColor
-
setBlue
public void setBlue(int blue) Set the Blue component- Specified by:
setBluein interfaceWritableColor
-
setAlpha
public void setAlpha(int alpha) Set the Alpha component- Specified by:
setAlphain interfaceWritableColor
-
setRed
public void setRed(byte red) Set the Red component- Specified by:
setRedin interfaceWritableColor
-
setGreen
public void setGreen(byte green) Set the Green component- Specified by:
setGreenin interfaceWritableColor
-
setBlue
public void setBlue(byte blue) Set the Blue component- Specified by:
setBluein interfaceWritableColor
-
setAlpha
public void setAlpha(byte alpha) Set the Alpha component- Specified by:
setAlphain interfaceWritableColor
-
toString
Stringify -
equals
Equals -
hashCode
public int hashCode()Hashcode -
getAlphaByte
public byte getAlphaByte()Description copied from interface:ReadableColorReturn the red component- Specified by:
getAlphaBytein interfaceReadableColor- Returns:
- int
-
getBlueByte
public byte getBlueByte()Description copied from interface:ReadableColorReturn the red component- Specified by:
getBlueBytein interfaceReadableColor- Returns:
- int
-
getGreenByte
public byte getGreenByte()Description copied from interface:ReadableColorReturn the red component- Specified by:
getGreenBytein interfaceReadableColor- Returns:
- int
-
getRedByte
public byte getRedByte()Description copied from interface:ReadableColorReturn the red component- Specified by:
getRedBytein interfaceReadableColor- Returns:
- int
-
writeRGBA
Description copied from interface:ReadableColorWrite the RGBA color directly out to a ByteBuffer- Specified by:
writeRGBAin interfaceReadableColor- Parameters:
dest- the buffer to write to
-
writeRGB
Description copied from interface:ReadableColorWrite the RGB color directly out to a ByteBuffer- Specified by:
writeRGBin interfaceReadableColor- Parameters:
dest- the buffer to write to
-
writeABGR
Description copied from interface:ReadableColorWrite the ABGR color directly out to a ByteBuffer- Specified by:
writeABGRin interfaceReadableColor- Parameters:
dest- the buffer to write to
-
writeARGB
Description copied from interface:ReadableColorWrite the ARGB color directly out to a ByteBuffer- Specified by:
writeARGBin interfaceReadableColor- Parameters:
dest- the buffer to write to
-
writeBGR
Description copied from interface:ReadableColorWrite the BGR color directly out to a ByteBuffer- Specified by:
writeBGRin interfaceReadableColor- Parameters:
dest- the buffer to write to
-
writeBGRA
Description copied from interface:ReadableColorWrite the BGRA color directly out to a ByteBuffer- Specified by:
writeBGRAin interfaceReadableColor- Parameters:
dest- the buffer to write to
-
readRGBA
Read a color from a byte buffer- Specified by:
readRGBAin interfaceWritableColor- Parameters:
src- The source buffer
-
readRGB
Read a color from a byte buffer- Specified by:
readRGBin interfaceWritableColor- Parameters:
src- The source buffer
-
readARGB
Read a color from a byte buffer- Specified by:
readARGBin interfaceWritableColor- Parameters:
src- The source buffer
-
readBGRA
Read a color from a byte buffer- Specified by:
readBGRAin interfaceWritableColor- Parameters:
src- The source buffer
-
readBGR
Read a color from a byte buffer- Specified by:
readBGRin interfaceWritableColor- Parameters:
src- The source buffer
-
readABGR
Read a color from a byte buffer- Specified by:
readABGRin interfaceWritableColor- Parameters:
src- The source buffer
-
setColor
Set this color's color by copying another color- Specified by:
setColorin interfaceWritableColor- Parameters:
src- The source color
-
fromHSB
public void fromHSB(float hue, float saturation, float brightness) HSB to RGB conversion, pinched from java.awt.Color.- Parameters:
hue- (0..1.0f)saturation- (0..1.0f)brightness- (0..1.0f)
-
toHSB
public float[] toHSB(float[] dest) RGB to HSB conversion, pinched from java.awt.Color. The HSB value is returned in dest[] if dest[] is supplied. Values range from 0..1- Parameters:
dest- Destination floats, or null- Returns:
- dest, or a new float array
-