1Gtk2::Gdk::GC(3)      User Contributed Perl Documentation     Gtk2::Gdk::GC(3)
2
3
4

NAME

6       Gtk2::Gdk::GC - wrapper for GdkGC
7

HIERARCHY

9         Glib::Object
10         +----Gtk2::Gdk::GC
11

METHODS

13   gc = Gtk2::Gdk::GC->new ($drawable, $values=undef)
14       •   $drawable (Gtk2::Gdk::Drawable)
15
16       •   $values (scalar)
17
18       Create and return a new GC.
19
20       $drawable is used for the depth and the display ("Gtk2::Gdk::Display")
21       for the GC.  The GC can then be used with any drawable of the same
22       depth on that display.
23
24       $values is a hashref containing some of the following keys,
25
26           foreground          Gtk2::Gdk::Color
27           background          Gtk2::Gdk::Color
28           font                Gtk2::Gdk::Font
29           function            Gtk2::Gdk::Function enum
30           fill                Gtk2::Gdk::Fill enum
31           tile                Gtk2::Gdk::Pixmap
32           stipple             Gtk2::Gdk::Pixmap
33           clip_mask           Gtk2::Gdk::Pixmap
34           subwindow_mode      Gtk2::Gdk::SubwindowMode enum
35           ts_x_origin         integer
36           ts_y_origin         integer
37           clip_x_origin       integer
38           clip_y_origin       integer
39           graphics_exposures  boolean integer 1 or 0
40           line_width          integer
41           line_style          Gtk2::Gdk::LineStyle enum
42           cap_style           Gtk2::Gdk::CapStyle enum
43           join_style          Gtk2::Gdk::JoinStyle enum
44
45       Keys not given get default values.  For the "foreground" and
46       "background" colour objects only the "pixel" field is used; the red,
47       green and blue are ignored.  For example
48
49           my $pixel = 0x123456;
50           my $color = Gtk2::Gdk::Color->new (0,0,0, $pixel);
51           my $gc = Gtk2::Gdk::GC->new_with_values
52             ($win, { foreground => $color,
53                      line_style => 'on_off_dash' });
54
55   gc = Gtk2::Gdk::GC->new_with_values ($drawable, $values=undef)
56       •   $drawable (Gtk2::Gdk::Drawable)
57
58       •   $values (scalar)
59
60   $gc->set_background ($color)
61       •   $color (Gtk2::Gdk::Color)
62
63   $gc->set_clip_mask ($mask)
64       •   $mask (scalar)
65
66   $gc->set_clip_origin ($x, $y)
67       •   $x (integer)
68
69       •   $y (integer)
70
71   $gc->set_clip_rectangle ($rectangle)
72       •   $rectangle (Gtk2::Gdk::Rectangle or undef)
73
74   $gc->set_clip_region ($region)
75       •   $region (Gtk2::Gdk::Region or undef)
76
77   colormap = $gc->get_colormap
78   $gc->set_colormap ($colormap)
79       •   $colormap (Gtk2::Gdk::Colormap)
80
81   $dst_gc->copy ($src_gc)
82       •   $src_gc (Gtk2::Gdk::GC)
83
84   $gc->set_dashes ($dash_offset, ...)
85       •   $dash_offset (integer)
86
87       •   ... (list) of integers, the length of the dash segments
88
89       Sets the way dashed-lines are drawn. Lines will be drawn with
90       alternating on and off segments of the lengths specified in list of
91       dashes. The manner in which the on and off segments are drawn is
92       determined by the line_style value of the GC.
93
94   $gc->set_exposures ($exposures)
95       •   $exposures (boolean)
96
97   $gc->set_fill ($fill)
98       •   $fill (Gtk2::Gdk::Fill)
99
100   $gc->set_font ($font)
101       •   $font (Gtk2::Gdk::Font)
102
103   $gc->set_foreground ($color)
104       •   $color (Gtk2::Gdk::Color)
105
106   $gc->set_function ($function)
107       •   $function (Gtk2::Gdk::Function)
108
109   $gc->set_line_attributes ($line_width, $line_style, $cap_style,
110       $join_style)
111       •   $line_width (integer)
112
113       •   $line_style (Gtk2::Gdk::LineStyle)
114
115       •   $cap_style (Gtk2::Gdk::CapStyle)
116
117       •   $join_style (Gtk2::Gdk::JoinStyle)
118
119   $gc->offset ($x_offset, $y_offset)
120       •   $x_offset (integer)
121
122       •   $y_offset (integer)
123
124   $gc->set_rgb_background ($rgb)
125       •   $rgb (unsigned)
126
127   $gc->set_rgb_bg_color ($color)
128       •   $color (Gtk2::Gdk::Color)
129
130   $gc->set_rgb_fg_color ($color)
131       •   $color (Gtk2::Gdk::Color)
132
133   $gc->set_rgb_foreground ($rgb)
134       •   $rgb (unsigned)
135
136   $gc->rgb_gc_set_background ($rgb)
137       •   $rgb (unsigned)
138
139   $gc->rgb_gc_set_foreground ($rgb)
140       •   $rgb (unsigned)
141
142   screen = $gc->get_screen
143       Since: gtk+ 2.2
144
145   $gc->set_stipple ($stipple)
146       •   $stipple (Gtk2::Gdk::Pixmap)
147
148   $gc->set_subwindow ($mode)
149       •   $mode (Gtk2::Gdk::SubwindowMode)
150
151   $gc->set_tile ($tile)
152       •   $tile (Gtk2::Gdk::Pixmap)
153
154   $gc->set_ts_origin ($x, $y)
155       •   $x (integer)
156
157       •   $y (integer)
158
159   scalar = $gc->get_values
160       Return the attributes of $gc in the form of a hashref with keys and
161       values as described with "new" above.
162
163       In the "foreground" and "background" colour objects returned only the
164       "pixel" fields are set; the red, green and blue fields are garbage.
165
166   $gc->set_values ($values)
167       •   $values (scalar)
168
169       Set some of the attributes of $gc.  $values is a hashref of keys and
170       values as described for "new" and "new_with_values" above.  Fields not
171       present in $values are left unchanged.
172

ENUMS AND FLAGS

174   enum Gtk2::Gdk::CapStyle
175       •   'not-last' / 'GDK_CAP_NOT_LAST'
176
177       •   'butt' / 'GDK_CAP_BUTT'
178
179       •   'round' / 'GDK_CAP_ROUND'
180
181       •   'projecting' / 'GDK_CAP_PROJECTING'
182
183   enum Gtk2::Gdk::Fill
184       •   'solid' / 'GDK_SOLID'
185
186       •   'tiled' / 'GDK_TILED'
187
188       •   'stippled' / 'GDK_STIPPLED'
189
190       •   'opaque-stippled' / 'GDK_OPAQUE_STIPPLED'
191
192   enum Gtk2::Gdk::Function
193       •   'copy' / 'GDK_COPY'
194
195       •   'invert' / 'GDK_INVERT'
196
197       •   'xor' / 'GDK_XOR'
198
199       •   'clear' / 'GDK_CLEAR'
200
201       •   'and' / 'GDK_AND'
202
203       •   'and-reverse' / 'GDK_AND_REVERSE'
204
205       •   'and-invert' / 'GDK_AND_INVERT'
206
207       •   'noop' / 'GDK_NOOP'
208
209       •   'or' / 'GDK_OR'
210
211       •   'equiv' / 'GDK_EQUIV'
212
213       •   'or-reverse' / 'GDK_OR_REVERSE'
214
215       •   'copy-invert' / 'GDK_COPY_INVERT'
216
217       •   'or-invert' / 'GDK_OR_INVERT'
218
219       •   'nand' / 'GDK_NAND'
220
221       •   'nor' / 'GDK_NOR'
222
223       •   'set' / 'GDK_SET'
224
225   enum Gtk2::Gdk::JoinStyle
226       •   'miter' / 'GDK_JOIN_MITER'
227
228       •   'round' / 'GDK_JOIN_ROUND'
229
230       •   'bevel' / 'GDK_JOIN_BEVEL'
231
232   enum Gtk2::Gdk::LineStyle
233       •   'solid' / 'GDK_LINE_SOLID'
234
235       •   'on-off-dash' / 'GDK_LINE_ON_OFF_DASH'
236
237       •   'double-dash' / 'GDK_LINE_DOUBLE_DASH'
238
239   enum Gtk2::Gdk::SubwindowMode
240       •   'clip-by-children' / 'GDK_CLIP_BY_CHILDREN'
241
242       •   'include-inferiors' / 'GDK_INCLUDE_INFERIORS'
243

SEE ALSO

245       Gtk2, Glib::Object
246
248       Copyright (C) 2003-2011 by the gtk2-perl team.
249
250       This software is licensed under the LGPL.  See Gtk2 for a full notice.
251
252
253
254perl v5.36.0                      2022-07-22                  Gtk2::Gdk::GC(3)
Impressum