Name

Drawable —

Drawing primitives.

Synopsis

drawArc:: DrawableClass d => d -> GC -> Bool -> Int -> Int -> Int -> Int -> Int -> Int -> IO ()
drawDrawable:: (DrawableClass dest, DrawableClass src) => dest -> GC -> src -> Int -> Int -> Int -> Int -> Int -> Int -> IO ()
drawLayout:: DrawableClass d => d -> GC -> Int -> Int -> PangoLayout -> IO ()
drawLayoutLine:: DrawableClass d => d -> GC -> Int -> Int -> LayoutLine -> IO ()
drawLayoutLineWithColors:: DrawableClass d => d -> GC -> Int -> Int -> LayoutLine -> Maybe Color -> Maybe Color -> IO ()
drawLayoutWithColors:: DrawableClass d => d -> GC -> Int -> Int -> PangoLayout -> Maybe Color -> Maybe Color -> IO ()
drawLine:: DrawableClass d => d -> GC -> Point -> Point -> IO ()
drawLines:: DrawableClass d => d -> GC -> [Point] -> IO ()
drawPixbuf:: DrawableClass d => d -> GC -> Pixbuf -> Int -> Int -> Int -> Int -> Int -> Int -> Dither -> Int -> Int -> IO ()
drawPoint:: DrawableClass d => d -> GC -> Point -> IO ()
drawPoints:: DrawableClass d => d -> GC -> [Point] -> IO ()
drawPolygon:: DrawableClass d => d -> GC -> Bool -> [Point] -> IO ()
drawRectangle:: DrawableClass d => d -> GC -> Bool -> Int -> Int -> Int -> Int -> IO ()
drawSegments:: DrawableClass d => d -> GC -> [(Point,Point)] -> IO ()
drawableGetClipRegion:: DrawableClass d => d -> IO Region
drawableGetDepth:: DrawableClass d => d -> IO Int
drawableGetSize:: DrawableClass d => d -> IO (Int,Int)
drawableGetVisibleRegion:: DrawableClass d => d -> IO Region

Introduction

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

Todo

if gdk_visuals are implemented, do: get_visual

if gdk_colormaps are implemented, do: set_colormap, get_colormap

add draw_glyphs if we are desparate

Methods

drawArc

Draws an arc or a filled 'pie slice'.

drawArc:: d:: GC:: Bool:: Int:: Int:: Int:: Int:: Int:: Int:: IO ()
dgcfilledxywidthheightaStartaEnd

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.

drawDrawable

Copies another Drawable.

drawDrawable:: dest:: GC:: src:: Int:: Int:: Int:: Int:: Int:: Int:: IO ()
destgcsrcxSrcySrcxDestyDestwidthheight

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.

drawLayout

in that it uses the default colors from the graphics context. Draw a paragraph of text.

drawLayout:: d:: GC:: Int:: Int:: PangoLayout:: IO ()
dgcxytext

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

drawLayoutLine

in that it uses the default colors from the graphics context. Draw a single line of text.

drawLayoutLine:: d:: GC:: Int:: Int:: LayoutLine:: IO ()
dgcxytext

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

drawLayoutLineWithColors

Draw a single line of text.

drawLayoutLineWithColors:: d:: GC:: Int:: Int:: LayoutLine:: Maybe Color:: Maybe Color:: IO ()
dgcxytextforegroundbackground

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

drawLayoutWithColors

Draw a paragraph of text.

drawLayoutWithColors:: d:: GC:: Int:: Int:: PangoLayout:: Maybe Color:: Maybe Color:: IO ()
dgcxytextforegroundbackground

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

If both colors are Nothing this function will behave like

drawLine

Draw a line into a Drawable.

drawLine:: d:: GC:: Point:: Point:: IO ()
dgc(x1, y1)(x2, y2)

The parameters are x1, y1, x2, y2.

Drawing several separate lines can be done more efficiently by drawSegments.

drawLines

Draw several lines.

drawLines:: d:: GC:: [Point]:: IO ()
dgcpoints
dgc[]

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

drawPixbuf

Render a Pixbuf.

drawPixbuf:: d:: GC:: Pixbuf:: Int:: Int:: Int:: Int:: Int:: Int:: Dither:: Int:: Int:: IO ()
dgcpbsrcXsrcYdestXdestYsrcWidthsrcHeightditherxDitheryDither

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.

drawPoint

Draw a point into a Drawable.

drawPoint:: d:: GC:: Point:: IO ()
dgc(x, y)

drawPoints

Draw several points into a Drawable.

drawPoints:: d:: GC:: [Point]:: IO ()
dgcpoints
dgc[]

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

drawPolygon

Draws an outlined or filled polygon.

drawPolygon:: d:: GC:: Bool:: [Point]:: IO ()
dgcfilledpoints
___[]

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

drawRectangle

Draw a rectangular object.

drawRectangle:: d:: GC:: Bool:: Int:: Int:: Int:: Int:: IO ()
dgcfilledxywidthheight

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.

drawSegments

Draw several unconnected lines.

drawSegments:: d:: GC:: [(Point,Point)]:: IO ()
dgcpps
dgc[]

This method draws several unrelated lines.

drawableGetClipRegion

Determine where not to draw.

drawableGetClipRegion:: d:: IO Region
d

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.

drawableGetDepth

Get the size of pixels.

drawableGetDepth:: d:: IO Int
d

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

drawableGetSize

Retrieve the size of the Drawable.

drawableGetSize:: d:: IO (Int,Int)
d

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

drawableGetVisibleRegion

Determine what not to redraw.

drawableGetVisibleRegion:: d:: IO Region
d

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.