Graphics.UI.Gtk.Gdk.GC

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.GC

Contents

- Detail

Description

Graphics contexts - objects to encapsulate drawing properties

Synopsis

- data GC
- class GObjectClass o => GCClass o
- castToGC :: GObjectClass obj => obj -> GC
- gTypeGC :: GType
- gcNew :: DrawableClass d => d -> IO GC
- data GCValues = GCValues {
  - foreground :: Color
  - background :: Color
  - function :: Function
  - fill :: Fill
  - tile :: Maybe Pixmap
  - stipple :: Maybe Pixmap
  - clipMask :: Maybe Pixmap
  - subwindowMode :: SubwindowMode
  - tsXOrigin :: Int
  - tsYOrigin :: Int
  - clipXOrigin :: Int
  - clipYOrigin :: Int
  - graphicsExposure :: Bool
  - lineWidth :: Int
  - lineStyle :: LineStyle
  - capStyle :: CapStyle
  - joinStyle :: JoinStyle
  }
- newGCValues :: GCValues
- data Color = Color Word16 Word16 Word16
- data Function
  - = Copy
  - | Invert
  - | Xor
  - | Clear
  - | And
  - | AndReverse
  - | AndInvert
  - | Noop
  - | Or
  - | Equiv
  - | OrReverse
  - | CopyInvert
  - | OrInvert
  - | Nand
  - | Nor
  - | Set
- data Fill
  - = Solid
  - | Tiled
  - | Stippled
  - | OpaqueStippled
- data SubwindowMode
  - = ClipByChildren
  - | IncludeInferiors
- data LineStyle
  - = LineSolid
  - | LineOnOffDash
  - | LineDoubleDash
- data CapStyle
  - = CapNotLast
  - | CapButt
  - | CapRound
  - | CapProjecting
- data JoinStyle
  - = JoinMiter
  - | JoinRound
  - | JoinBevel
- gcNewWithValues :: DrawableClass d => d -> GCValues -> IO GC
- gcSetValues :: GC -> GCValues -> IO ()
- gcGetValues :: GC -> IO GCValues
- gcSetClipRectangle :: GC -> Rectangle -> IO ()
- gcSetClipRegion :: GC -> Region -> IO ()
- gcSetDashes :: GC -> Int -> [(Int, Int)] -> IO ()

# Detail

All drawing operations in Gdk take a graphics context (GC) argument. A graphics context encapsulates information about the way things are drawn, such as the foreground color or line width. By using graphics contexts, the number of arguments to each drawing call is greatly reduced, and communication overhead is minimized, since identical arguments do not need to be passed repeatedly.

Most values of a graphics context can be set at creation time by using `gcNewWithValues`. A few of the values in the GC, such as the dash pattern, can only be set by the latter method.

data GC

Instances

Eq GC |
Ord GC |
GObjectClass GC |
GCClass GC |

class GObjectClass o => GCClass o

Instances

GCClass GC |

castToGC :: GObjectClass obj => obj -> GC

gTypeGC :: GType

gcNew :: DrawableClass d => d -> IO GC

Create an empty graphics context.

data GCValues

Intermediate data structure for `GC`s.

- If `graphicsExposure` is set then copying portions into a drawable will generate an `"exposure"` event, even if the destination area is not currently visible.

Constructors

GCValues |
Fields foreground :: Color background :: Color function :: Function fill :: Fill tile :: Maybe Pixmap stipple :: Maybe Pixmap clipMask :: Maybe Pixmap subwindowMode :: SubwindowMode tsXOrigin :: Int tsYOrigin :: Int clipXOrigin :: Int clipYOrigin :: Int graphicsExposure :: Bool lineWidth :: Int lineStyle :: LineStyle capStyle :: CapStyle joinStyle :: JoinStyle

Instances

Storable GCValues |

newGCValues :: GCValues

data Color

Color

- Specifies a color with three integer values for red, green and blue. All values range from 0 (least intense) to 65535 (highest intensity).

Constructors

Color Word16 Word16 Word16 |

Instances

Eq Color |
Show Color |
Storable Color |

data Function

Determine how bitmap operations are carried out.

Constructors

Copy |
Invert |
Xor |
Clear |
And |
AndReverse |
AndInvert |
Noop |
Or |
Equiv |
OrReverse |
CopyInvert |
OrInvert |
Nand |
Nor |
Set |

Instances

Enum Function |
Eq Function |
Show Function |

data Fill

How objects are filled.

Constructors

Solid |
Tiled |
Stippled |
OpaqueStippled |

Instances

Enum Fill |
Eq Fill |
Show Fill |

data SubwindowMode

Constructors

ClipByChildren |
IncludeInferiors |

Instances

Enum SubwindowMode | visibility of a window
Eq SubwindowMode |
Show SubwindowMode |

data LineStyle

Determines if a line is solid or dashed.

Constructors

LineSolid |
LineOnOffDash |
LineDoubleDash |

Instances

Enum LineStyle |
Eq LineStyle |
Show LineStyle |

data CapStyle

Specify the how the ends of a line is drawn.

Constructors

CapNotLast |
CapButt |
CapRound |
CapProjecting |

Instances

Enum CapStyle |
Eq CapStyle |
Show CapStyle |

data JoinStyle

Constructors

JoinMiter |
JoinRound |
JoinBevel |

Instances

Enum JoinStyle |
Eq JoinStyle |
Show JoinStyle |

gcNewWithValues :: DrawableClass d => d -> GCValues -> IO GC

Creates a graphics context with specific values.

gcSetValues :: GC -> GCValues -> IO ()

Change some of the values of a graphics context.

gcGetValues :: GC -> IO GCValues

Retrieve the values in a graphics context.

gcSetClipRectangle :: GC -> Rectangle -> IO ()

Set a clipping rectangle.

- All drawing operations are restricted to this rectangle. This rectangle is interpreted relative to the clip origin.

gcSetClipRegion :: GC -> Region -> IO ()

Set a clipping region.

- All drawing operations are restricted to this region. This region is interpreted relative to the clip origin.

gcSetDashes :: GC -> Int -> [(Int, Int)] -> IO ()

Specify the pattern with which lines are drawn.

- Every tuple in the list contains an even and an odd segment. Even segments are drawn normally, whereby the `lineStyle` member of the graphics context defines if odd segements are drawn or not. A `phase` argument greater than 0 will drop `phase` pixels before starting to draw.