Top Description Fields Constructors Methods
org.lwjgl.util

public final Class Color

extends Object
implements ReadableColor, Serializable, WritableColor
Class Inheritance
All Implemented Interfaces
org.lwjgl.util.WritableColor, java.io.Serializable, org.lwjgl.util.ReadableColor
Imports
java.io.Serializable, java.nio.ByteBuffer

A mutable Color class
Author
$Author$
Version
$Revision$ $Id$

Field Summary

Modifier and TypeField and Description
private byte
alpha

Color components, publicly accessible

private byte
blue

Color components, publicly accessible

private byte
green

Color components, publicly accessible

private byte
red

Color components, publicly accessible

pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
Color()

Constructor for Color.

public
Color(int r, int g, int b)

Constructor for Color.

public
Color(byte r, byte g, byte b)

Constructor for Color.

public
Color(int r, int g, int b, int a)

Constructor for Color.

public
Color(byte r, byte g, byte b, byte a)

Constructor for Color.

public
Color(ReadableColor c)

Constructor for Color

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Equals
public void
fromHSB(float
(0..1.0f)
hue
,
float
(0..1.0f)
saturation
,
float
(0..1.0f)
brightness
)

HSB to RGB conversion, pinched from java.awt.Color.

public int
public byte
getAlphaByte()

Implements org.lwjgl.util.ReadableColor.getAlphaByte.

Return the red component
public int
public byte
getBlueByte()

Implements org.lwjgl.util.ReadableColor.getBlueByte.

Return the red component
public int
public byte
getGreenByte()

Implements org.lwjgl.util.ReadableColor.getGreenByte.

Return the red component
public int
public byte
getRedByte()

Implements org.lwjgl.util.ReadableColor.getRedByte.

Return the red component
public int
hashCode()

Overrides java.lang.Object.hashCode.

Hashcode
public void
readABGR(ByteBuffer
The source buffer
src
)

Implements org.lwjgl.util.WritableColor.readABGR.

Read a color from a byte buffer
public void
readARGB(ByteBuffer
The source buffer
src
)

Implements org.lwjgl.util.WritableColor.readARGB.

Read a color from a byte buffer
public void
readBGR(ByteBuffer
The source buffer
src
)

Implements org.lwjgl.util.WritableColor.readBGR.

Read a color from a byte buffer
public void
readBGRA(ByteBuffer
The source buffer
src
)

Implements org.lwjgl.util.WritableColor.readBGRA.

Read a color from a byte buffer
public void
readRGB(ByteBuffer
The source buffer
src
)

Implements org.lwjgl.util.WritableColor.readRGB.

Read a color from a byte buffer
public void
readRGBA(ByteBuffer
The source buffer
src
)

Implements org.lwjgl.util.WritableColor.readRGBA.

Read a color from a byte buffer
public void
set(int r, int g, int b, int a)

Implements org.lwjgl.util.WritableColor.set.

Set a color
public void
set(byte r, byte g, byte b, byte a)

Implements org.lwjgl.util.WritableColor.set.

Set a color
public void
set(int r, int g, int b)

Implements org.lwjgl.util.WritableColor.set.

Set a color
public void
set(byte r, byte g, byte b)

Implements org.lwjgl.util.WritableColor.set.

Set a color
public void
setAlpha(int alpha)

Implements org.lwjgl.util.WritableColor.setAlpha.

Set the Alpha component
public void
setAlpha(byte alpha)

Implements org.lwjgl.util.WritableColor.setAlpha.

Set the Alpha component
public void
setBlue(int blue)

Implements org.lwjgl.util.WritableColor.setBlue.

Set the Blue component
public void
setBlue(byte blue)

Implements org.lwjgl.util.WritableColor.setBlue.

Set the Blue component
public void
setColor(ReadableColor
The source color
src
)

Implements org.lwjgl.util.WritableColor.setColor.

Set this color's color by copying another color
public void
setGreen(int green)

Implements org.lwjgl.util.WritableColor.setGreen.

Set the Green component
public void
setGreen(byte green)

Implements org.lwjgl.util.WritableColor.setGreen.

Set the Green component
public void
setRed(int red)

Implements org.lwjgl.util.WritableColor.setRed.

Set the Red component
public void
setRed(byte red)

Implements org.lwjgl.util.WritableColor.setRed.

Set the Red component
public float[]

Returns:

dest, or a new float array
toHSB
(float[]
Destination floats, or null
dest
)

RGB to HSB conversion, pinched from java.awt.Color.

public String
toString()

Overrides java.lang.Object.toString.

Stringify
public void
writeABGR(ByteBuffer
the buffer to write to
dest
)

Implements org.lwjgl.util.ReadableColor.writeABGR.

Write the ABGR color directly out to a ByteBuffer
public void
writeARGB(ByteBuffer
the buffer to write to
dest
)

Implements org.lwjgl.util.ReadableColor.writeARGB.

Write the ARGB color directly out to a ByteBuffer
public void
writeBGR(ByteBuffer
the buffer to write to
dest
)

Implements org.lwjgl.util.ReadableColor.writeBGR.

Write the BGR color directly out to a ByteBuffer
public void
writeBGRA(ByteBuffer
the buffer to write to
dest
)

Implements org.lwjgl.util.ReadableColor.writeBGRA.

Write the BGRA color directly out to a ByteBuffer
public void
writeRGB(ByteBuffer
the buffer to write to
dest
)

Implements org.lwjgl.util.ReadableColor.writeRGB.

Write the RGB color directly out to a ByteBuffer
public void
writeRGBA(ByteBuffer
the buffer to write to
dest
)

Implements org.lwjgl.util.ReadableColor.writeRGBA.

Write the RGBA color directly out to a ByteBuffer
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

alphaback to summary
private byte alpha

Color components, publicly accessible

blueback to summary
private byte blue

Color components, publicly accessible

greenback to summary
private byte green

Color components, publicly accessible

redback to summary
private byte red

Color components, publicly accessible

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Constructor Detail

Colorback to summary
public Color()

Constructor for Color.

Colorback to summary
public Color(int r, int g, int b)

Constructor for Color. Alpha defaults to 255.

Colorback to summary
public Color(byte r, byte g, byte b)

Constructor for Color. Alpha defaults to 255.

Colorback to summary
public Color(int r, int g, int b, int a)

Constructor for Color.

Colorback to summary
public Color(byte r, byte g, byte b, byte a)

Constructor for Color.

Colorback to summary
public Color(ReadableColor c)

Constructor for Color

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Equals

Parameters
o:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

fromHSBback to summary
public void fromHSB(float hue, float saturation, float brightness)

HSB to RGB conversion, pinched from java.awt.Color.

Parameters
hue:float

(0..1.0f)

saturation:float

(0..1.0f)

brightness:float

(0..1.0f)

getAlphaback to summary
public int getAlpha()

Implements org.lwjgl.util.ReadableColor.getAlpha.

Accessor

Returns:int

Doc from org.lwjgl.util.ReadableColor.getAlpha.

int

getAlphaByteback to summary
public byte getAlphaByte()

Implements org.lwjgl.util.ReadableColor.getAlphaByte.

Doc from org.lwjgl.util.ReadableColor.getAlphaByte.

Return the red component

Returns:byte

int

getBlueback to summary
public int getBlue()

Implements org.lwjgl.util.ReadableColor.getBlue.

Accessor

Returns:int

Doc from org.lwjgl.util.ReadableColor.getBlue.

int

getBlueByteback to summary
public byte getBlueByte()

Implements org.lwjgl.util.ReadableColor.getBlueByte.

Doc from org.lwjgl.util.ReadableColor.getBlueByte.

Return the red component

Returns:byte

int

getGreenback to summary
public int getGreen()

Implements org.lwjgl.util.ReadableColor.getGreen.

Accessor

Returns:int

Doc from org.lwjgl.util.ReadableColor.getGreen.

int

getGreenByteback to summary
public byte getGreenByte()

Implements org.lwjgl.util.ReadableColor.getGreenByte.

Doc from org.lwjgl.util.ReadableColor.getGreenByte.

Return the red component

Returns:byte

int

getRedback to summary
public int getRed()

Implements org.lwjgl.util.ReadableColor.getRed.

Accessor

Returns:int

Doc from org.lwjgl.util.ReadableColor.getRed.

int

getRedByteback to summary
public byte getRedByte()

Implements org.lwjgl.util.ReadableColor.getRedByte.

Doc from org.lwjgl.util.ReadableColor.getRedByte.

Return the red component

Returns:byte

int

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Hashcode

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

readABGRback to summary
public void readABGR(ByteBuffer src)

Implements org.lwjgl.util.WritableColor.readABGR.

Read a color from a byte buffer

Parameters
src:ByteBuffer

The source buffer

readARGBback to summary
public void readARGB(ByteBuffer src)

Implements org.lwjgl.util.WritableColor.readARGB.

Read a color from a byte buffer

Parameters
src:ByteBuffer

The source buffer

readBGRback to summary
public void readBGR(ByteBuffer src)

Implements org.lwjgl.util.WritableColor.readBGR.

Read a color from a byte buffer

Parameters
src:ByteBuffer

The source buffer

readBGRAback to summary
public void readBGRA(ByteBuffer src)

Implements org.lwjgl.util.WritableColor.readBGRA.

Read a color from a byte buffer

Parameters
src:ByteBuffer

The source buffer

readRGBback to summary
public void readRGB(ByteBuffer src)

Implements org.lwjgl.util.WritableColor.readRGB.

Read a color from a byte buffer

Parameters
src:ByteBuffer

The source buffer

readRGBAback to summary
public void readRGBA(ByteBuffer src)

Implements org.lwjgl.util.WritableColor.readRGBA.

Read a color from a byte buffer

Parameters
src:ByteBuffer

The source buffer

setback to summary
public void set(int r, int g, int b, int a)

Implements org.lwjgl.util.WritableColor.set.

Set a color

setback to summary
public void set(byte r, byte g, byte b, byte a)

Implements org.lwjgl.util.WritableColor.set.

Set a color

setback to summary
public void set(int r, int g, int b)

Implements org.lwjgl.util.WritableColor.set.

Set a color

setback to summary
public void set(byte r, byte g, byte b)

Implements org.lwjgl.util.WritableColor.set.

Set a color

setAlphaback to summary
public void setAlpha(int alpha)

Implements org.lwjgl.util.WritableColor.setAlpha.

Set the Alpha component

setAlphaback to summary
public void setAlpha(byte alpha)

Implements org.lwjgl.util.WritableColor.setAlpha.

Set the Alpha component

setBlueback to summary
public void setBlue(int blue)

Implements org.lwjgl.util.WritableColor.setBlue.

Set the Blue component

setBlueback to summary
public void setBlue(byte blue)

Implements org.lwjgl.util.WritableColor.setBlue.

Set the Blue component

setColorback to summary
public void setColor(ReadableColor src)

Implements org.lwjgl.util.WritableColor.setColor.

Set this color's color by copying another color

Parameters
src:ReadableColor

The source color

setGreenback to summary
public void setGreen(int green)

Implements org.lwjgl.util.WritableColor.setGreen.

Set the Green component

setGreenback to summary
public void setGreen(byte green)

Implements org.lwjgl.util.WritableColor.setGreen.

Set the Green component

setRedback to summary
public void setRed(int red)

Implements org.lwjgl.util.WritableColor.setRed.

Set the Red component

setRedback to summary
public void setRed(byte red)

Implements org.lwjgl.util.WritableColor.setRed.

Set the Red component

toHSBback to summary
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:float[]

Destination floats, or null

Returns:float[]

dest, or a new float array

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Stringify

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

writeABGRback to summary
public void writeABGR(ByteBuffer dest)

Implements org.lwjgl.util.ReadableColor.writeABGR.

Doc from org.lwjgl.util.ReadableColor.writeABGR.

Write the ABGR color directly out to a ByteBuffer

Parameters
dest:ByteBuffer

the buffer to write to

writeARGBback to summary
public void writeARGB(ByteBuffer dest)

Implements org.lwjgl.util.ReadableColor.writeARGB.

Doc from org.lwjgl.util.ReadableColor.writeARGB.

Write the ARGB color directly out to a ByteBuffer

Parameters
dest:ByteBuffer

the buffer to write to

writeBGRback to summary
public void writeBGR(ByteBuffer dest)

Implements org.lwjgl.util.ReadableColor.writeBGR.

Doc from org.lwjgl.util.ReadableColor.writeBGR.

Write the BGR color directly out to a ByteBuffer

Parameters
dest:ByteBuffer

the buffer to write to

writeBGRAback to summary
public void writeBGRA(ByteBuffer dest)

Implements org.lwjgl.util.ReadableColor.writeBGRA.

Doc from org.lwjgl.util.ReadableColor.writeBGRA.

Write the BGRA color directly out to a ByteBuffer

Parameters
dest:ByteBuffer

the buffer to write to

writeRGBback to summary
public void writeRGB(ByteBuffer dest)

Implements org.lwjgl.util.ReadableColor.writeRGB.

Doc from org.lwjgl.util.ReadableColor.writeRGB.

Write the RGB color directly out to a ByteBuffer

Parameters
dest:ByteBuffer

the buffer to write to

writeRGBAback to summary
public void writeRGBA(ByteBuffer dest)

Implements org.lwjgl.util.ReadableColor.writeRGBA.

Doc from org.lwjgl.util.ReadableColor.writeRGBA.

Write the RGBA color directly out to a ByteBuffer

Parameters
dest:ByteBuffer

the buffer to write to