Graphics.UI.Gtk.Gdk.Region

gtk-0.12.4: Binding to the Gtk+ graphical user interface library.

Portability | portable (depends on GHC)
Stability | provisional
Maintainer | gtk2hs-users@lists.sourceforge.net
Safe Haskell | None

Graphics.UI.Gtk.Gdk.Region

Description

A set of rectangles describing areas to be redrawn.

- Regions consist of a set of non-overlapping rectangles. They are used to specify the area of a window which needs updating.

Synopsis

- makeNewRegion :: Ptr Region -> IO Region
- newtype Region = Region (ForeignPtr Region)
- regionNew :: IO Region
- data FillRule
  - = EvenOddRule
  - | WindingRule
- regionPolygon :: [Point] -> FillRule -> IO Region
- regionCopy :: Region -> IO Region
- regionRectangle :: Rectangle -> IO Region
- regionGetClipbox :: Region -> IO Rectangle
- regionGetRectangles :: Region -> IO [Rectangle]
- regionEmpty :: Region -> IO Bool
- regionEqual :: Region -> Region -> IO Bool
- regionPointIn :: Region -> Point -> IO Bool
- data OverlapType
  - = OverlapRectangleIn
  - | OverlapRectangleOut
  - | OverlapRectanglePart
- regionRectIn :: Region -> Rectangle -> IO OverlapType
- regionOffset :: Region -> Int -> Int -> IO ()
- regionShrink :: Region -> Int -> Int -> IO ()
- regionUnionWithRect :: Region -> Rectangle -> IO ()
- regionIntersect :: Region -> Region -> IO ()
- regionUnion :: Region -> Region -> IO ()
- regionSubtract :: Region -> Region -> IO ()
- regionXor :: Region -> Region -> IO ()

# Documentation

makeNewRegion :: Ptr Region -> IO Region

newtype Region

Constructors

Region (ForeignPtr Region) |

Instances

Show Region |

regionNew :: IO Region

Create an empty region.

data FillRule

Specify how to interpret a polygon.

- The flag determines what happens if a polygon has overlapping areas.

Constructors

EvenOddRule |
WindingRule |

Instances

Enum FillRule |

regionPolygon :: [Point] -> FillRule -> IO Region

Convert a polygon into a `Region`.

regionCopy :: Region -> IO Region

Copy a `Region`.

regionRectangle :: Rectangle -> IO Region

Convert a rectangle to a `Region`.

regionGetClipbox :: Region -> IO Rectangle

Smallest rectangle including the `Region`.

regionGetRectangles :: Region -> IO [Rectangle]

Turn the `Region` into its rectangles.

A `Region` is a set of horizontal bands. Each band consists of one or more rectangles of the same height. No rectangles in a band touch.

regionEmpty :: Region -> IO Bool

Test if a `Region` is empty.

regionEqual :: Region -> Region -> IO Bool

Compares two `Region`s for equality.

regionPointIn :: Region -> Point -> IO Bool

Checks if a point it is within a region.

data OverlapType

How a rectangle is contained in a `Region`.

Constructors

OverlapRectangleIn |
OverlapRectangleOut |
OverlapRectanglePart |

Instances

Enum OverlapType |

regionRectIn :: Region -> Rectangle -> IO OverlapType

Check if a rectangle is within a region.

regionOffset :: Region -> Int -> Int -> IO ()

Move a region.

regionShrink :: Region -> Int -> Int -> IO ()

Move a region.

- Positive values shrink the region, negative values expand it.

regionUnionWithRect :: Region -> Rectangle -> IO ()

Updates the region to include the rectangle.

regionIntersect :: Region -> Region -> IO ()

Intersects one region with another.

- Changes `reg1` to include the common areas of `reg1` and `reg2`.

regionUnion :: Region -> Region -> IO ()

Unions one region with another.

- Changes `reg1` to include `reg1` and `reg2`.

regionSubtract :: Region -> Region -> IO ()

Removes pars of a `Region`.

- Reduces the region `reg1` so that is does not include any areas of `reg2`.

regionXor :: Region -> Region -> IO ()

XORs two `Region`s.

- The exclusive or of two regions contains all areas which were not overlapping. In other words, it is the union of the regions minus their intersections.