summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gdkregion.xml
blob: d26317438aeb79f990ab4b7c664270e3d63f4bd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gdkregion">
  <refnamediv>
    <refname>gtk.gdk.Region</refname>
    <refpurpose>an object representing a set of pixels on the screen (new in
    PyGTK 2.10)</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.gdk.Region</classname></ooclass>
      <ooclass><classname>gobject.GBoxed</classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gdkregion">gtk.gdk.Region</link></methodname>
	<methodparam></methodparam>
      </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--get-clipbox">get_clipbox</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--empty">empty</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--equal">equal</link></methodname>
	<methodparam><parameter
		       role="keyword">other</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--point-in">point_in</link></methodname>
	<methodparam><parameter
		       role="keyword">x</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">y</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--rect-in">rect_in</link></methodname>
	<methodparam><parameter
		       role="keyword">rect</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--copy">copy</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--offset">offset</link></methodname>
	<methodparam><parameter
		       role="keyword">dx</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">dy</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--shrink">shrink</link></methodname>
	<methodparam><parameter
		       role="keyword">dx</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">dy</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--union-with-rect">union_with_rect</link></methodname>
	<methodparam><parameter
		       role="keyword">rect</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--intersect">intersect</link></methodname>
	<methodparam><parameter
		       role="keyword">source2</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--union">union</link></methodname>
	<methodparam><parameter
		       role="keyword">source2</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--subtract">subtract</link></methodname>
	<methodparam><parameter
		       role="keyword">source2</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkregion--xor">xor</link></methodname>
	<methodparam><parameter
		       role="keyword">source2</parameter></methodparam>
      </methodsynopsis>
    </classsynopsis>

    <programlisting>
<emphasis role="bold">Functions</emphasis>

<methodsynopsis language="python">
  <methodname><link
linkend="function-gdk--region-rectangle">gtk.gdk.region_rectangle</link></methodname>
  <methodparam><parameter
                   role="keyword">rectangle</parameter></methodparam>
</methodsynopsis></programlisting>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>A <link
    linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link>
    is an objrect holding a set of arbitrary pixels, and is usually used for
    clipping graphical operations (see the <link
    linkend="method-gdkgc--set-clip-region"><methodname>gtk.gdk.GC.set_clip_region</methodname>()</link>
    method).</para>

  </refsect1>

  <refsect1 id="constructor-gdkregion">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.gdk.Region</methodname>
      </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new <link
linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link>
object</simpara></listitem>
      </varlistentry>
    </variablelist>

    <note>
      <para>This constructor is available in PyGTK 2.10 and above.</para>
    </note>

    <para>Creates a new <link
    linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link>.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gdkregion--get-clipbox">
      <title>gtk.gdk.Region.get_clipbox</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_clipbox</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>returns the smallest rectangle which includes all
          of the region.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>get_clipbox</methodname>() method returns the
      smallest rectangle which includes the entire region.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--empty">
      <title>gtk.gdk.Region.empty</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>empty</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>True if the region is empty.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>empty</methodname>() method returns True if the
      region is empty.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--equal">
      <title>gtk.gdk.Region.equal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>equal</methodname>
	  <methodparam><parameter
			 role="keyword">other</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">other</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
	  linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>True if the region is equal to
	  <parameter>other</parameter></simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>equal</methodname>() method returns True if the
      region specified by <parameter>other</parameter> is equal to this
      region.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--point-in">
      <title>gtk.gdk.Region.point_in</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>point_in</methodname>
	  <methodparam><parameter
			 role="keyword">x</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">y</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">x</parameter>&nbsp;:</term>
	  <listitem><simpara>the x coordinate of a point.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">y</parameter>&nbsp;:</term>
	  <listitem><simpara>the y coordinate of a point.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>True if the point (x,y) is in the
          region.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname></methodname>() method returns True if the point
      specified by the coordinates <parameter>x</parameter> and
      <parameter>y</parameter> is in a region.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--rect-in">
      <title>gtk.gdk.Region.rect_in</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>rect_in</methodname>
	  <methodparam><parameter
			 role="keyword">rect</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">rect</parameter>&nbsp;:</term>
	  <listitem><simpara>a rectangle (<link
	  linkend="class-gdkrectangle"><classname>gtk.gdk.Rectangle</classname></link>
	  or 4-tuple representing a rectangle) </simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a value indicating whether
	  <parameter>rectangle</parameter> is inside or outside the
	  region.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>rect_in</methodname>() method returns one of the
      <xref linkend="gdk-overlap-type-constants"
      endterm="gdk-overlap-type-constants-title"></xref> depending whether
      the rectangle specified by <parameter>rect</parameter> is inside,
      outside, or partly inside this region.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--copy">
      <title>gtk.gdk.Region.copy</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>copy</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
	  linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link>
	  identical to the region</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>copy</methodname>() method returns a new <link
      linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link>
      identical to this region.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--offset">
      <title>gtk.gdk.Region.offset</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>offset</methodname>
	  <methodparam><parameter
			 role="keyword">dx</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">dy</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">dx</parameter>&nbsp;:</term>
	  <listitem><simpara>the distance to move this region
          horizontally.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">dy</parameter>&nbsp;:</term>
	  <listitem><simpara>the distance to move this region
          vertically.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>offset</methodname>() method moves this region
      the distance specified by <parameter>dx</parameter> and
      <parameter>dy</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--shrink">
      <title>gtk.gdk.Region.shrink</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>shrink</methodname>
	  <methodparam><parameter
			 role="keyword">dx</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">dy</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">dx</parameter>&nbsp;:</term>
	  <listitem><simpara>the number of pixels to shrink this region
          horizontally.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">dy</parameter>&nbsp;:</term>
	  <listitem><simpara>the number of pixels to shrink this region
          vertically. </simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>shrink</methodname>() method resizes this region
      by the amount specified by <parameter>dx</parameter> and
      <parameter>dy</parameter>. Positive values shrink the region. Negative
      values expand it.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--union-with-rect">
      <title>gtk.gdk.Region.union_with_rect</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>union_with_rect</methodname>
	  <methodparam><parameter
			 role="keyword">rect</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">rect</parameter>&nbsp;:</term>
	  <listitem><simpara>a rectangle</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>union_with_rect</methodname>() method sets the
      area of this region to the union of the areas of this region and the
      rectangle specified by <parameter>rect</parameter>. The resulting area
      is the set of pixels contained in either the region or
      <parameter>rect</parameter>. The value of <parameter>rect</parameter>
      is either a <link
      linkend="class-gdkrectangle"><classname>gtk.gdk.Rectangle</classname></link>
      or a 4-tuple containing the position and size of a rectangle.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--intersect">
      <title>gtk.gdk.Region.intersect</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>intersect</methodname>
	  <methodparam><parameter
			 role="keyword">source2</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">source2</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
	  linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link></simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>intersect</methodname>() method sets the area of
      this region to the intersection of the areas of this region and the
      region specified by <parameter>source2</parameter>. The resulting area
      is the set of pixels contained in both this region and
      <parameter>source2</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--union">
      <title>gtk.gdk.Region.union</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>union</methodname>
	  <methodparam><parameter
			 role="keyword">source2</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">source2</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
	  linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>union</methodname>() method sets the area of
      this region to the union of the areas of this region and the region
      specified by <parameter>source2</parameter>. The resulting area is the
      set of pixels contained in either this region or
      <parameter>source2</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--subtract">
      <title>gtk.gdk.Region.subtract</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>subtract</methodname>
	  <methodparam><parameter
			 role="keyword">source2</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">source2</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
	  linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>subtract</methodname>() method sets the area of
      this region to the subtraction of the areas of this region and the
      region specified by <parameter>source2</parameter>. The resulting area
      is the set of pixels contained in this region but not in
      <parameter>source2</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gdkregion--xor">
      <title>gtk.gdk.Region.xor</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>xor</methodname>
	  <methodparam><parameter
			 role="keyword">source2</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">source2</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
	  linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This method is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <methodname>xor</methodname>() method sets the area of this
      region to the exclusive-OR of the areas of this region and the region
      specified by <parameter>source2</parameter>. The resulting area is the
      set of pixels contained in either this region or
      <parameter>source2</parameter> but not both.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Functions</title>

    <refsect2 id="function-gdk--region-rectangle">
      <title>gtk.gdk.region_rectangle</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>gtk.gdk.region_rectangle</methodname>
	  <methodparam><parameter
			 role="keyword">rectangle</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">rectangle</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
	  linkend="class-gdkrectangle"><classname>gtk.gdk.Rectangle</classname></link>
	  or a 4-tuple representing a rectangle.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
	  linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link></simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
        <para>This function is available in PyGTK 2.10 and above.</para>
      </note>

      <para>The <function>gtk.gdk.region_rectangle</function>() function
      creates a new <link
      linkend="class-gdkregion"><classname>gtk.gdk.Region</classname></link>
      containing the area specified by
      <parameter>rectangle</parameter>.</para>

    </refsect2>

  </refsect1>

</refentry>