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

Maintainergtk2hs-users@lists.sourceforge.net
Stabilityprovisional
Portabilityportable (depends on GHC)
Safe HaskellNone
LanguageHaskell98

Graphics.UI.Gtk.Gdk.Drawable

Description

Drawing primitives.

This module defines drawing primitives that can operate on DrawWindows and Pixmaps.

This module is empty when built with Gtk3 because GTKDrawable has been removed.

Synopsis

Documentation

drawableGetDepth :: DrawableClass d => d -> IO Int Source

Get the size of pixels.

  • Returns the number of bits which are use to store information on each pixels in this Drawable.

drawableGetSize :: DrawableClass d => d -> IO (Int, Int) Source

Retrieve the size of the Drawable.

  • The result might not be up-to-date if there are still resizing messages to be processed.

drawableGetClipRegion :: DrawableClass d => d -> IO Region Source

Determine where not to draw.

  • Computes the region of a drawable that potentially can be written to by drawing primitives. This region will not take into account the clip region for the GC, and may also not take into account other factors such as if the window is obscured by other windows, but no area outside of this region will be affected by drawing primitives.

drawableGetVisibleRegion :: DrawableClass d => d -> IO Region Source

Determine what not to redraw.

  • Computes the region of a drawable that is potentially visible. This does not necessarily take into account if the window is obscured by other windows, but no area outside of this region is visible.

type Point = (Int, Int) Source

Represents the x and y coordinate of a point.

drawPoint :: DrawableClass d => d -> GC -> Point -> IO () Source

Draw a point into a Drawable.

drawPoints :: DrawableClass d => d -> GC -> [Point] -> IO () Source

Draw several points into a Drawable.

  • This function is more efficient than calling drawPoint on several points.

drawLine :: DrawableClass d => d -> GC -> Point -> Point -> IO () Source

Draw a line into a Drawable.

  • The parameters are x1, y1, x2, y2.
  • Drawing several separate lines can be done more efficiently by drawSegments.

drawLines :: DrawableClass d => d -> GC -> [Point] -> IO () Source

Draw several lines.

  • The function uses the current line width, dashing and especially the joining specification in the graphics context (in contrast to drawSegments.

drawPixbuf :: DrawableClass d => d -> GC -> Pixbuf -> Int -> Int -> Int -> Int -> Int -> Int -> Dither -> Int -> Int -> IO () Source

Render a Pixbuf.

  • Usage: drawPixbuf d gc pb srcX srcY destX destY srcWidth srcHeight dither xDither yDither Renders a rectangular portion of a Pixbuf to a Drawable. The srcX, srcY, srcWidth and srcHeight specify what part of the Pixbuf should be rendered. The latter two values may be -1 in which case the width and height are taken from pb. The image is placed at destX, destY. If you render parts of an image at a time, set ditherX and ditherY to the origin of the image you are rendering.
  • Since 2.2.

drawSegments :: DrawableClass d => d -> GC -> [(Point, Point)] -> IO () Source

Draw several unconnected lines.

  • This method draws several unrelated lines.

drawRectangle Source

Arguments

:: DrawableClass d 
=> d

drawable

-> GC

graphics context

-> Bool

filled

-> Int

x

-> Int

y

-> Int

width

-> Int

height

-> IO () 

Draw a rectangular object.

  • Draws a rectangular outline or filled rectangle, using the foreground color and other attributes of the GC.
  • A rectangle drawn filled is 1 pixel smaller in both dimensions than a rectangle outlined. Calling drawRectangle w gc True 0 0 20 20 results in a filled rectangle 20 pixels wide and 20 pixels high. Calling drawRectangle d gc False 0 0 20 20 results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20), and (20, 0), which makes it 21 pixels wide and 21 pixels high.

drawArc :: DrawableClass d => d -> GC -> Bool -> Int -> Int -> Int -> Int -> Int -> Int -> IO () Source

Draws an arc or a filled 'pie slice'.

  • The arc is defined by the bounding rectangle of the entire ellipse, and the start and end angles of the part of the ellipse to be drawn.
  • The starting angle aStart is relative to the 3 o'clock position, counter-clockwise, in 1/64ths of a degree. aEnd is measured similarly, but relative to aStart.

drawPolygon :: DrawableClass d => d -> GC -> Bool -> [Point] -> IO () Source

Draws an outlined or filled polygon.

  • The polygon is closed automatically, connecting the last point to the first point if necessary.

drawGlyphs :: DrawableClass d => d -> GC -> Int -> Int -> GlyphItem -> IO () Source

Draw a segment of text.

  • This function draws a segment of text. These segements are the result of itemizing a string into segments with the same characteristics (font, text direction, etc.) using itemize. Each item is then turned into a shapes by calling shape. These shapes can then be drawn onto screen using this function. A simpler interface, that also takes care of breaking a paragraph into several lines is a LayoutLine.

drawLayoutLine :: DrawableClass d => d -> GC -> Int -> Int -> LayoutLine -> IO () Source

Draw a single line of text.

  • The x coordinate specifies the start of the string, the y coordinate specifies the base line.

drawLayoutLineWithColors :: DrawableClass d => d -> GC -> Int -> Int -> LayoutLine -> Maybe Color -> Maybe Color -> IO () Source

Draw a single line of text.

  • The x coordinate specifies the start of the string, the y coordinate specifies the base line.
  • If both colors are Nothing this function will behave like drawLayoutLine in that it uses the default colors from the graphics context.

drawLayout :: DrawableClass d => d -> GC -> Int -> Int -> PangoLayout -> IO () Source

Draw a paragraph of text.

  • The x and y values specify the upper left point of the layout.

drawLayoutWithColors :: DrawableClass d => d -> GC -> Int -> Int -> PangoLayout -> Maybe Color -> Maybe Color -> IO () Source

Draw a paragraph of text.

  • The x and y values specify the upper left point of the layout.
  • If both colors are Nothing this function will behave like drawLayout in that it uses the default colors from the graphics context.

drawDrawable Source

Arguments

:: (DrawableClass src, DrawableClass dest) 
=> dest

destination drawable

-> GC

graphics context

-> src

source drawable

-> Int
xSrc
-> Int
ySrc
-> Int
xDest
-> Int
yDest
-> Int
width
-> Int
height
-> IO () 

Copies another Drawable.

  • Copies the (width,height) region of the src at coordinates (xSrc, ySrc) to coordinates (xDest, yDest) in the dest. The width and/or height may be given as -1, in which case the entire source drawable will be copied.
  • Most fields in gc are not used for this operation, but notably the clip mask or clip region will be honored. The source and destination drawables must have the same visual and colormap, or errors will result. (On X11, failure to match visual/colormap results in a BadMatch error from the X server.) A common cause of this problem is an attempt to draw a bitmap to a color drawable. The way to draw a bitmap is to set the bitmap as a clip mask on your GC, then use drawRectangle to draw a rectangle clipped to the bitmap.