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