---
name: "Gtk2::Gdk::Region"
section: "3pm"
platform: "linux"
package: "libgtk2-perl-doc"
version: "2:1.24992-1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/Gtk2::Gdk::Region"
---

# Gtk2::Gdk::Region(3pm)

wrapper for GdkRegion

## NAME

Gtk2::Gdk::Region - wrapper for GdkRegion

## HIERARCHY

```
  Glib::Boxed
  +----Gtk2::Gdk::Region
```

## METHODS

### region = Gtk2::Gdk::Region-\>new

### rectangle = $region-\>get\_clipbox

### boolean = $region-\>empty

### boolean = $region1-\>equal ($region2)

- •

  `$region2` (Gtk2::Gdk::Region)

### $source1-\>intersect ($source2)

- •

  `$source2` (Gtk2::Gdk::Region)

### $region-\>offset ($dx, $dy)

- •

  `$dx` (integer)

- •

  `$dy` (integer)

### boolean = $region-\>point\_in ($x, $y)

- •

  `$x` (integer)

- •

  `$y` (integer)

### region = Gtk2::Gdk::Region-\>polygon ($points\_ref, $fill\_rule)

- •

  `$points_ref` (scalar)

- •

  `$fill_rule` (Gtk2::Gdk::FillRule)

### boolean = $region-\>rect\_equal ($rectangle)

- •

  `$rectangle` (Gtk2::Gdk::Rectangle)

Since: gtk+ 2.18

### overlaptype = $region-\>rect\_in ($rect)

- •

  `$rect` (Gtk2::Gdk::Rectangle)

### region = Gtk2::Gdk::Region-\>rectangle ($rectangle)

- •

  `$rectangle` (Gtk2::Gdk::Rectangle)

### list = $region-\>get\_rectangles

Returns a list of rectangles (Gtk2::Gdk::Rectangle's), the area covered by the region.

### $region-\>shrink ($dx, $dy)

- •

  `$dx` (integer)

- •

  `$dy` (integer)

### $region-\>spans\_intersect\_foreach ($spans\_ref, $sorted, $func, $data=undef)

- •

  `$spans_ref` (scalar) arrayref of triples \[$x1,$y1,$width1, `$x2`,$y2,$width2, ...\]

- •

  `$sorted` (boolean)

- •

  `$func` (scalar)

- •

  `$data` (scalar)

Call `$function` for horizontal lines which intersect `$region`.

`$spans_ref` is an arrayref of x,y,width horizontal lines.  If `$sorted` is true then they're assumed to be sorted by increasing y coordinate (allowing a single pass across the region rectangles). `$function` is called

```
    &$function ($x, $y, $width, $data)
```

for each portion of a span which intersects `$region`.  `$function` must not change `$region`.

```
    $region->spans_intersect_foreach ([ 0,0,50, 20,20,100, 0,10,50 ],
                                      0, # spans not sorted by y
                                      \&my_callback,
                                      'hello');  # userdata
    sub my_callback {
      my ($x, $y, $width, $userdata) = @_;
      print "$userdata: $x, $y, $width\n";
    }
```

### $source1-\>subtract ($source2)

- •

  `$source2` (Gtk2::Gdk::Region)

### $source1-\>union ($source2)

- •

  `$source2` (Gtk2::Gdk::Region)

### $region-\>union\_with\_rect ($rect)

- •

  `$rect` (Gtk2::Gdk::Rectangle)

### $source1-\>xor ($source2)

- •

  `$source2` (Gtk2::Gdk::Region)

## ENUMS AND FLAGS

### enum Gtk2::Gdk::FillRule

- •

  'even-odd-rule' / 'GDK\_EVEN\_ODD\_RULE'

- •

  'winding-rule' / 'GDK\_WINDING\_RULE'

### enum Gtk2::Gdk::OverlapType

- •

  'in' / 'GDK\_OVERLAP\_RECTANGLE\_IN'

- •

  'out' / 'GDK\_OVERLAP\_RECTANGLE\_OUT'

- •

  'part' / 'GDK\_OVERLAP\_RECTANGLE\_PART'

## SEE ALSO

Gtk2, Glib::Boxed

## COPYRIGHT

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL.  See Gtk2 for a full notice.
