1Prima::ColorDialog(3) User Contributed Perl DocumentationPrima::ColorDialog(3)
2
3
4
6 Prima::ColorDialog - standard color selection facilities
7
9 use Prima qw(StdDlg Application);
10
11 my $p = Prima::ColorDialog-> create(
12 quality => 1,
13 );
14 printf "color: %06x", $p-> value if $p-> execute == mb::OK;
15
17 The module contains two packages, "Prima::ColorDialog" and
18 "Prima::ColorComboBox", used as standard tools for interactive color
19 selection. "Prima::ColorComboBox" is a modified combo widget, which
20 provides selecting from predefined palette but also can invoke
21 "Prima::ColorDialog" window.
22
24 Properties
25 quality BOOLEAN
26 Used to increase visual quality of the dialog if run on paletted
27 displays.
28
29 Default value: 0
30
31 value COLOR
32 Selects the color, represented by the color wheel and other dialog
33 controls.
34
35 Default value: "cl::White"
36
37 Methods
38 hsv2rgb HUE, SATURATION, LUMINOSITY
39 Converts color from HSV to RGB format and returns three integer
40 values, red, green, and blue components.
41
42 rgb2hsv RED, GREEN, BLUE
43 Converts color from RGB to HSV format and returns three numerical
44 values, hue, saturation, and luminosity components.
45
46 rgb2value RED, GREEN, BLUE
47 Combines separate channels into single 24-bit RGB value and returns
48 the result.
49
50 value2rgb COLOR
51 Splits 24-bit RGB value into three channels, red, green, and blue
52 and returns three integer values.
53
54 xy2hs X, Y, RADIUS
55 Maps X and Y coordinate values onto a color wheel with RADIUS in
56 pixels. The code uses RADIUS = 119 for mouse position coordinate
57 mapping. Returns three values, - hue, saturation and error flag.
58 If error flag is set, the conversion has failed.
59
60 hs2xy HUE, SATURATION
61 Maps hue and saturation onto 256-pixel wide color wheel, and
62 returns X and Y coordinates of the corresponding point.
63
64 create_wheel SHADES, BACK_COLOR
65 Creates a color wheel with number of SHADES given, drawn on a
66 BACK_COLOR background, and returns a "Prima::DeviceBitmap" object.
67
68 create_wheel_shape SHADES
69 Creates a circular 1-bit mask, with radius derived from SHAPES.
70 SHAPES must be same as passed to create_wheel. Returns
71 "Prima::Image" object.
72
73 Events
74 BeginDragColor $PROPERTY
75 Called when the user starts dragginh a color from the color wheel
76 by with left mouse button and combination of Alt, Ctrl, and Shift
77 keys. $PROPERTY is one of "Prima::Widget" color properties, and
78 depends on combination of keys:
79
80 Alt backColor
81 Ctrl color
82 Alt+Shift hiliteBackColor
83 Ctrl+Shift hiliteColor
84 Ctrl+Alt disabledColor
85 Ctrl+Alt+Shift disabledBackColor
86
87 Default action reflects the property to be changes in the dialog
88 title
89
90 Change
91 The notification is called when the value property is changed,
92 either interactively or as a result of direct call.
93
94 EndDragColor $PROPERTY, $WIDGET
95 Called when the user releases the mouse drag over a Prima widget.
96 Default action sets "$WIDGET->$PROPERTY" to the current color
97 value.
98
99 Variables
100 $colorWheel
101 Contains cached result of create_wheel call.
102
103 $colorWheelShape
104 Contains cached result of create_wheel_shape call.
105
107 Events
108 Colorify INDEX, COLOR_PTR
109 "nt::Action" callback, designed to map combo palette index into a
110 RGB color. INDEX is an integer from 0 to colors - 1, COLOR_PTR is
111 a reference to a result scalar, where the notification is expected
112 to write the resulting color.
113
114 Properties
115 colors INTEGER
116 Defines amount of colors in the fixed palette of the combo box.
117
118 value COLOR
119 Contains the color selection as 24-bit integer value.
120
122 Prima, Prima::ComboBox, examples/cv.pl.
123
125 Dmitry Karasik, <dmitry@karasik.eu.org>.
126
127
128
129perl v5.28.1 2019-02-02 Prima::ColorDialog(3)