IUP-0.303

NAME

DESCRIPTION

Creates an element for selecting a color. The selection is done using a cylindrical projection of the RGB cube. The transformation defines a coordinate color system called HSI, that is still the RGB color space but using cylindrical coordinates.

H is for Hue, and it is the angle around the RGB cube diagonal starting at red (RGB=255 0 0).

S is for Saturation, and it is the normal distance from the color to the diagonal, normalized by its maximum value at the specified Hue. This also defines a point at the diagonal used to define I.

I is for Intensity, and it is the distance from the point defined at the diagonal to black (RGB=0 0 0). I can also be seen as the projection of the color vector onto the diagonal. But I is not linear, see Notes below.

NOTE: For a dialog that simply returns the selected color, you can use function GetColor or IUP::ColorDlg.

USAGE

CREATION - new() method

$colorbrowser = IUP::ColorBrowser->new( RGB=>"100 100 0" );

Returns: the identifier of the created element, or undef if an error occurs.

NOTE: You can pass to new() other ATTRIBUTE=>'value' or CALLBACKNAME=>\&func pairs relevant to this element - see IUP::Manual::02_Elements.

ATTRIBUTES

For more info about concept of attributes (setting/getting values etc.) see IUP::Manual::03_Attributes. Attributes specific to this element:

NOTES

When the control has the focus the keyboard can be used to change the color value. Use the arrow keys to move the cursor inside the SI triangle, and use Home(0), PageUp, PageDn and End(180) keys to move the cursor inside the Hue circle.

The Hue in the HSI coordinate system defines a plane that it is a triangle in the RGB cube. But the maximum saturation in this triangle is different for each Hue because of the geometry of the cube. In ColorBrowser this point is fixed at the center of the I axis. So the I axis is not completely linear, it is linear in two parts, one from 0 to 0.5, and another from 0.5 to 1.0. Although the selected values are linear specified you can notice that when Hue is changed the gray scale also changes, visually compacting values above or below the I=0.5 line according to the selected Hue.

EXAMPLES

The element IUP::ColorBrowser is used in the following sample scripts: