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 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 xy2hs X, Y, RADIUS
47 Maps X and Y coordinate values onto a color wheel with RADIUS in
48 pixels. The code uses RADIUS = 119 for mouse position coordinate
49 mapping. Returns three values, - hue, saturation and error flag.
50 If error flag is set, the conversion has failed.
51
52 hs2xy HUE, SATURATION
53 Maps hue and saturation onto 256-pixel wide color wheel, and
54 returns X and Y coordinates of the corresponding point.
55
56 create_wheel SHADES, BACK_COLOR
57 Creates a color wheel with number of SHADES given, drawn on a
58 BACK_COLOR background, and returns a "Prima::DeviceBitmap" object.
59
60 create_wheel_shape SHADES
61 Creates a circular 1-bit mask, with radius derived from SHAPES.
62 SHAPES must be same as passed to create_wheel. Returns
63 "Prima::Image" object.
64
65 Events
66 BeginDragColor $PROPERTY
67 Called when the user starts dragginh a color from the color wheel
68 by with left mouse button and combination of Alt, Ctrl, and Shift
69 keys. $PROPERTY is one of "Prima::Widget" color properties, and
70 depends on combination of keys:
71
72 Alt backColor
73 Ctrl color
74 Alt+Shift hiliteBackColor
75 Ctrl+Shift hiliteColor
76 Ctrl+Alt disabledColor
77 Ctrl+Alt+Shift disabledBackColor
78
79 Default action reflects the property to be changes in the dialog
80 title
81
82 Change
83 The notification is called when the value property is changed,
84 either interactively or as a result of direct call.
85
86 EndDragColor $PROPERTY, $WIDGET
87 Called when the user releases the mouse drag over a Prima widget.
88 Default action sets "$WIDGET->$PROPERTY" to the current color
89 value.
90
91 Variables
92 $colorWheel
93 Contains cached result of create_wheel call.
94
95 $colorWheelShape
96 Contains cached result of create_wheel_shape call.
97
99 Events
100 Colorify INDEX, COLOR_PTR
101 "nt::Action" callback, designed to map combo palette index into a
102 RGB color. INDEX is an integer from 0 to colors - 1, COLOR_PTR is
103 a reference to a result scalar, where the notification is expected
104 to write the resulting color.
105
106 Properties
107 colors INTEGER
108 Defines amount of colors in the fixed palette of the combo box.
109
110 value COLOR
111 Contains the color selection as 24-bit integer value.
112
114 Prima, Prima::ComboBox, examples/cv.pl.
115
117 Dmitry Karasik, <dmitry@karasik.eu.org>.
118
119
120
121perl v5.34.1 2022-04-20 Prima::Dialog::ColorDialog(3)