org.eclipse.swt.graphics
Class Color

java.lang.Object
  |
  +--org.eclipse.swt.graphics.Color

public final class Color
extends Object

Safe:


Field Summary
(package private)  Device device
          the device where this color was created
 int handle
          Suppressed: the handle to the OS color resource (Warning: This field is platform dependent)
 
Constructor Summary
(package private) Color()
          Prevents uninitialized instances from being created outside the package.
  Color(Device device, int red, int green, int blue)
          Enabled: Constructs a new instance of this class given a device and the desired red, green and blue values expressed as ints in the range 0 to 255 (where 0 is black and 255 is full brightness).
  Color(Device device, RGB rgb)
          Enabled: Constructs a new instance of this class given a device and an RGB describing the desired red, green and blue values.
 
Method Summary
 void dispose()
          Enabled: Disposes of the operating system resources associated with the color.
 boolean equals(Object object)
          Suppressed: Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 int getBlue()
          Enabled: Returns the amount of blue in the color, from 0 to 255.
 int getGreen()
          Enabled: Returns the amount of green in the color, from 0 to 255.
 int getRed()
          Enabled: Returns the amount of red in the color, from 0 to 255.
 RGB getRGB()
          Enabled: Returns an RGB representing the receiver.
 int hashCode()
          Suppressed: Returns an integer hash code for the receiver.
(package private)  void init(Device device, int red, int green, int blue)
          Allocates the operating system resources associated with the receiver.
 boolean isDisposed()
          Enabled: Returns true if the color has been disposed, and false otherwise.
 String toString()
          Suppressed: Returns a string containing a concise, human-readable description of the receiver.
static Color win32_new(Device device, int handle)
          Suppressed: Invokes platform specific functionality to allocate a new color.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

handle

public int handle
Suppressed: the handle to the OS color resource (Warning: This field is platform dependent)


device

Device device
the device where this color was created

Constructor Detail

Color

Color()
Prevents uninitialized instances from being created outside the package.


Color

public Color(Device device,
             int red,
             int green,
             int blue)
Enabled: Constructs a new instance of this class given a device and the desired red, green and blue values expressed as ints in the range 0 to 255 (where 0 is black and 255 is full brightness). On limited color devices, the color instance created by this call may not have the same RGB values as the ones specified by the arguments. The RGB values on the returned instance will be the color values of the operating system color.

You must dispose the color when it is no longer required.

Parameters:
device - the device on which to allocate the color
red - the amount of red in the color
green - the amount of green in the color
blue - the amount of blue in the color
See Also:
dispose()

Color

public Color(Device device,
             RGB rgb)
Enabled: Constructs a new instance of this class given a device and an RGB describing the desired red, green and blue values. On limited color devices, the color instance created by this call may not have the same RGB values as the ones specified by the argument. The RGB values on the returned instance will be the color values of the operating system color.

You must dispose the color when it is no longer required.

Parameters:
device - the device on which to allocate the color
See Also:
dispose()
Method Detail

dispose

public void dispose()
Enabled: Disposes of the operating system resources associated with the color. Applications must dispose of all colors which they allocate.


equals

public boolean equals(Object object)
Suppressed: Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Overrides:
equals in class Object
Parameters:
object - the object to compare with this object
Returns:
true if the object is the same as this object and false otherwise
See Also:
hashCode()

getBlue

public int getBlue()
Enabled: Returns the amount of blue in the color, from 0 to 255.

Returns:
the blue component of the color

getGreen

public int getGreen()
Enabled: Returns the amount of green in the color, from 0 to 255.

Returns:
the green component of the color

getRed

public int getRed()
Enabled: Returns the amount of red in the color, from 0 to 255.

Returns:
the red component of the color

getRGB

public RGB getRGB()
Enabled: Returns an RGB representing the receiver.


hashCode

public int hashCode()
Suppressed: Returns an integer hash code for the receiver. Any two objects which return true when passed to equals must return the same value for this method.

Overrides:
hashCode in class Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

init

void init(Device device,
          int red,
          int green,
          int blue)
Allocates the operating system resources associated with the receiver.

Parameters:
device - the device on which to allocate the color
red - the amount of red in the color
green - the amount of green in the color
blue - the amount of blue in the color
See Also:
dispose()

isDisposed

public boolean isDisposed()
Enabled: Returns true if the color has been disposed, and false otherwise.

This method gets the dispose state for the color. When a color has been disposed, it is an error to invoke any other method using the color.

Returns:
true when the color is disposed and false otherwise

toString

public String toString()
Suppressed: Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a string representation of the receiver

win32_new

public static Color win32_new(Device device,
                              int handle)
Suppressed: Invokes platform specific functionality to allocate a new color.

IMPORTANT: This method is not part of the public API for Color. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms, and should never be called from application code.

Parameters:
device - the device on which to allocate the color
handle - the handle for the color


comments?