public class Color extends Resource
RGB
,
Device.getSystemColor(int)
Constructor and Description |
---|
Color(Device device,
int red,
int green,
int blue)
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,
int red,
int green,
int blue,
int alpha)
Constructs a new instance of this class given a device and the
desired red, green, blue & alpha values expressed as ints in the range
0 to 255 (where 0 is black and 255 is full brightness).
|
Color(Device device,
RGB rgb)
Constructs a new instance of this class given a device and an
RGB describing the desired red, green and blue values. |
Color(Device device,
RGBA rgba)
Constructs a new instance of this class given a device and an
RGBA describing the desired red, green, blue & alpha values. |
Color(Device device,
RGB rgb,
int alpha)
Constructs a new instance of this class given a device, an
RGB describing the desired red, green and blue values,
alpha specifying the level of transparency. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object)
Compares the argument to the receiver, and returns true if they represent
the same object using a class specific comparison.
|
int |
getAlpha()
Returns the amount of alpha in the color, from 0 (transparent) to 255 (opaque).
|
int |
getBlue()
Returns the amount of blue in the color, from 0 to 255.
|
int |
getGreen()
Returns the amount of green in the color, from 0 to 255.
|
int |
getRed()
Returns the amount of red in the color, from 0 to 255.
|
RGB |
getRGB()
Returns an
RGB representing the receiver. |
RGBA |
getRGBA()
Returns an
RGBA representing the receiver. |
int |
hashCode()
Returns an integer hash code for the receiver.
|
java.lang.String |
toString()
Returns a string containing a concise, human-readable description of the
receiver.
|
dispose, getDevice, isDisposed
public Color(Device device, RGB rgb)
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.
device
- the device on which to allocate the colorrgb
- the RGB values of the desired colorjava.lang.IllegalArgumentException
- Resource.dispose()
public Color(Device device, RGB rgb, int alpha)
RGB
describing the desired red, green and blue values,
alpha specifying the level of transparency.
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.
device
- the device on which to allocate the colorrgb
- the RGB values of the desired coloralpha
- the alpha value of the desired color. Currently, SWT only honors extreme values for alpha i.e. 0 (transparent) or 255 (opaque).java.lang.IllegalArgumentException
- Resource.dispose()
public Color(Device device, RGBA rgba)
RGBA
describing the desired red, green, blue & alpha values.
On limited color devices, the color instance created by this call
may not have the same RGBA values as the ones specified by the
argument. The RGBA values on the returned instance will be the color
values of the operating system color + alpha.
You must dispose the color when it is no longer required.
device
- the device on which to allocate the colorrgba
- the RGBA values of the desired color. Currently, SWT only honors extreme values for alpha i.e. 0 (transparent) or 255 (opaque).java.lang.IllegalArgumentException
- Resource.dispose()
public Color(Device device, int red, int green, int blue)
You must dispose the color when it is no longer required.
device
- the device on which to allocate the colorred
- the amount of red in the colorgreen
- the amount of green in the colorblue
- the amount of blue in the colorjava.lang.IllegalArgumentException
- Resource.dispose()
public Color(Device device, int red, int green, int blue, int alpha)
You must dispose the color when it is no longer required.
device
- the device on which to allocate the colorred
- the amount of red in the colorgreen
- the amount of green in the colorblue
- the amount of blue in the coloralpha
- the amount of alpha in the color. Currently, SWT only honors extreme values for alpha i.e. 0 (transparent) or 255 (opaque).java.lang.IllegalArgumentException
- Resource.dispose()
public int getBlue()
SWTException
- public int getGreen()
SWTException
- public int getRed()
SWTException
- public int getAlpha()
SWTException
- public RGB getRGB()
RGB
representing the receiver.SWTException
- public RGBA getRGBA()
RGBA
representing the receiver.SWTException
- public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- the object to compare with this objecttrue
if the object is the same as this object and
false
otherwisehashCode()
public int hashCode()
true
when passed to equals
must return the
same value for this method.hashCode
in class java.lang.Object
equals(java.lang.Object)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) EclipseSource and others 2002, 2020.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0