Class ColorModelTab
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
com.iizigo.prop.editor.color.swt.ColorModelTab
- All Implemented Interfaces:
Drawable
A color-model tab of the SWT color chooser (CC-COLOR-CHOOSER-SWT-PANELS, 2026-10-10): HSV, HSL, RGB or CMYK. Per channel a label, a slider (
Scale) and a Spinner; for HSV and HSL a two-dimensional diagram of saturation against value or lightness at the current hue and a vertical hue strip. A change of any control recomputes the color and hands it to the chooser, which updates the other tabs, the hex field and the preview; a change from elsewhere sets the channels from the color.The channels are kept as floats (hue in degrees, the others in [0,1]) so that moving one slider never drifts the others through rounding; the hue is kept when the color turns gray through the slider that made it gray.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intThe models.static final intConstructor Summary
ConstructorsConstructorDescriptionColorModelTab(Composite parent, int model, ColorChooserComposite chooser, Font font, int fontHeight, int argb, ChooserColors colors) Creates the tab.Method Summary
Modifier and TypeMethodDescriptionbooleanCommits a value typed in a spinner and not yet entered: the spinner's text is parsed and, when it differs from the spinner's value, applied as if entered.floatgetChannel(int channel) Gets a channel: the hue in degrees, the others in[0,1].intGets the number of channels.Gets the hue strip, null for RGB and CMYK.getLabel(int channel) Gets the label of a channel.intgetModel()Gets the model.getPlane()Gets the two-dimensional diagram, null for RGB and CMYK.getScale(int channel) Gets the slider of a channel.getSpinner(int channel) Gets the spinner of a channel.static StringnameOf(int model) Gets the tab name of a model.voidupdate(int argb) The chooser's color changed: the channels follow unless this tab produced the color.Methods inherited from class Composite
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods inherited from class Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setAutoscalingMode, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class Widget
addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setDataMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Drawable
isAutoScalable
Field Details
HSV
public static final int HSVThe models.- See Also:
HSL
public static final int HSL- See Also:
RGB
public static final int RGB- See Also:
CMYK
public static final int CMYK- See Also:
Constructor Details
ColorModelTab
public ColorModelTab(Composite parent, int model, ColorChooserComposite chooser, Font font, int fontHeight, int argb, ChooserColors colors) Creates the tab.- Parameters:
parent- The parent.model-HSV,HSL,RGBorCMYK.chooser- The chooser.font- The dialog font, or null for the default.fontHeight- The height of the dialog font's metrics in points, for the diagram sizes.argb- The initial color.colors- The theme colors: this page's background, the marker pair of the diagrams.
Method Details
nameOf
Gets the tab name of a model.getModel
public int getModel()Gets the model.getChannelCount
public int getChannelCount()Gets the number of channels.getLabel
Gets the label of a channel.getScale
Gets the slider of a channel.getSpinner
Gets the spinner of a channel.getPlane
Gets the two-dimensional diagram, null for RGB and CMYK.getHueStrip
Gets the hue strip, null for RGB and CMYK.getChannel
public float getChannel(int channel) Gets a channel: the hue in degrees, the others in[0,1].update
public void update(int argb) The chooser's color changed: the channels follow unless this tab produced the color.- Parameters:
argb- The color; the alpha byte is ignored.
commitPendingEdits
public boolean commitPendingEdits()Commits a value typed in a spinner and not yet entered: the spinner's text is parsed and, when it differs from the spinner's value, applied as if entered.- Returns:
- true if a value was committed.