RGB

Instances of this class are descriptions of colors in terms of the primary additive color model (red, green and blue). A color may be described in terms of the relative intensities of these three primary colors. The brightness of each color is specified by a value in the range 0 to 255, where 0 indicates no color (blackness) and 255 indicates maximum intensity. <p> The hashCode() method in this class uses the values of the public fields to compute the hash value. When storing instances of the class in hashed collections, do not modify these fields after the object has been inserted. </p> <p> Application code does <em>not</em> need to explicitly release the resources managed by each instance when those instances are no longer required, and thus no <code>dispose()</code> method is provided. </p>

@see Color @see <a href="http://www.eclipse.org/swt/snippets/#color">Color and RGB snippets</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

Constructors

this
this(int red, int green, int blue)

Constructs an instance of this class with the given red, green and blue values.

this
this(float hue, float saturation, float brightness)

Constructs an instance of this class with the given hue, saturation, and brightness. * @param hue the hue value for the HSB color (from 0 to 360) @param saturation the saturation value for the HSB color (from 0 to 1) @param brightness the brightness value for the HSB color (from 0 to 1) * @exception IllegalArgumentException <ul> <li>ERROR_INVALID_ARGUMENT - if the hue is not between 0 and 360 or the saturation or brightness is not between 0 and 1</li> </ul> * @since 3.2

Members

Functions

getHSB
float[] getHSB()

Returns the hue, saturation, and brightness of the color.

opEquals
equals_t opEquals(Object object)

Compares the argument to the receiver, and returns true if they represent the <em>same</em> object using a class specific comparison.

toHash
hash_t toHash()

Returns an integer hash code for the receiver. Any two objects that return <code>true</code> when passed to <code>equals</code> must return the same value for this method.

toString
String toString()

Returns a String containing a concise, human-readable description of the receiver.

Variables

blue
int blue;

the blue component of the RGB

green
int green;

the green component of the RGB

red
int red;

the red component of the RGB

Meta