/** * Constructs a new instance of this class given a device, an <code>RGB</code> 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. * * <p>You must dispose the color when it is no longer required. * * @param device the device on which to allocate the color * @param rgb the RGB values of the desired color * @param alpha the alpha value of the desired color. Currently, SWT only honors extreme values * for alpha i.e. 0 (transparent) or 255 (opaque). * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device * <li>ERROR_NULL_ARGUMENT - if the rgb argument is null * <li>ERROR_INVALID_ARGUMENT - if the red, green, blue or alpha components of the argument * are not between 0 and 255 * </ul> * * @see #dispose * @since 3.104 */ public Color(Device device, RGB rgb, int alpha) { super(device); if (rgb == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); init(rgb.red, rgb.green, rgb.blue, alpha); init(); }
/** * 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. * * <p>You must dispose the color when it is no longer required. * * @param device the device on which to allocate the color * @param red the amount of red in the color * @param green the amount of green in the color * @param blue the amount of blue in the color * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255 * </ul> * * @see #dispose */ public Color(Device device, int red, int green, int blue) { super(device); init(red, green, blue, 255); init(); }
/** * 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). * 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. * * <p>You must dispose the color when it is no longer required. * * @param device the device on which to allocate the color * @param red the amount of red in the color * @param green the amount of green in the color * @param blue the amount of blue in the color * @param alpha the amount of alpha in the color. Currently, SWT only honors extreme values for * alpha i.e. 0 (transparent) or 255 (opaque). * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device * <li>ERROR_INVALID_ARGUMENT - if the red, green, blue or alpha argument is not between 0 * and 255 * </ul> * * @see #dispose * @since 3.104 */ public Color(Device device, int red, int green, int blue, int alpha) { super(device); init(red, green, blue, alpha); init(); }