KWWidgets/Color Picker
From KitwarePublic
Contents |
Color Picker
A new set of classes has been added April 2008 to provide a consistent color picker dialog across all platforms. This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.
The new color picker
The new color picker provides interactive RGB and HSV sliders, a color spectrum area and various other means to select or enter color coordinates. It features a set of basic colors, a color preset editor that can be used store a list of persistent custom/favorite colors, and a history of "recently picked" colors. It can either be invoked as a standalone dialog, or embedded in any other UI.
The old color pickers
For reference, here are the old Tcl/Tk color picker dialogs. On Unix:
On Win32:
Helper Classes
Several new helper classes were created to assemble the color picker dialog. Each one of them can be used separately if needed. The diagram above provides an overview of said assembly:
- vtkKWColorSpectrumWidget:a widget that can be used to display a 2D canvas interpolating a slice of a color space/spectrum. It provides quick access to a whole range of colors interpolated along 2 different color-space axis (R, G, B, H, S, V).
- vtkKWColorPresetSelector: a widget that can be used to store color presets, one per row in a multi-column list. For example, a list of favorite colors or a list of "recently picked" colors.
- vtkKWColorPickerWidget: the color picker widget, a composite widgets that packs RGB/HSV sliders, the color spectrum (vtkKWColorSpectrumWidget), the favorites and history color preset selector (vtkKWColorPresetSelector), the basic colors frame, etc.
- vtkKWColorPickerDialog: a small standalone toplevel dialog that embeds a vtkKWColorPickerWidget.
Some other classes were affected:
- vtkKWTkUtilities: the QueryUserForColor's signature was slightly changed, and now uses the new color picker dialog instead of the Tcl/Tk semi-native one. Since this was the single entry point to query a color throughout KWWidgets, all classes that were calling this method will now use the new color picker dialog automatically (vtkKWChangeColorButton, vtkKWColorTransferFunctionEditor or vtkKWVolumePropertyWidget for example).
- vtkKWEntry: SetHexadecimalValueAsRGB, GetHexadecimalValueAsRGB, two convenience methods to set/get a color value in hexadecimal RGB (say, #ff0088).
- vtkKWApplication: the GetColorPickerDialog method returns an application-wide instance of vtkKWColorPickerDialog. Redefine this method in your application sub-class to provide a customized color picker.
- Various optimization and bug fixes in vtkKWPresetSelector, vtkKWCoreWidget, vtkKWMultiColumnList, vtkKWNotebook and the transfer function editors (used for the sliders).
| |





