2
* @(#)GrayColorSliderModel.java 1.0 May 22, 2005
4
* Copyright (c) 2005 Werner Randelshofer
5
* Staldenmattweg 2, Immensee, CH-6405, Switzerland.
8
* This software is the confidential and proprietary information of
9
* Werner Randelshofer. ("Confidential Information"). You shall not
10
* disclose such Confidential Information and shall use it only in
11
* accordance with the terms of the license agreement you entered into
12
* with Werner Randelshofer.
15
package org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.colorchooser;
19
* A ColorSliderModel for a gray color model (brightness).
21
* @author Werner Randelshofer
22
* @version 1.0 May 22, 2005 Created.
24
public class GrayColorSliderModel extends ColorSliderModel {
27
* Creates a new instance.
29
public GrayColorSliderModel() {
30
super(new DefaultBoundedRangeModel[] {
31
new DefaultBoundedRangeModel(0, 0, 0, 100)
37
int br = (int) (components[0].getValue() * 2.55f);
38
return 0xff000000 | (br << 16) | (br << 8) | (br);
42
public void setRGB(int rgb) {
43
components[0].setValue((int)
45
(((rgb & 0xff0000) >> 16) + ((rgb & 0x00ff00) >> 8) + (rgb & 0x0000ff))
52
public int toRGB(int[] values) {
53
int br = (int) (values[0] * 2.55f);
54
return 0xff000000 | (br << 16) | (br << 8) | (br);