Class ColorSliderModel
java.lang.Object
org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.colorchooser.ColorSliderModel
- Direct Known Subclasses:
GrayColorSliderModel
,HSBColorSliderModel
,ICC_CMYKColorSliderModel
,NominalCMYKColorSliderModel
,RGBColorSliderModel
Abstract super class for ColorModels which can be used in conjunction with
ColorSliderUI user interface delegates.
Colors are represented as arrays of color components represented as BoundedRangeModel's. Each BoundedRangeModel can be visualized using a JSlider having a ColorSliderUI.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DefaultBoundedRangeModel[]
Components of the color model.protected int[]
Speed optimization. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ColorSliderModel
(DefaultBoundedRangeModel[] components) Creates a new ColorSliderModel with an array of BoundedRangeModel's for the color components. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
addColorSlider
(JSlider slider) void
configureColorSlider
(int component, JSlider slider) Configures a JSlider for this ColorSliderModel.protected void
fireColorChanged
(int componentIndex) void
getBoundedRangeModel
(int component) Returns the bounded range model of the specified color component.getColor()
int
Returns the number of components of this color component model.int
getInterpolatedRGB
(int component, float ratio) Returns an interpolated RGB value by using the values of the color components of this ColorSliderModel except for the component specified as an argument.abstract int
getRGB()
int
getValue
(int component) Returns the value of the specified color component.void
protected void
removeColorSlider
(JSlider slider) void
abstract void
setRGB
(int rgb) void
setValue
(int component, int value) Sets the value of the specified color component.abstract int
toRGB
(int[] values) void
unconfigureColorSlider
(JSlider slider) Unconfigures a JSlider from this ColorSliderModel.
-
Field Details
-
components
Components of the color model. -
values
protected int[] valuesSpeed optimization. This way, we do not need to create a new array for each invocation of method getInterpolatedRGB(). Note: This variable must not use in reentrant methods.
-
-
Constructor Details
-
ColorSliderModel
Creates a new ColorSliderModel with an array of BoundedRangeModel's for the color components.
-
-
Method Details
-
configureColorSlider
Configures a JSlider for this ColorSliderModel. If the JSlider is already configured for another ColorSliderModel, it is unconfigured first. -
unconfigureColorSlider
Unconfigures a JSlider from this ColorSliderModel. -
getComponentCount
public int getComponentCount()Returns the number of components of this color component model. -
getBoundedRangeModel
Returns the bounded range model of the specified color component. -
getValue
public int getValue(int component) Returns the value of the specified color component. -
setValue
public void setValue(int component, int value) Sets the value of the specified color component. -
getInterpolatedRGB
public int getInterpolatedRGB(int component, float ratio) Returns an interpolated RGB value by using the values of the color components of this ColorSliderModel except for the component specified as an argument. For this component the ratio between zero and the maximum of its BoundedRangeModel is used. -
addColorSlider
-
removeColorSlider
-
addChangeListener
-
removeChangeListener
-
fireColorChanged
protected void fireColorChanged(int componentIndex) -
fireStateChanged
public void fireStateChanged() -
getColor
-
setColor
-
setRGB
public abstract void setRGB(int rgb) -
getRGB
public abstract int getRGB() -
toRGB
public abstract int toRGB(int[] values)
-