Graphics.Rendering.Cairo

cairo-0.13.11.0: Binding to the Cairo library.

Copyright | (c) Paolo Martini 2005 (c) Abraham Egnor 2004 (c) Aetion Technologies LLC 2004
License | BSD-style (see cairo/COPYRIGHT)
Maintainer | p.martini@neuralnoise.com
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell98

Graphics.Rendering.Cairo

Contents

- Drawing
  - Paths
  - Patterns
  - Transformations
  - Text
- Fonts
  - Font options
- Surfaces
  - Image surfaces
  - PNG support
  - PDF surfaces
  - PS surfaces
  - SVG surfaces
- Regions
- Utilities
- Types

Description

The Cairo 2D graphics library.

Cairo is a 2D graphics library with support for multiple output devices. Currently supported output targets include the X Window System, win32, and image buffers. Experimental backends include OpenGL (through glitz), Quartz, XCB, PostScript and PDF file output.

Cairo is designed to produce consistent output on all output media while taking advantage of display hardware acceleration when available (eg. through the X Render Extension).

The cairo API provides operations similar to the drawing operators of PostScript and PDF. Operations in cairo including stroking and filling cubic Bezier splines, transforming and compositing translucent images, and antialiased text rendering. All drawing operations can be transformed by any affine transformation (scale, rotation, shear, etc.)

Cairo is free software and is available to be redistributed and/or modified under the terms of either the GNU Lesser General Public License (LGPL) version 2.1 or the Mozilla Public License (MPL) version 1.1.

For more information see http://cairographics.org

- Note the Haskell bindings do not support all the possible cairo backends because it would require bindings for the associated technology (eg X11, glitz, etc) however bindings to other backends may be implemented externally. For example, Gtk2Hs provides a binding to the backend for X11 (and win32 on Windows).

Synopsis

- renderWith :: MonadIO m => Surface -> Render a -> m a
- save :: Render ()
- restore :: Render ()
- status :: Render Status
- withTargetSurface :: (Surface -> Render a) -> Render a
- pushGroup :: Render ()
- pushGroupWithContent :: Content -> Render ()
- popGroupToSource :: Render ()
- setSourceRGB :: Double -> Double -> Double -> Render ()
- setSourceRGBA :: Double -> Double -> Double -> Double -> Render ()
- setSource :: Pattern -> Render ()
- setSourceSurface :: Surface -> Double -> Double -> Render ()
- getSource :: Render Pattern
- setAntialias :: Antialias -> Render ()
- setDash :: [Double] -> Double -> Render ()
- setFillRule :: FillRule -> Render ()
- getFillRule :: Render FillRule
- setLineCap :: LineCap -> Render ()
- getLineCap :: Render LineCap
- setLineJoin :: LineJoin -> Render ()
- getLineJoin :: Render LineJoin
- setLineWidth :: Double -> Render ()
- getLineWidth :: Render Double
- setMiterLimit :: Double -> Render ()
- getMiterLimit :: Render Double
- setOperator :: Operator -> Render ()
- getOperator :: Render Operator
- setTolerance :: Double -> Render ()
- getTolerance :: Render Double
- clip :: Render ()
- clipPreserve :: Render ()
- clipExtents :: Render (Double, Double, Double, Double)
- resetClip :: Render ()
- fill :: Render ()
- fillPreserve :: Render ()
- fillExtents :: Render (Double, Double, Double, Double)
- inFill :: Double -> Double -> Render Bool
- mask :: Pattern -> Render ()
- maskSurface :: Surface -> Double -> Double -> Render ()
- paint :: Render ()
- paintWithAlpha :: Double -> Render ()
- stroke :: Render ()
- strokePreserve :: Render ()
- strokeExtents :: Render (Double, Double, Double, Double)
- inStroke :: Double -> Double -> Render Bool
- copyPage :: Render ()
- showPage :: Render ()
- getCurrentPoint :: Render (Double, Double)
- newPath :: Render ()
- closePath :: Render ()
- arc :: Double -> Double -> Double -> Double -> Double -> Render ()
- arcNegative :: Double -> Double -> Double -> Double -> Double -> Render ()
- curveTo :: Double -> Double -> Double -> Double -> Double -> Double -> Render ()
- lineTo :: Double -> Double -> Render ()
- moveTo :: Double -> Double -> Render ()
- rectangle :: Double -> Double -> Double -> Double -> Render ()
- textPath :: CairoString string => string -> Render ()
- relCurveTo :: Double -> Double -> Double -> Double -> Double -> Double -> Render ()
- relLineTo :: Double -> Double -> Render ()
- relMoveTo :: Double -> Double -> Render ()
- copyPath :: Render Path
- copyPathFlat :: Render Path
- appendPath :: Path -> Render ()
- pathExtents :: Render (Double, Double, Double, Double)
- createRGBPattern :: MonadIO m => Double -> Double -> Double -> m Pattern
- createRGBAPattern :: MonadIO m => Double -> Double -> Double -> Double -> m Pattern
- createLinearPattern :: MonadIO m => Double -> Double -> Double -> Double -> m Pattern
- createRadialPattern :: MonadIO m => Double -> Double -> Double -> Double -> Double -> Double -> m Pattern
- withRGBPattern :: Double -> Double -> Double -> (Pattern -> Render a) -> Render a
- withRGBAPattern :: Double -> Double -> Double -> Double -> (Pattern -> Render a) -> Render a
- withPatternForSurface :: Surface -> (Pattern -> Render a) -> Render a
- withGroupPattern :: (Pattern -> Render a) -> Render a
- withLinearPattern :: Double -> Double -> Double -> Double -> (Pattern -> Render a) -> Render a
- withRadialPattern :: Double -> Double -> Double -> Double -> Double -> Double -> (Pattern -> Render a) -> Render a
- patternAddColorStopRGB :: MonadIO m => Pattern -> Double -> Double -> Double -> Double -> m ()
- patternAddColorStopRGBA :: MonadIO m => Pattern -> Double -> Double -> Double -> Double -> Double -> m ()
- patternSetMatrix :: MonadIO m => Pattern -> Matrix -> m ()
- patternGetMatrix :: MonadIO m => Pattern -> m Matrix
- patternSetExtend :: MonadIO m => Pattern -> Extend -> m ()
- patternGetExtend :: MonadIO m => Pattern -> m Extend
- patternSetFilter :: MonadIO m => Pattern -> Filter -> m ()
- patternGetFilter :: MonadIO m => Pattern -> m Filter
- translate :: Double -> Double -> Render ()
- scale :: Double -> Double -> Render ()
- rotate :: Double -> Render ()
- transform :: Matrix -> Render ()
- setMatrix :: Matrix -> Render ()
- getMatrix :: Render Matrix
- identityMatrix :: Render ()
- userToDevice :: Double -> Double -> Render (Double, Double)
- userToDeviceDistance :: Double -> Double -> Render (Double, Double)
- deviceToUser :: Double -> Double -> Render (Double, Double)
- deviceToUserDistance :: Double -> Double -> Render (Double, Double)
- selectFontFace :: CairoString string => string -> FontSlant -> FontWeight -> Render ()
- setFontSize :: Double -> Render ()
- setFontMatrix :: Matrix -> Render ()
- getFontMatrix :: Render Matrix
- setFontOptions :: FontOptions -> Render ()
- showText :: CairoString string => string -> Render ()
- fontExtents :: Render FontExtents
- textExtents :: CairoString string => string -> Render TextExtents
- fontOptionsCreate :: MonadIO m => m FontOptions
- fontOptionsCopy :: MonadIO m => FontOptions -> m FontOptions
- fontOptionsMerge :: MonadIO m => FontOptions -> FontOptions -> m ()
- fontOptionsHash :: MonadIO m => FontOptions -> m Int
- fontOptionsEqual :: MonadIO m => FontOptions -> FontOptions -> m Bool
- fontOptionsSetAntialias :: MonadIO m => FontOptions -> Antialias -> m ()
- fontOptionsGetAntialias :: MonadIO m => FontOptions -> m Antialias
- fontOptionsSetSubpixelOrder :: MonadIO m => FontOptions -> SubpixelOrder -> m ()
- fontOptionsGetSubpixelOrder :: MonadIO m => FontOptions -> m SubpixelOrder
- fontOptionsSetHintStyle :: MonadIO m => FontOptions -> HintStyle -> m ()
- fontOptionsGetHintStyle :: MonadIO m => FontOptions -> m HintStyle
- fontOptionsSetHintMetrics :: MonadIO m => FontOptions -> HintMetrics -> m ()
- fontOptionsGetHintMetrics :: MonadIO m => FontOptions -> m HintMetrics
- withSimilarSurface :: Surface -> Content -> Int -> Int -> (Surface -> IO a) -> IO a
- createSimilarSurface :: Surface -> Content -> Int -> Int -> IO Surface
- renderWithSimilarSurface :: Content -> Int -> Int -> (Surface -> Render a) -> Render a
- surfaceGetFontOptions :: Surface -> Render FontOptions
- surfaceFinish :: MonadIO m => Surface -> m ()
- surfaceFlush :: MonadIO m => Surface -> m ()
- surfaceMarkDirty :: MonadIO m => Surface -> m ()
- surfaceMarkDirtyRectangle :: MonadIO m => Surface -> Int -> Int -> Int -> Int -> m ()
- surfaceSetDeviceOffset :: MonadIO m => Surface -> Double -> Double -> m ()
- withImageSurface :: Format -> Int -> Int -> (Surface -> IO a) -> IO a
- withImageSurfaceForData :: PixelData -> Format -> Int -> Int -> Int -> (Surface -> IO a) -> IO a
- formatStrideForWidth :: Format -> Int -> Int
- createImageSurfaceForData :: PixelData -> Format -> Int -> Int -> Int -> IO Surface
- createImageSurface :: Format -> Int -> Int -> IO Surface
- imageSurfaceGetWidth :: MonadIO m => Surface -> m Int
- imageSurfaceGetHeight :: MonadIO m => Surface -> m Int
- imageSurfaceGetFormat :: MonadIO m => Surface -> m Format
- imageSurfaceGetStride :: MonadIO m => Surface -> m Int
- imageSurfaceGetData :: Surface -> IO ByteString
- data SurfaceData i e
- imageSurfaceGetPixels :: Storable e => Surface -> IO (SurfaceData Int e)
- withImageSurfaceFromPNG :: FilePath -> (Surface -> IO a) -> IO a
- imageSurfaceCreateFromPNG :: FilePath -> IO Surface
- surfaceWriteToPNG :: Surface -> FilePath -> IO ()
- withPDFSurface :: FilePath -> Double -> Double -> (Surface -> IO a) -> IO a
- pdfSurfaceSetSize :: MonadIO m => Surface -> Double -> Double -> m ()
- withPSSurface :: FilePath -> Double -> Double -> (Surface -> IO a) -> IO a
- psSurfaceSetSize :: MonadIO m => Surface -> Double -> Double -> m ()
- withSVGSurface :: FilePath -> Double -> Double -> (Surface -> IO a) -> IO a
- svgSurfaceSetDocumentUnit :: MonadIO m => Surface -> SvgUnit -> m ()
- svgSurfaceGetDocumentUnit :: MonadIO m => Surface -> m SvgUnit
- regionCreate :: MonadIO m => m Region
- regionCreateRectangle :: MonadIO m => RectangleInt -> m Region
- regionCreateRectangles :: MonadIO m => [RectangleInt] -> m Region
- regionCopy :: MonadIO m => Region -> m Region
- regionGetExtents :: MonadIO m => Region -> m RectangleInt
- regionNumRectangles :: MonadIO m => Region -> m Int
- regionGetRectangle :: MonadIO m => Region -> Int -> m RectangleInt
- regionIsEmpty :: MonadIO m => Region -> m Bool
- regionContainsPoint :: MonadIO m => Region -> Int -> Int -> m Bool
- regionContainsRectangle :: MonadIO m => Region -> RectangleInt -> m RegionOverlap
- regionEqual :: MonadIO m => Region -> Region -> m Bool
- regionTranslate :: MonadIO m => Region -> Int -> Int -> m ()
- regionIntersect :: MonadIO m => Region -> Region -> m ()
- regionIntersectRectangle :: MonadIO m => Region -> RectangleInt -> m ()
- regionSubtract :: MonadIO m => Region -> Region -> m ()
- regionSubtractRectangle :: MonadIO m => Region -> RectangleInt -> m ()
- regionUnion :: MonadIO m => Region -> Region -> m ()
- regionUnionRectangle :: MonadIO m => Region -> RectangleInt -> m ()
- regionXor :: MonadIO m => Region -> Region -> m ()
- regionXorRectangle :: MonadIO m => Region -> RectangleInt -> m ()
- liftIO :: MonadIO m => IO a -> m a
- version :: Int
- versionString :: String
- class CairoString s
- data Render m
- data Matrix
- data Surface
- data Pattern
- data Status
  - = StatusSuccess
  - | StatusNoMemory
  - | StatusInvalidRestore
  - | StatusInvalidPopGroup
  - | StatusNoCurrentPoint
  - | StatusInvalidMatrix
  - | StatusInvalidStatus
  - | StatusNullPointer
  - | StatusInvalidString
  - | StatusInvalidPathData
  - | StatusReadError
  - | StatusWriteError
  - | StatusSurfaceFinished
  - | StatusSurfaceTypeMismatch
  - | StatusPatternTypeMismatch
  - | StatusInvalidContent
  - | StatusInvalidFormat
  - | StatusInvalidVisual
  - | StatusFileNotFound
  - | StatusInvalidDash
  - | StatusInvalidDscComment
  - | StatusInvalidIndex
  - | StatusClipNotRepresentable
  - | StatusTempFileError
  - | StatusInvalidStride
  - | StatusFontTypeMismatch
  - | StatusUserFontImmutable
  - | StatusUserFontError
  - | StatusNegativeCount
  - | StatusInvalidClusters
  - | StatusInvalidSlant
  - | StatusInvalidWeight
  - | StatusInvalidSize
  - | StatusUserFontNotImplemented
  - | StatusDeviceTypeMismatch
  - | StatusDeviceError
  - | StatusInvalidMeshConstruction
  - | StatusDeviceFinished
  - | StatusJbig2GlobalMissing
  - | StatusPngError
  - | StatusFreetypeError
  - | StatusWin32GdiError
  - | StatusTagError
  - | StatusDwriteError
  - | StatusSvgFontError
  - | StatusLastStatus
- data Operator
  - = OperatorClear
  - | OperatorSource
  - | OperatorOver
  - | OperatorIn
  - | OperatorOut
  - | OperatorAtop
  - | OperatorDest
  - | OperatorDestOver
  - | OperatorDestIn
  - | OperatorDestOut
  - | OperatorDestAtop
  - | OperatorXor
  - | OperatorAdd
  - | OperatorSaturate
  - | OperatorMultiply
  - | OperatorScreen
  - | OperatorOverlay
  - | OperatorDarken
  - | OperatorLighten
  - | OperatorColorDodge
  - | OperatorColorBurn
  - | OperatorHardLight
  - | OperatorSoftLight
  - | OperatorDifference
  - | OperatorExclusion
  - | OperatorHslHue
  - | OperatorHslSaturation
  - | OperatorHslColor
  - | OperatorHslLuminosity
- data Antialias
  - = AntialiasDefault
  - | AntialiasNone
  - | AntialiasGray
  - | AntialiasSubpixel
  - | AntialiasFast
  - | AntialiasGood
  - | AntialiasBest
- data FillRule
  - = FillRuleWinding
  - | FillRuleEvenOdd
- data LineCap
  - = LineCapButt
  - | LineCapRound
  - | LineCapSquare
- data LineJoin
  - = LineJoinMiter
  - | LineJoinRound
  - | LineJoinBevel
- data ScaledFont
- data FontFace
- data Glyph
- data TextExtents = TextExtents {
  - textExtentsXbearing :: Double
  - textExtentsYbearing :: Double
  - textExtentsWidth :: Double
  - textExtentsHeight :: Double
  - textExtentsXadvance :: Double
  - textExtentsYadvance :: Double
  }
- data FontExtents = FontExtents {
  - fontExtentsAscent :: Double
  - fontExtentsDescent :: Double
  - fontExtentsHeight :: Double
  - fontExtentsMaxXadvance :: Double
  - fontExtentsMaxYadvance :: Double
  }
- data FontSlant
  - = FontSlantNormal
  - | FontSlantItalic
  - | FontSlantOblique
- data FontWeight
  - = FontWeightNormal
  - | FontWeightBold
- data SubpixelOrder
  - = SubpixelOrderDefault
  - | SubpixelOrderRgb
  - | SubpixelOrderBgr
  - | SubpixelOrderVrgb
  - | SubpixelOrderVbgr
- data HintStyle
  - = HintStyleDefault
  - | HintStyleNone
  - | HintStyleSlight
  - | HintStyleMedium
  - | HintStyleFull
- data HintMetrics
  - = HintMetricsDefault
  - | HintMetricsOff
  - | HintMetricsOn
- data FontOptions
- type Path = [PathElement]
- data PathElement
  - = MoveTo Double Double
  - | LineTo Double Double
  - | CurveTo Double Double Double Double Double Double
  - | ClosePath
- data SurfaceType
  - = SurfaceTypeImage
  - | SurfaceTypePdf
  - | SurfaceTypePs
  - | SurfaceTypeXlib
  - | SurfaceTypeXcb
  - | SurfaceTypeGlitz
  - | SurfaceTypeQuartz
  - | SurfaceTypeWin32
  - | SurfaceTypeBeos
  - | SurfaceTypeDirectfb
  - | SurfaceTypeSvg
  - | SurfaceTypeOs2
  - | SurfaceTypeWin32Printing
  - | SurfaceTypeQuartzImage
  - | SurfaceTypeScript
  - | SurfaceTypeQt
  - | SurfaceTypeRecording
  - | SurfaceTypeVg
  - | SurfaceTypeGl
  - | SurfaceTypeDrm
  - | SurfaceTypeTee
  - | SurfaceTypeXml
  - | SurfaceTypeSkia
  - | SurfaceTypeSubsurface
  - | SurfaceTypeCogl
- data PatternType
  - = PatternTypeSolid
  - | PatternTypeSurface
  - | PatternTypeLinear
  - | PatternTypeRadial
  - | PatternTypeMesh
  - | PatternTypeRasterSource
- data RectangleInt = RectangleInt {
  - x :: Int
  - y :: Int
  - width :: Int
  - height :: Int
  }
- data RegionOverlap
  - = RegionOverlapIn
  - | RegionOverlapOut
  - | RegionOverlapPart
- data Region
- data Content
  - = ContentColor
  - | ContentAlpha
  - | ContentColorAlpha
- data Format
  - = FORMAT_INVALID
  - | FormatARGB32
  - | FormatRGB24
  - | FormatA8
  - | FormatA1
  - | FormatRGB16565
  - | FormatRGB30
  - | FORMAT_RGB96F
  - | FORMAT_RGBA128F
- data Extend
  - = ExtendNone
  - | ExtendRepeat
  - | ExtendReflect
  - | ExtendPad
- data Filter
  - = FilterFast
  - | FilterGood
  - | FilterBest
  - | FilterNearest
  - | FilterBilinear
  - | FilterGaussian
- data SvgUnit
  - = SvgUnitUser
  - | SvgUnitEm
  - | SvgUnitEx
  - | SvgUnitPx
  - | SvgUnitIn
  - | SvgUnitCm
  - | SvgUnitMm
  - | SvgUnitPt
  - | SvgUnitPc
  - | SvgUnitPercent
- createMeshPattern :: MonadIO m => m Pattern
- meshPatternAddPatchRGB :: MonadIO m => Pattern -> Path -> [(Double, Double)] -> [(Double, Double, Double)] -> m Status
- meshPatternAddPatchRGBA :: MonadIO m => Pattern -> Path -> [(Double, Double)] -> [(Double, Double, Double, Double)] -> m Status
- meshPatternBeginPatch :: MonadIO m => Pattern -> m ()
- meshPatternEndPatch :: MonadIO m => Pattern -> m ()
- meshPatternMoveTo :: MonadIO m => Pattern -> Double -> Double -> m ()
- meshPatternLineTo :: MonadIO m => Pattern -> Double -> Double -> m ()
- meshPatternCurveTo :: MonadIO m => Pattern -> Double -> Double -> Double -> Double -> Double -> Double -> m ()
- meshPatternSetControlPoint :: MonadIO m => Pattern -> Int -> Double -> Double -> m ()
- meshPatternSetCornerColorRGB :: MonadIO m => Pattern -> Int -> Double -> Double -> Double -> m ()
- meshPatternSetCornerColorRGBA :: MonadIO m => Pattern -> Int -> Double -> Double -> Double -> Double -> m ()
- meshPatternGetPatchCount :: MonadIO m => Pattern -> m (Status, Int)
- meshPatternGetPath :: MonadIO m => Pattern -> Int -> m Path
- meshPatternGetControlPoint :: MonadIO m => Pattern -> Int -> Int -> m (Status, Double, Double)
- meshPatternGetCornerColorRGBA :: MonadIO m => Pattern -> Int -> Int -> m (Status, Double, Double, Double, Double)

# Drawing

renderWith #

Arguments

:: MonadIO m |
=> Surface | the target surface for the Render context
-> Render a |
-> m a |

Creates a new Render context with all graphics state parameters set to default values and with the given surface as a target surface. The target surface should be constructed with a backend-specific function such as `withImageSurface` (or any other with<backend>Surface variant).

save :: Render () #

Makes a copy of the current state and saves it on an internal stack of saved states. When `restore` is called, the saved state is restored. Multiple calls to `save` and `restore` can be nested; each call to `restore` restores the state from the matching paired `save`.

restore :: Render () #

Restores to the state saved by a preceding call to `save` and removes that state from the stack of saved states.

status :: Render Status #

Ask for the status of the current `Render` monad.

withTargetSurface :: (Surface -> Render a) -> Render a #

Gets the target surface for the Render context as passed to `renderWith`.

pushGroup :: Render () #

Like `pushGroupWithContent ContentColorAlpha`, but more convenient.

pushGroupWithContent :: Content -> Render () #

Temporarily redirects drawing to an intermediate surface known as a group. The redirection lasts until the group is completed by a call to `withGroupPattern` or `popGroupToSource`. These calls provide the result of any drawing to the group as a pattern (either as an explicit object, or set as the source pattern). This group functionality can be convenient for performing intermediate compositing. One common use of a group is to render objects as opaque within the group (so that they occlude each other), and then blend the result with translucence onto the destination.

Groups can be nested arbitrarily deeply by making balanced calls to `pushGroupWithContent` and `withGroupPattern`. As a side effect, `pushGroupWithContent` calls `save` and `withGroupPattern` calls `restore`, so that any changes to the graphics state will not be visible outside the group.

As an example, here is how one might fill and stroke a path with translucence, but without any portion of the fill being visible under the stroke:

    pushGroup
    setSource fillPattern
    fillPreserve
    setSource strokePattern
    stroke
    popGroupToSource
    paintWithAlpha alpha

popGroupToSource :: Render () #

Like `withGroupPattern setSource`, but more convenient.

setSourceRGB #

Arguments

:: Double | red component of colour
-> Double | green component of colour
-> Double | blue component of colour
-> Render () |

Sets the source pattern within the context to an opaque color. This opaque color will then be used for any subsequent drawing operation until a new source pattern is set.

The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

setSourceRGBA #

Arguments

:: Double | red component of color
-> Double | green component of color
-> Double | blue component of color
-> Double | alpha component of color
-> Render () |

Sets the source pattern within the context to a translucent color. This color will then be used for any subsequent drawing operation until a new source pattern is set.

The color and alpha components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

setSource #

Arguments

:: Pattern | a `Pattern` to be used as the source for subsequent drawing operations.
-> Render () |

Sets the source pattern within the context to source. This pattern will then be used for any subsequent drawing operation until a new source pattern is set.

Note: The pattern's transformation matrix will be locked to the user space in effect at the time of `setSource`. This means that further modifications of the current transformation matrix will not affect the source pattern. See `setMatrix`.

setSourceSurface #

Arguments

:: Surface | a surface to be used to set the source pattern
-> Double | user-space X coordinate for surface origin
-> Double | user-space Y coordinate for surface origin
-> Render () |

This is a convenience function for creating a pattern from surface and setting it as the source in the context with `setSource`.

The x and y parameters give the user-space coordinate at which the surface origin should appear. (The surface origin is its upper-left corner before any transformation has been applied.) The x and y patterns are negated and then set as translation values in the pattern matrix.

Other than the initial translation pattern matrix, as described above, all other pattern attributes, (such as its extend mode), are set to the default values as in `patternCreateForSurface`. The resulting pattern can be queried with `getSource` so that these attributes can be modified if desired, (eg. to create a repeating pattern with `patternSetExtent`.

getSource :: Render Pattern #

Gets the current source pattern.

setAntialias #

Arguments

:: Antialias | the new antialiasing mode
-> Render () |

Set the antialiasing mode of the rasterizer used for drawing shapes. This value is a hint, and a particular backend may or may not support a particular value. At the current time, no backend supports `AntialiasSubpixel` when drawing shapes.

Note that this option does not affect text rendering, instead see `fontOptionsSetAntilias`.

setDash #

Arguments

:: [Double] | `dashes` a list specifying alternate lengths of on and off portions of the stroke
-> Double | an offset into the dash pattern at which the stroke should start
-> Render () |

Sets the dash pattern to be used by `stroke`. A dash pattern is specified by dashes, a list of positive values. Each value provides the user-space length of alternate "on" and "off" portions of the stroke. The offset specifies an offset into the pattern at which the stroke begins.

If `dashes` is `[]` then dashing is disabled.

setFillRule #

Arguments

:: FillRule | a fill rule
-> Render () |

Set the current fill rule within the cairo context. The fill rule is used to determine which regions are inside or outside a complex (potentially self-intersecting) path. The current fill rule affects both `fill` and `clip`. See `FillRule` for details on the semantics of each available fill rule.

getFillRule :: Render FillRule #

Gets the current fill rule, as set by `setFillrule`.

setLineCap #

Arguments

:: LineCap | a line cap style
-> Render () |

Sets the current line cap style within the cairo context. See `LineCap` for details about how the available line cap styles are drawn.

As with the other stroke parameters, the current line cap style is examined by `stroke`, `strokeExtents`, and `strokeToPath`, but does not have any effect during path construction.

getLineCap :: Render LineCap #

Gets the current line cap style, as set by `setLineCap`.

setLineJoin #

Arguments

:: LineJoin | a line joint style
-> Render () |

Sets the current line join style within the cairo context. See `LineJoin` for details about how the available line join styles are drawn.

As with the other stroke parameters, the current line join style is examined by `stroke`, `strokeExtents`, and `strokeToPath`, but does not have any effect during path construction.

getLineJoin :: Render LineJoin #

Gets the current line join style, as set by `setLineJoin`.

setLineWidth #

Arguments

:: Double | a line width
-> Render () |

Sets the current line width within the cairo context. The line width specifies the diameter of a pen that is circular in user-space.

As with the other stroke parameters, the current line cap style is examined by `stroke`, `strokeExtents`, and `strokeToPath`, but does not have any effect during path construction.

getLineWidth :: Render Double #

Gets the current line width, as set by `setLineWidth`.

setMiterLimit #

Arguments

:: Double |
-> Render () |

getMiterLimit :: Render Double #

Gets the current miter limit, as set by `setMiterLimit`.

setOperator #

Arguments

:: Operator | a compositing operator
-> Render () |

Sets the compositing operator to be used for all drawing operations. See `Operator` for details on the semantics of each available compositing operator.

getOperator :: Render Operator #

Gets the current compositing operator for a cairo context.

setTolerance #

Arguments

:: Double | the tolerance, in device units (typically pixels)
-> Render () |

Sets the tolerance used when converting paths into trapezoids. Curved segments of the path will be subdivided until the maximum deviation between the original path and the polygonal approximation is less than tolerance. The default value is 0.1. A larger value will give better performance, a smaller value, better appearance. (Reducing the value from the default value of 0.1 is unlikely to improve appearance significantly.)

getTolerance :: Render Double #

Gets the current tolerance value, as set by `setTolerance`.

clip :: Render () #

Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by `fill` and according to the current fill rule (see `setFillRule`).

After `clip`, the current path will be cleared from the cairo context.

The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region.

Calling `clip` can only make the clip region smaller, never larger. But the current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling `clip` within a `save`/`restore` pair. The only other means of increasing the size of the clip region is `resetClip`.

clipPreserve :: Render () #

Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by `fill` and according to the current fill rule (see `setFillRule`).

Unlike `clip`, cairoClipPreserve preserves the path within the cairo context.

The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region.

Calling `clip` can only make the clip region smaller, never larger. But the current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling `clip` within a `save`/`restore` pair. The only other means of increasing the size of the clip region is `resetClip`.

clipExtents :: Render (Double, Double, Double, Double) #

Computes a bounding box in user coordinates covering the area inside the current clip.

resetClip :: Render () #

Reset the current clip region to its original, unrestricted state. That is, set the clip region to an infinitely large shape containing the target surface. Equivalently, if infinity is too hard to grasp, one can imagine the clip region being reset to the exact bounds of the target surface.

Note that code meant to be reusable should not call `resetClip` as it will cause results unexpected by higher-level code which calls `clip`. Consider using `save` and `restore` around `clip` as a more robust means of temporarily restricting the clip region.

fill :: Render () #

A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled). After `fill`, the current path will be cleared from the cairo context.

See `setFillRule` and `fillPreserve`.

fillPreserve :: Render () #

A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled). Unlike `fill`, `fillPreserve` preserves the path within the cairo context.

See `setFillRule` and `fill`.

fillExtents :: Render (Double, Double, Double, Double) #

inFill :: Double -> Double -> Render Bool #

mask #

Arguments

:: Pattern | a `Pattern`
-> Render () |

A drawing operator that paints the current source using the alpha channel of pattern as a mask. (Opaque areas of mask are painted with the source, transparent areas are not painted.)

maskSurface #

Arguments

:: Surface | a `Surface`
-> Double | X coordinate at which to place the origin of surface
-> Double | Y coordinate at which to place the origin of surface
-> Render () |

A drawing operator that paints the current source using the alpha channel of surface as a mask. (Opaque areas of surface are painted with the source, transparent areas are not painted.)

paint :: Render () #

A drawing operator that paints the current source everywhere within the current clip region.

paintWithAlpha #

Arguments

:: Double | alpha value, between 0 (transparent) and 1 (opaque)
-> Render () |

A drawing operator that paints the current source everywhere within the current clip region using a mask of constant alpha value alpha. The effect is similar to `paint`, but the drawing is faded out using the alpha value.

stroke :: Render () #

A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. After issuing `stroke`, the current path will be cleared from the `Render` monad.

See `setLineWidth`, `setLineJoin`, `setLineCap`, `setDash`, and `strokePreserve`.

strokePreserve :: Render () #

A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. Unlike `stroke`, `strokePreserve` preserves the path within the `Render` monad.

See `setLineWidth`, `setLineJoin`, `setLineCap`, `setDash`, and `strokePreserve`.

strokeExtents :: Render (Double, Double, Double, Double) #

inStroke :: Double -> Double -> Render Bool #

copyPage :: Render () #

showPage :: Render () #

## Paths

getCurrentPoint :: Render (Double, Double) #

Gets the current point of the current path, which is conceptually the final point reached by the path so far.

The current point is returned in the user-space coordinate system. If there is no defined current point then x and y will both be set to 0.0.

Most path construction functions alter the current point. See the following for details on how they affect the current point: `newPath`, `moveTo`, `lineTo`, `curveTo`, `arc`, `relMoveTo`, `relLineTo`, `relCurveTo`, `arcNegative`, `textPath`, `strokeToPath`.

newPath :: Render () #

Clears the current path. After this call there will be no current point.

closePath :: Render () #

Adds a line segment to the path from the current point to the beginning of the current subpath, (the most recent point passed to `moveTo`), and closes this subpath.

The behavior of `closePath` is distinct from simply calling `lineTo` with the equivalent coordinate in the case of stroking. When a closed subpath is stroked, there are no caps on the ends of the subpath. Instead, their is a line join connecting the final and initial segments of the subpath.

arc #

Arguments

:: Double | `xc` - X position of the center of the arc
-> Double | `yc` - Y position of the center of the arc
-> Double | `radius` - the radius of the arc
-> Double | `angle1` - the start angle, in radians
-> Double | `angle2` - the end angle, in radians
-> Render () |

Adds a circular arc of the given radius to the current path. The arc is centered at (`xc`, `yc`), begins at `angle1` and proceeds in the direction of increasing angles to end at `angle2`. If `angle2` is less than `angle1` it will be progressively increased by `2*pi` until it is greater than `angle1`.

If there is a current point, an initial line segment will be added to the path to connect the current point to the beginning of the arc.

Angles are measured in radians. An angle of 0 is in the direction of the positive X axis (in user-space). An angle of `pi/2` radians (90 degrees) is in the direction of the positive Y axis (in user-space). Angles increase in the direction from the positive X axis toward the positive Y axis. So with the default transformation matrix, angles increase in a clockwise direction.

(To convert from degrees to radians, use `degrees * (pi / 180)`.)

This function gives the arc in the direction of increasing angles; see `arcNegative` to get the arc in the direction of decreasing angles.

The arc is circular in user-space. To achieve an elliptical arc, you can scale the current transformation matrix by different amounts in the X and Y directions. For example, to draw an ellipse in the box given by x, y, width, height:

    save
    translate (x + width / 2) (y + height / 2)
    scale (1 / (height / 2.)) (1 / (width / 2))
    arc 0 0 1 0 (2 * pi)
    restore

arcNegative #

Arguments

:: Double | `xc` - X position of the center of the arc
-> Double | `yc` - Y position of the center of the arc
-> Double | `radius` - the radius of the arc
-> Double | `angle1` - the start angle, in radians
-> Double | `angle2` - the end angle, in radians
-> Render () |

Adds a circular arc of the given radius to the current path. The arc is centered at (`xc`, `yc`), begins at `angle1` and proceeds in the direction of decreasing angles to end at `angle2`. If `angle2` is greater than `angle1` it will be progressively decreased by 2*`pi` until it is greater than `angle1`.

See `arc` for more details. This function differs only in the direction of the arc between the two angles.

curveTo #

Arguments

:: Double | `x1` - the X coordinate of the first control point
-> Double | `y1` - the Y coordinate of the first control point
-> Double | `x2` - the X coordinate of the second control point
-> Double | `y2` - the Y coordinate of the second control point
-> Double | `x3` - the X coordinate of the end of the curve
-> Double | `y3` - the Y coordinate of the end of the curve
-> Render () |

Adds a cubic Bezier spline to the path from the current point to position (`x3`, `y3`) in user-space coordinates, using (`x1`, `y1`) and (`x2`, `y2`) as the control points. After this call the current point will be (`x3`, `y3`).

lineTo #

Arguments

:: Double | `x` - the X coordinate of the end of the new line
-> Double | `y` - the Y coordinate of the end of the new line
-> Render () |

Adds a line to the path from the current point to position (`x`, `y`) in user-space coordinates. After this call the current point will be (`x`, `y`).

moveTo #

Arguments

:: Double | `x` - the X coordinate of the new position
-> Double | `y` - the Y coordinate of the new position
-> Render () |

If the current subpath is not empty, begin a new subpath. After this call the current point will be (`x`, `y`).

rectangle #

Arguments

:: Double | `x` - the X coordinate of the top left corner of the rectangle
-> Double | `y` - the Y coordinate of the top left corner of the rectangle
-> Double | `width` - the width of the rectangle
-> Double | `height` - the height of the rectangle
-> Render () |

Adds a closed-subpath rectangle of the given size to the current path at position (`x`, `y`) in user-space coordinates.

textPath #

Arguments

:: CairoString string |
=> string |
-> Render () |

Render text at the current path.

- See `showText` for why you should use Gtk functions.

relCurveTo #

Arguments

:: Double | `dx1` - the X offset to the first control point
-> Double | `dy1` - the Y offset to the first control point
-> Double | `dx2` - the X offset to the second control point
-> Double | `dy2` - the Y offset to the second control point
-> Double | `dx3` - the X offset to the end of the curve
-> Double | `dy3` - the Y offset to the end of the curve
-> Render () |

Relative-coordinate version of `curveTo`. All offsets are relative to the current point. Adds a cubic Bezier spline to the path from the current point to a point offset from the current point by (`dx3`, `dy3`), using points offset by (`dx1`, `dy1`) and (`dx2`, `dy2`) as the control points. After this call the current point will be offset by (`dx3`, `dy3`).

Given a current point of (x, y), relCurveTo `dx1` `dy1` `dx2` `dy2` `dx3` `dy3` is logically equivalent to curveTo (x + `dx1`) (y + `dy1`) (x + `dx2`) (y + `dy2`) (x + `dx3`) (y + `dy3`).

relLineTo #

Arguments

:: Double | `dx` - the X offset to the end of the new line
-> Double | `dy` - the Y offset to the end of the new line
-> Render () |

Relative-coordinate version of `lineTo`. Adds a line to the path from the current point to a point that is offset from the current point by (`dx`, `dy`) in user space. After this call the current point will be offset by (`dx`, `dy`).

Given a current point of (x, y), relLineTo `dx` `dy` is logically equivalent to lineTo (x + `dx`) (y + `dy`).

relMoveTo #

Arguments

:: Double | `dx` - the X offset
-> Double | `dy` - the Y offset
-> Render () |

If the current subpath is not empty, begin a new subpath. After this call the current point will offset by (x, y).

Given a current point of (x, y), relMoveTo `dx` `dy` is logically equivalent to moveTo (x + `dx`) (y + `dy`)

copyPath :: Render Path #

Creates a copy of the current path and returns it to the user.

copyPathFlat :: Render Path #

Gets a flattened copy of the current path and returns it to the user.

This function is like copyPath except that any curves in the path will be approximated with piecewise-linear approximations, accurate to within the current tolerance value. That is, any path elements created by curveTo or relCurveTo will be replaced by a series of lineTo elements.

appendPath #

Arguments

:: Path | the path to append
-> Render () |

Append the path onto the current path.

The path may be either the return value from copyPath or copyPathFlat or it may be constructed manually.

pathExtents :: Render (Double, Double, Double, Double) #

## Patterns

createRGBPattern #

Arguments

:: MonadIO m |
=> Double |
    r
-> Double |
    g
-> Double |
    b
-> m Pattern |

createRGBAPattern #

Arguments

:: MonadIO m |
=> Double |
    r
-> Double |
    g
-> Double |
    b
-> Double |
    a
-> m Pattern |

createLinearPattern #

Arguments

:: MonadIO m |
=> Double |
    x1
-> Double |
    y1
-> Double |
    x2
-> Double |
    y2
-> m Pattern |

createRadialPattern #

Arguments

:: MonadIO m |
=> Double |
    x1
-> Double |
    y1
-> Double |
    r1
-> Double |
    x2
-> Double |
    y2
-> Double |
    r2
-> m Pattern |

withRGBPattern #

Arguments

:: Double | red component of the color
-> Double | green component of the color
-> Double | blue component of the color
-> (Pattern -> Render a) | a nested render action using the pattern
-> Render a |

Creates a new `Pattern` corresponding to an opaque color. The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

For example to create a solid red pattern:

    withRBGPattern 1 0 0 $ do
      ...
      ...

withRGBAPattern #

Arguments

:: Double | red component of color
-> Double | green component of color
-> Double | blue component of color
-> Double | alpha component of color
-> (Pattern -> Render a) | a nested render action using the pattern
-> Render a |

Creates a new `Pattern` corresponding to a translucent color. The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

For example to create a solid red pattern at 50% transparency:

    withRBGPattern 1 0 0 0.5 $ do
      ...
      ...

withPatternForSurface #

Arguments

:: Surface |
-> (Pattern -> Render a) | a nested render action using the pattern
-> Render a |

Create a new `Pattern` for the given surface.

withGroupPattern #

Arguments

:: (Pattern -> Render a) | a nested render action using the pattern
-> Render a |

Pop the current group from the group stack and use it as a pattern. The group should be populated first by calling `pushGroup` or `pushGroupWithContent` and doing some drawing operations. This also calls `restore` to balance the `save` called in `pushGroup`.

withLinearPattern #

Arguments

:: Double | `x0` - x coordinate of the start point
-> Double | `y0` - y coordinate of the start point
-> Double | `x1` - x coordinate of the end point
-> Double | `y1` - y coordinate of the end point
-> (Pattern -> Render a) | a nested render action using the pattern
-> Render a |

Create a new linear gradient `Pattern` along the line defined by `(x0, y0)` and `(x1, y1)`. Before using the gradient pattern, a number of color stops should be defined using `patternAddColorStopRGB` and `patternAddColorStopRGBA`.

- Note: The coordinates here are in pattern space. For a new pattern, pattern space is identical to user space, but the relationship between the spaces can be changed with `patternSetMatrix`.

withRadialPattern #

Arguments

:: Double | `cx0` - x coordinate for the center of the start circle
-> Double | `cy0` - y coordinate for the center of the start circle
-> Double | `radius0` - radius of the start circle
-> Double | `cx1` - x coordinate for the center of the end circle
-> Double | `cy1` - y coordinate for the center of the end circle
-> Double | `radius1` - radius of the end circle
-> (Pattern -> Render a) | a nested render action using the pattern
-> Render a |

Creates a new radial gradient `Pattern` between the two circles defined by `(x0, y0, radius0)` and `(x1, y1, radius0)`. Before using the gradient pattern, a number of color stops should be defined using `patternAddColorStopRGB` or `patternAddColorStopRGBA`.

- Note: The coordinates here are in pattern space. For a new pattern, pattern space is identical to user space, but the relationship between the spaces can be changed with `patternSetMatrix`.

patternAddColorStopRGB #

Arguments

:: MonadIO m |
=> Pattern | a `Pattern`
-> Double | an offset in the range [0.0 .. 1.0]
-> Double | red component of color
-> Double | green component of color
-> Double | blue component of color
-> m () |

Adds an opaque color stop to a gradient pattern. The offset specifies the location along the gradient's control vector. For example, a linear gradient's control vector is from (x0,y0) to (x1,y1) while a radial gradient's control vector is from any point on the start circle to the corresponding point on the end circle.

The color is specified in the same way as in `setSourceRGB`.

Note: If the pattern is not a gradient pattern, (eg. a linear or radial pattern), then the pattern will be put into an error status with a status of `StatusPatternTypeMismatch`.

patternAddColorStopRGBA #

Arguments

:: MonadIO m |
=> Pattern | a `Pattern`
-> Double | an offset in the range [0.0 .. 1.0]
-> Double | red component of color
-> Double | green component of color
-> Double | blue component of color
-> Double | alpha component of color
-> m () |

Adds a translucent color stop to a gradient pattern. The offset specifies the location along the gradient's control vector. For example, a linear gradient's control vector is from (x0,y0) to (x1,y1) while a radial gradient's control vector is from any point on the start circle to the corresponding point on the end circle.

The color is specified in the same way as in setSourceRGBA.

Note: If the pattern is not a gradient pattern, (eg. a linear or radial pattern), then the pattern will be put into an error status with a status of `StatusPatternTypeMismatch`.

patternSetMatrix #

Arguments

:: MonadIO m |
=> Pattern | a `Pattern`
-> Matrix | a `Matrix`
-> m () |

Sets the pattern's transformation matrix to matrix. This matrix is a transformation from user space to pattern space.

When a pattern is first created it always has the identity matrix for its transformation matrix, which means that pattern space is initially identical to user space.

Important: Please note that the direction of this transformation matrix is from user space to pattern space. This means that if you imagine the flow from a pattern to user space (and on to device space), then coordinates in that flow will be transformed by the inverse of the pattern matrix.

Also, please note the discussion of the user-space locking semantics of `setSource`.

patternGetMatrix #

Arguments

:: MonadIO m |
=> Pattern | a `Pattern`
-> m Matrix |

Get the pattern's transformation matrix.

patternSetExtend #

Arguments

:: MonadIO m |
=> Pattern | a `Pattern`
-> Extend | an `Extend` enum
-> m () |

patternGetExtend #

Arguments

:: MonadIO m |
=> Pattern | a `Pattern`
-> m Extend |

patternSetFilter #

Arguments

:: MonadIO m |
=> Pattern | a `Pattern`
-> Filter | a `Filter` type
-> m () |

patternGetFilter #

Arguments

:: MonadIO m |
=> Pattern | a `Pattern`
-> m Filter |

## Transformations

translate #

Arguments

:: Double | `tx` - amount to translate in the X direction
-> Double | `ty` - amount to translate in the Y direction
-> Render () |

Modifies the current transformation matrix (CTM) by translating the user-space origin by `(tx, ty)`. This offset is interpreted as a user-space coordinate according to the CTM in place before the new call to `translate`. In other words, the translation of the user-space origin takes place after any existing transformation.

scale #

Arguments

:: Double | `sx` - scale factor for the X dimension
-> Double | `sy` - scale factor for the Y dimension
-> Render () |

Modifies the current transformation matrix (CTM) by scaling the X and Y user-space axes by sx and sy respectively. The scaling of the axes takes place after any existing transformation of user space.

rotate #

Arguments

:: Double | `angle` - angle (in radians) by which the user-space axes will be rotated
-> Render () |

Modifies the current transformation matrix (CTM) by rotating the user-space axes by `angle` radians. The rotation of the axes takes places after any existing transformation of user space. The rotation direction for positive angles is from the positive X axis toward the positive Y axis.

transform #

Arguments

:: Matrix | `matrix` - a transformation to be applied to the user-space axes
-> Render () |

Modifies the current transformation matrix (CTM) by applying matrix as an additional transformation. The new transformation of user space takes place after any existing transformation.

setMatrix #

Arguments

:: Matrix | `matrix` - a transformation matrix from user space to device space
-> Render () |

Modifies the current transformation matrix (CTM) by setting it equal to `matrix`.

getMatrix :: Render Matrix #

Gets the current transformation matrix, as set by `setMatrix`.

identityMatrix :: Render () #

Resets the current transformation matrix (CTM) by setting it equal to the identity matrix. That is, the user-space and device-space axes will be aligned and one user-space unit will transform to one device-space unit.

userToDevice #

Arguments

:: Double | X value of coordinate
-> Double | Y value of coordinate
-> Render (Double, Double) |

Transform a coordinate from user space to device space by multiplying the given point by the current transformation matrix (CTM).

userToDeviceDistance #

Arguments

:: Double | `dx` - X component of a distance vector
-> Double | `dy` - Y component of a distance vector
-> Render (Double, Double) |

Transform a distance vector from user space to device space. This function is similar to `userToDevice` except that the translation components of the CTM will be ignored when transforming `(dx,dy)`.

deviceToUser #

Arguments

:: Double | X value of coordinate
-> Double | Y value of coordinate
-> Render (Double, Double) |

Transform a coordinate from device space to user space by multiplying the given point by the inverse of the current transformation matrix (CTM).

deviceToUserDistance #

Arguments

:: Double | `dx` - X component of a distance vector
-> Double | `dy` - Y component of a distance vector
-> Render (Double, Double) |

Transform a distance vector from device space to user space. This function is similar to `deviceToUser` except that the translation components of the inverse CTM will be ignored when transforming `(dx,dy)`.

## Text

selectFontFace #

Arguments

:: CairoString string |
=> string | `family` - a font family name
-> FontSlant | `slant` - the slant for the font
-> FontWeight | `weight` - the weight of the font
-> Render () |

Selects a family and style of font from a simplified description as a `family` name, `slant` and `weight`. This function is meant to be used only for applications with simple font needs: Cairo doesn't provide for operations such as listing all available fonts on the system, and it is expected that most applications will need to use a more comprehensive font handling and text layout library in addition to cairo.

setFontSize #

Arguments

:: Double | `size` - the new font size, in user space units
-> Render () |

Sets the current font matrix to a scale by a factor of `size`, replacing any font matrix previously set with `setFontSize` or `setFontMatrix`. This results in a font size of size user space units. (More precisely, this matrix will result in the font's em-square being a size by size square in user space.)

setFontMatrix #

Arguments

:: Matrix | `matrix` - a `Matrix` describing a transform to be applied to the current font.
-> Render () |

Sets the current font matrix to `matrix`. The font matrix gives a transformation from the design space of the font (in this space, the em-square is 1 unit by 1 unit) to user space. Normally, a simple scale is used (see `setFontSize`), but a more complex font matrix can be used to shear the font or stretch it unequally along the two axes.

getFontMatrix :: Render Matrix #

Gets the current font matrix, as set by `setFontMatrix`

setFontOptions :: FontOptions -> Render () #

Sets a set of custom font rendering options. Rendering options are derived by merging these options with the options derived from underlying surface; if the value in `options` has a default value (like `AntialiasDefault`), then the value from the surface is used.

showText #

Arguments

:: CairoString string |
=> string | a string of text
-> Render () |

A drawing operator that generates the shape from a string of Unicode characters, rendered according to the current font face, font size (font matrix), and font options.

This function first computes a set of glyphs for the string of text. The first glyph is placed so that its origin is at the current point. The origin of each subsequent glyph is offset from that of the previous glyph by the advance values of the previous glyph.

After this call the current point is moved to the origin of where the next glyph would be placed in this same progression. That is, the current point will be at the origin of the final glyph offset by its advance values. This allows for easy display of a single logical string with multiple calls to `showText`.

NOTE: The `showText` function call is part of what the cairo designers call the "toy" text API. It is convenient for short demos and simple programs, but it is not expected to be adequate for the most serious of text-using applications.

fontExtents :: Render FontExtents #

Gets the font extents for the currently selected font.

textExtents #

Arguments

:: CairoString string |
=> string | a string of text
-> Render TextExtents |

Gets the extents for a string of text. The extents describe a user-space rectangle that encloses the "inked" portion of the text, (as it would be drawn by `showText`). Additionally, the `textExtentsXadvance` and `textExtentsYadvance` values indicate the amount by which the current point would be advanced by `showText`.

Note that whitespace characters do not directly contribute to the size of the rectangle (`textExtentsWidth` and `textExtentsHeight`). They do contribute indirectly by changing the position of non-whitespace characters. In particular, trailing whitespace characters are likely to not affect the size of the rectangle, though they will affect the `textExtentsXadvance` and `textExtentsYadvance` values.

# Fonts

## Font options

fontOptionsCreate :: MonadIO m => m FontOptions #

Allocates a new font options object with all options initialized to default values.

fontOptionsCopy #

Arguments

:: MonadIO m |
=> FontOptions |
    original
-> m FontOptions |

Allocates a new font options object copying the option values from `original`.

fontOptionsMerge #

Arguments

:: MonadIO m |
=> FontOptions |
    options
-> FontOptions |
    other
-> m () |

Merges non-default options from `other` into `options`, replacing existing values. This operation can be thought of as somewhat similar to compositing `other` onto `options` with the operation of `OperationOver`.

fontOptionsHash :: MonadIO m => FontOptions -> m Int #

Compute a hash for the font options object; this value will be useful when storing an object containing a `FontOptions` in a hash table.

fontOptionsEqual :: MonadIO m => FontOptions -> FontOptions -> m Bool #

Compares two font options objects for equality.

fontOptionsSetAntialias :: MonadIO m => FontOptions -> Antialias -> m () #

Sets the antiliasing mode for the font options object. This specifies the type of antialiasing to do when rendering text.

fontOptionsGetAntialias :: MonadIO m => FontOptions -> m Antialias #

Gets the antialiasing mode for the font options object.

fontOptionsSetSubpixelOrder :: MonadIO m => FontOptions -> SubpixelOrder -> m () #

Sets the subpixel order for the font options object. The subpixel order specifies the order of color elements within each pixel on the display device when rendering with an antialiasing mode of `AntialiasSubpixel`. See the documentation for `SubpixelOrder` for full details.

fontOptionsGetSubpixelOrder :: MonadIO m => FontOptions -> m SubpixelOrder #

Gets the subpixel order for the font options object. See the documentation for `SubpixelOrder` for full details.

fontOptionsSetHintStyle :: MonadIO m => FontOptions -> HintStyle -> m () #

Sets the hint style for font outlines for the font options object. This controls whether to fit font outlines to the pixel grid, and if so, whether to optimize for fidelity or contrast. See the documentation for `HintStyle` for full details.

fontOptionsGetHintStyle :: MonadIO m => FontOptions -> m HintStyle #

Gets the hint style for font outlines for the font options object. See the documentation for `HintStyle` for full details.

fontOptionsSetHintMetrics :: MonadIO m => FontOptions -> HintMetrics -> m () #

Sets the metrics hinting mode for the font options object. This controls whether metrics are quantized to integer values in device units. See the documentation for `HintMetrics` for full details.

fontOptionsGetHintMetrics :: MonadIO m => FontOptions -> m HintMetrics #

Gets the metrics hinting mode for the font options object. See the documentation for `HintMetrics` for full details.

# Surfaces

withSimilarSurface #

Arguments

:: Surface | an existing surface used to select the backend of the new surface
-> Content | the content type for the new surface (color, color+alpha or alpha only)
-> Int | width of the new surface, (in device-space units)
-> Int | height of the new surface (in device-space units)
-> (Surface -> IO a) |
-> IO a |

Create a temporary surface that is as compatible as possible with an existing surface. The new surface will use the same backend as other unless that is not possible for some reason.

createSimilarSurface #

Arguments

:: Surface | an existing surface used to select the backend of the new surface
-> Content | the content type for the new surface (color, color+alpha or alpha only)
-> Int | width of the surface, in pixels
-> Int | height of the surface, in pixels
-> IO Surface |

Like `withSimilarSurface` but creates a Surface that is managed by the Haskell memory manager rather than only being temporarily allocated. This is more flexible and allows you to create surfaces that persist, which can be very useful, for example to cache static elements in an animation.

However you should be careful because surfaces can be expensive resources and the Haskell memory manager cannot guarantee when it will release them. You can manually release the resources used by a surface with `surfaceFinish`.

renderWithSimilarSurface #

Arguments

:: Content | the content type for the new surface (color, colour+alpha or alpha only)
-> Int | width of the new surface, (in device-space units)
-> Int | height of the new surface, (in device-space units)
-> (Surface -> Render a) | this action draws on the main surface, possibly making use of the temporary surface (which gets destroyed afterwards).
-> Render a |

Create a temporary surface that is compatible with the current target surface (like a combination of `withTargetSurface` and `withSimilarSurface`).

This is useful for drawing to a temporary surface and then compositing it into the main surface. For example, the following code draws to a temporary surface and then uses that as a mask:

    renderWithSimilarSurface ContentAlpha 200 200 $ \tmpSurface -> do
      renderWith tmpSurface $ do
        ... -- draw onto the temporary surface

      -- use the temporary surface as a mask, filling it with the
      -- current source which in this example is transparent red.
      setSourceRGBA 1 0 0 0.5
      setOperator Operator{something} -- think of something clever to do
      maskSurface tmpSurface 0 0)

surfaceGetFontOptions :: Surface -> Render FontOptions #

Retrieves the default font rendering options for the surface. This allows display surfaces to report the correct subpixel order for rendering on them, print surfaces to disable hinting of metrics and so forth. The result can then be used with `scaledFontCreate`.

surfaceFinish :: MonadIO m => Surface -> m () #

This function finishes the surface and drops all references to external resources. For example, for the Xlib backend it means that cairo will no longer access the drawable, which can be freed. After calling `surfaceFinish` the only valid operations on a surface are getting and setting user data and referencing and destroying it. Further drawing to the surface will not affect the surface but will instead trigger a `StatusSurfaceFinished` error.

When the last call to `surfaceDestroy` decreases the reference count to zero, cairo will call `surfaceFinish` if it hasn't been called already, before freeing the resources associated with the surface.

surfaceFlush :: MonadIO m => Surface -> m () #

Do any pending drawing for the surface and also restore any temporary modification's cairo has made to the surface's state. This function must be called before switching from drawing on the surface with cairo to drawing on it directly with native APIs. If the surface doesn't support direct access, then this function does nothing.

surfaceMarkDirty :: MonadIO m => Surface -> m () #

Tells cairo that drawing has been done to surface using means other than cairo, and that cairo should reread any cached areas. Note that you must call `surfaceFlush` before doing such drawing.

surfaceMarkDirtyRectangle #

Arguments

:: MonadIO m |
=> Surface | a `Surface`
-> Int | X coordinate of dirty rectangle
-> Int | Y coordinate of dirty rectangle
-> Int | width of dirty rectangle
-> Int | height of dirty rectangle
-> m () |

Like `surfaceMarkDirty`, but drawing has been done only to the specified rectangle, so that cairo can retain cached contents for other parts of the surface.

surfaceSetDeviceOffset #

Arguments

:: MonadIO m |
=> Surface | a `Surface`
-> Double | the offset in the X direction, in device units
-> Double | the offset in the Y direction, in device units
-> m () |

Sets an offset that is added to the device coordinates determined by the CTM when drawing to surface. One use case for this function is when we want to create a `Surface` that redirects drawing for a portion of an onscreen surface to an offscreen surface in a way that is completely invisible to the user of the cairo API. Setting a transformation via `translate` isn't sufficient to do this, since functions like `deviceToUser` will expose the hidden offset.

Note that the offset only affects drawing to the surface, not using the surface in a surface pattern.

## Image surfaces

withImageSurface #

Arguments

:: Format | format of pixels in the surface to create
-> Int | width of the surface, in pixels
-> Int | height of the surface, in pixels
-> (Surface -> IO a) | an action that may use the surface. The surface is only valid within in this action.
-> IO a |

Creates an image surface of the specified format and dimensions. The initial contents of the surface is undefined; you must explicitly clear the buffer, using, for example, `rectangle` and `fill` if you want it cleared.

withImageSurfaceForData #

Arguments

:: PixelData | pointer to pixel data
-> Format | format of pixels in the surface to create
-> Int | width of the surface, in pixels
-> Int | height of the surface, in pixels
-> Int | size of stride between rows in the surface to create
-> (Surface -> IO a) | an action that may use the surface. The surface is only valid within this action
-> IO a |

Like `withImageSurface` but creating a surface to target external data pointed to by `PixelData`.

formatStrideForWidth #

Arguments

:: Format | format of pixels in the surface to create
-> Int | width of the surface, in pixels
-> Int | the stride (number of bytes necessary to store one line) or `-1` if the format is invalid or the width is too large

This function provides a stride value that will respect all alignment requirements of the accelerated image-rendering code within cairo.

createImageSurfaceForData #

Arguments

:: PixelData | pointer to pixel data
-> Format | format of pixels in the surface to create
-> Int | width of the surface, in pixels
-> Int | height of the surface, in pixels
-> Int | size of stride between rows in the surface to create
-> IO Surface |

Like `createImageSurface` but creating a surface to target external data pointed to by `PixelData`.

createImageSurface #

Arguments

:: Format | format of pixels in the surface to create
-> Int | width of the surface, in pixels
-> Int | height of the surface, in pixels
-> IO Surface |

Like `withImageSurface` but creates a Surface that is managed by the Haskell memory manager rather than only being temporarily allocated. This is more flexible and allows you to create surfaces that persist, which can be very useful, for example to cache static elements in an animation.

However you should be careful because surfaces can be expensive resources and the Haskell memory manager cannot guarantee when it will release them. You can manually release the resources used by a surface with `surfaceFinish`.

imageSurfaceGetWidth :: MonadIO m => Surface -> m Int #

Get the width of the image surface in pixels.

imageSurfaceGetHeight :: MonadIO m => Surface -> m Int #

Get the height of the image surface in pixels.

imageSurfaceGetFormat :: MonadIO m => Surface -> m Format #

Get the format of the surface.

imageSurfaceGetStride :: MonadIO m => Surface -> m Int #

Get the number of bytes from the start of one row to the start of the next. If the image data contains no padding, then this is equal to the pixel depth * the width.

imageSurfaceGetData :: Surface -> IO ByteString #

Return a ByteString of the image data for a surface. In order to remain safe the returned ByteString is a copy of the data. This is a little slower than returning a pointer into the image surface object itself, but much safer

data SurfaceData i e #

An array that stores the raw pixel data of an image `Surface`.

#### Instances

Instances details

Storable e => MArray SurfaceData e IO # | `SurfaceData` is a mutable array.
Instance details Defined in Graphics.Rendering.Cairo Methods getBounds :: Ix i => SurfaceData i e -> IO (i, i) # getNumElements :: Ix i => SurfaceData i e -> IO Int # newArray :: Ix i => (i, i) -> e -> IO (SurfaceData i e) # newArray_ :: Ix i => (i, i) -> IO (SurfaceData i e) # unsafeNewArray_ :: Ix i => (i, i) -> IO (SurfaceData i e) # unsafeRead :: Ix i => SurfaceData i e -> Int -> IO e # unsafeWrite :: Ix i => SurfaceData i e -> Int -> e -> IO () #

imageSurfaceGetPixels :: Storable e => Surface -> IO (SurfaceData Int e) #

Retrieve the internal array of raw image data.

- Image data in an image surface is stored in memory in uncompressed, packed format. Rows in the image are stored top to bottom, and in each row pixels are stored from left to right. There may be padding at the end of a row. The value returned by `imageSurfaceGetStride` indicates the number of bytes between rows.
- The returned array is a flat representation of a three dimensional array: x-coordinate, y-coordinate and several channels for each color. The format depends on the `Format` of the surface:

`FormatARGB32`: each pixel is 32 bits with alpha in the upper 8 bits, followed by 8 bits for red, green and blue. Pre-multiplied alpha is used. (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)

`FormatRGB24`: each pixel is 32 bits with the upper 8 bits being unused, followed by 8 bits for red, green and blue.

`FormatA8`: each pixel is 8 bits holding an alpha value

`FormatA1`: each pixel is one bit where pixels are packed into 32 bit quantities. The ordering depends on the endianness of the platform. On a big-endian machine, the first pixel is in the uppermost bit, on a little-endian machine the first pixel is in the least-significant bit.

- To read or write a specific pixel (and assuming `FormatARGB32` or `FormatRGB24`), use the formula: `p = y * (rowstride `div` 4) + x` for the pixel and force the array to have 32-bit words or integers.
- Calling this function without explicitly giving it a type will often lead to a compiler error since the type parameter `e` is underspecified. If this happens the function can be explicitly typed: `surData <- (imageSurfaceGetPixels pb :: IO (SurfaceData Int Word32))`
- If modifying an image through Haskell's array interface is not fast enough, it is possible to use `unsafeRead` and `unsafeWrite` which have the same type signatures as `readArray` and `writeArray`. Note that these are internal functions that might change with GHC.
- After each write access to the array, you need to inform Cairo about the area that has changed using `surfaceMarkDirty`.
- The function will return an error if the surface is not an image surface or if `surfaceFinish` has been called on the surface.

## PNG support

withImageSurfaceFromPNG :: FilePath -> (Surface -> IO a) -> IO a #

Creates a new image surface and initializes the contents to the given PNG file.

imageSurfaceCreateFromPNG :: FilePath -> IO Surface #

surfaceWriteToPNG #

Arguments

:: Surface | a `Surface`
-> FilePath | `filename` - the name of a file to write to
-> IO () |

Writes the contents of surface to a new file `filename` as a PNG image.

## PDF surfaces

withPDFSurface #

Arguments

:: FilePath | `filename` - a filename for the PS output (must be writable)
-> Double | width of the surface, in points (1 point == 1/72.0 inch)
-> Double | height of the surface, in points (1 point == 1/72.0 inch)
-> (Surface -> IO a) | an action that may use the surface. The surface is only valid within in this action.
-> IO a |

Creates a PostScript surface of the specified size in points to be written to `filename`.

Note that the size of individual pages of the PostScript output can vary. See `psSurfaceSetSize`.

pdfSurfaceSetSize :: MonadIO m => Surface -> Double -> Double -> m () #

Changes the size of a PDF surface for the current (and subsequent) pages.

This function should only be called before any drawing operations have been performed on the current page. The simplest way to do this is to call this function immediately after creating the surface or immediately after completing a page with either `showPage` or `copyPage`.

## PS surfaces

withPSSurface #

Arguments

:: FilePath | `filename` - a filename for the PS output (must be writable)
-> Double | width of the surface, in points (1 point == 1/72.0 inch)
-> Double | height of the surface, in points (1 point == 1/72.0 inch)
-> (Surface -> IO a) | an action that may use the surface. The surface is only valid within in this action.
-> IO a |

Creates a PostScript surface of the specified size in points to be written to `filename`.

Note that the size of individual pages of the PostScript output can vary. See `psSurfaceSetSize`.

psSurfaceSetSize :: MonadIO m => Surface -> Double -> Double -> m () #

Changes the size of a PostScript surface for the current (and subsequent) pages.

This function should only be called before any drawing operations have been performed on the current page. The simplest way to do this is to call this function immediately after creating the surface or immediately after completing a page with either `showPage` or `copyPage`.

## SVG surfaces

withSVGSurface #

Arguments

:: FilePath | `filename` - a filename for the SVG output (must be writable)
-> Double | Width of the surface. The default unit is points (1 point == 1/72.0 inch)
-> Double | Height of the surface. The default unit is points (1 point == 1/72.0 inch)
-> (Surface -> IO a) | an action that may use the surface. The surface is only valid within in this action.
-> IO a |

Creates a SVG surface of the specified size in points be written to `filename`.

svgSurfaceSetDocumentUnit :: MonadIO m => Surface -> SvgUnit -> m () #

Use the specified unit for the width and height of the generated SVG file.

svgSurfaceGetDocumentUnit :: MonadIO m => Surface -> m SvgUnit #

Get the specified unit for the width and height of the generated SVG file.

# Regions

regionCreate :: MonadIO m => m Region #

Allocates a new empty region object.

regionCreateRectangle #

Arguments

:: MonadIO m |
=> RectangleInt |
    rectangle
-> m Region |

Allocates a new region object containing `rectangle`.

regionCreateRectangles #

Arguments

:: MonadIO m |
=> [RectangleInt] |
    rects
-> m Region |

Allocates a new region object containing the union of all given `rects`.

regionCopy #

Arguments

:: MonadIO m |
=> Region |
    original
-> m Region |

Allocates a new region object copying the area from `original`.

regionGetExtents #

Arguments

:: MonadIO m |
=> Region |
    region
-> m RectangleInt |

Gets the bounding rectangle of `region` as a RectanglInt.

regionNumRectangles #

Arguments

:: MonadIO m |
=> Region |
    region
-> m Int |

Returns the number of rectangles contained in `region`.

regionGetRectangle #

Arguments

:: MonadIO m |
=> Region |
    region
-> Int |
    nth
-> m RectangleInt |

Gets the `nth` rectangle from the `region`.

regionIsEmpty #

Arguments

:: MonadIO m |
=> Region |
    region
-> m Bool |

Checks whether `region` is empty.

regionContainsPoint #

Arguments

:: MonadIO m |
=> Region |
    region
-> Int |
    x
-> Int |
    y
-> m Bool |

Checks whether (`x`, `y`) is contained in `region`.

regionContainsRectangle #

Arguments

:: MonadIO m |
=> Region |
    region
-> RectangleInt |
    rectangle
-> m RegionOverlap |

Checks whether `rectangle` is inside, outside or partially contained in `region`.

regionEqual #

Arguments

:: MonadIO m |
=> Region |
    region_a
-> Region |
    region_b
-> m Bool |

Compares whether `region_a` is equivalent to `region_b`.

regionTranslate #

Arguments

:: MonadIO m |
=> Region |
    region
-> Int |
    dx
-> Int |
    dy
-> m () |

Translates `region` by (`dx`, `dy`).

regionIntersect #

Arguments

:: MonadIO m |
=> Region |
    dst
-> Region |
    other
-> m () |

Computes the intersection of `dst` with `other` and places the result in `dst`.

regionIntersectRectangle #

Arguments

:: MonadIO m |
=> Region |
    dst
-> RectangleInt |
    rectangle
-> m () |

Computes the intersection of `dst` with `rectangle` and places the result in `dst`.

regionSubtract #

Arguments

:: MonadIO m |
=> Region |
    dst
-> Region |
    other
-> m () |

Subtracts `other` from `dst` and places the result in `dst`.

regionSubtractRectangle #

Arguments

:: MonadIO m |
=> Region |
    dst
-> RectangleInt |
    rectangle
-> m () |

Subtracts `rectangle` from `dst` and places the result in `dst`.

regionUnion #

Arguments

:: MonadIO m |
=> Region |
    dst
-> Region |
    other
-> m () |

Computes the union of `dst` with `other` and places the result in `dst`.

regionUnionRectangle #

Arguments

:: MonadIO m |
=> Region |
    dst
-> RectangleInt |
    rectangle
-> m () |

Computes the union of `dst` with `rectangle` and places the result in `dst`.

regionXor #

Arguments

:: MonadIO m |
=> Region |
    dst
-> Region |
    other
-> m () |

Computes the exclusive difference of `dst` with `other` and places the result in `dst`. That is, `dst` will be set to contain all areas that are either in `dst` or in `other`, but not in both.

regionXorRectangle #

Arguments

:: MonadIO m |
=> Region |
    dst
-> RectangleInt |
    rectangle
-> m () |

Computes the exclusive difference of `dst` with `rectangle` and places the result in `dst`. That is, `dst` will be set to contain all areas that are either in `dst` or in `rectangle`, but not in both

# Utilities

liftIO :: MonadIO m => IO a -> m a #

Lift a computation from the `IO` monad. This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations (i.e. `IO` is the base monad for the stack).

### Example

Expand

    import Control.Monad.Trans.State -- from the "transformers" library

    printState :: Show s => StateT s IO ()
    printState = do
      state <- get
      liftIO $ print state

Had we omitted ``liftIO``, we would have ended up with this error:

    • Couldn't match type ‘IO’ with ‘StateT s IO’
     Expected type: StateT s IO ()
       Actual type: IO ()

The important part here is the mismatch between `StateT s IO ()` and ``IO` ()`.

Luckily, we know of a function that takes an ``IO` a` and returns an `(m a)`: ``liftIO``, enabling us to run the program and see the expected results:

    > evalStateT printState "hello"
    "hello"

    > evalStateT printState 3
    3

version :: Int #

Returns the version of the cairo library encoded in a single integer.

versionString :: String #

Returns the version of the cairo library as a human-readable string of the form "X.Y.Z".

class CairoString s #

Minimal complete definition

withUTFString

#### Instances

Instances details

CairoString Text # |
Instance details Defined in Graphics.Rendering.Cairo.Internal.Utilities Methods withUTFString :: Text -> (CString -> IO a) -> IO a
CairoString [Char] # |
Instance details Defined in Graphics.Rendering.Cairo.Internal.Utilities Methods withUTFString :: [Char] -> (CString -> IO a) -> IO a

# Types

data Render m #

The Render monad. All drawing operations take place in a Render context. You can obtain a Render context for a `Surface` using `renderWith`.

#### Instances

Instances details

MonadIO Render # |
Instance details Defined in Graphics.Rendering.Cairo.Internal Methods liftIO :: IO a -> Render a #
Applicative Render # |
Instance details Defined in Graphics.Rendering.Cairo.Internal Methods pure :: a -> Render a # (<*>) :: Render (a -> b) -> Render a -> Render b # liftA2 :: (a -> b -> c) -> Render a -> Render b -> Render c # (*>) :: Render a -> Render b -> Render b # (<*) :: Render a -> Render b -> Render a #
Functor Render # |
Instance details Defined in Graphics.Rendering.Cairo.Internal Methods fmap :: (a -> b) -> Render a -> Render b # (<$) :: a -> Render b -> Render a #
Monad Render # |
Instance details Defined in Graphics.Rendering.Cairo.Internal Methods (>>=) :: Render a -> (a -> Render b) -> Render b # (>>) :: Render a -> Render b -> Render b # return :: a -> Render a #

data Matrix #

Representation of a 2-D affine transformation.

The Matrix type represents a 2x2 transformation matrix along with a translation vector. `Matrix a1 a2 b1 b2 c1 c2` describes the transformation of a point with coordinates x,y that is defined by

      / x' \  =  / a1 b1 \  / x \  + / c1 \
      \ y' /     \ a2 b2 /  \ y /    \ c2 /

or

      x' =  a1 * x + b1 * y + c1
      y' =  a2 * x + b2 * y + c2

#### Instances

Instances details

Storable Matrix # |
Instance details Defined in Graphics.Rendering.Cairo.Matrix Methods sizeOf :: Matrix -> Int # alignment :: Matrix -> Int # peekElemOff :: Ptr Matrix -> Int -> IO Matrix # pokeElemOff :: Ptr Matrix -> Int -> Matrix -> IO () # peekByteOff :: Ptr b -> Int -> IO Matrix # pokeByteOff :: Ptr b -> Int -> Matrix -> IO () # peek :: Ptr Matrix -> IO Matrix # poke :: Ptr Matrix -> Matrix -> IO () #
Num Matrix # |
Instance details Defined in Graphics.Rendering.Cairo.Matrix Methods (+) :: Matrix -> Matrix -> Matrix # (-) :: Matrix -> Matrix -> Matrix # (*) :: Matrix -> Matrix -> Matrix # negate :: Matrix -> Matrix # abs :: Matrix -> Matrix # signum :: Matrix -> Matrix # fromInteger :: Integer -> Matrix #
Show Matrix # |
Instance details Defined in Graphics.Rendering.Cairo.Matrix Methods showsPrec :: Int -> Matrix -> ShowS # show :: Matrix -> String # showList :: [Matrix] -> ShowS #
Eq Matrix # |
Instance details Defined in Graphics.Rendering.Cairo.Matrix Methods (==) :: Matrix -> Matrix -> Bool # (/=) :: Matrix -> Matrix -> Bool #

data Surface #

The medium to draw on.

data Pattern #

Patterns can be simple solid colors, various kinds of gradients or bitmaps. The current pattern for a `Render` context is used by the `stroke`, `fill` and paint operations. These operations composite the current pattern with the target surface using the currently selected `Operator`.

data Status #

Cairo status.

- `Status` is used to indicate errors that can occur when using Cairo. In some cases it is returned directly by functions. When using `Render`, the last error, if any, is stored in the monad and can be retrieved with `status`.

Constructors

StatusSuccess |
StatusNoMemory |
StatusInvalidRestore |
StatusInvalidPopGroup |
StatusNoCurrentPoint |
StatusInvalidMatrix |
StatusInvalidStatus |
StatusNullPointer |
StatusInvalidString |
StatusInvalidPathData |
StatusReadError |
StatusWriteError |
StatusSurfaceFinished |
StatusSurfaceTypeMismatch |
StatusPatternTypeMismatch |
StatusInvalidContent |
StatusInvalidFormat |
StatusInvalidVisual |
StatusFileNotFound |
StatusInvalidDash |
StatusInvalidDscComment |
StatusInvalidIndex |
StatusClipNotRepresentable |
StatusTempFileError |
StatusInvalidStride |
StatusFontTypeMismatch |
StatusUserFontImmutable |
StatusUserFontError |
StatusNegativeCount |
StatusInvalidClusters |
StatusInvalidSlant |
StatusInvalidWeight |
StatusInvalidSize |
StatusUserFontNotImplemented |
StatusDeviceTypeMismatch |
StatusDeviceError |
StatusInvalidMeshConstruction |
StatusDeviceFinished |
StatusJbig2GlobalMissing |
StatusPngError |
StatusFreetypeError |
StatusWin32GdiError |
StatusTagError |
StatusDwriteError |
StatusSvgFontError |
StatusLastStatus |

#### Instances

Instances details

Enum Status # | Specify line endings. `LineCapButt` Start(stop) the line exactly at the start(end) point. `LineCapRound` Use a round ending, the center of the circle is the end point. `LineCapSquare` Use squared ending, the center of the square is the end point
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: Status -> Status # pred :: Status -> Status # toEnum :: Int -> Status # fromEnum :: Status -> Int # enumFrom :: Status -> [Status] # enumFromThen :: Status -> Status -> [Status] # enumFromTo :: Status -> Status -> [Status] # enumFromThenTo :: Status -> Status -> Status -> [Status] #
Show Status # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> Status -> ShowS # show :: Status -> String # showList :: [Status] -> ShowS #
Eq Status # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: Status -> Status -> Bool # (/=) :: Status -> Status -> Bool #

data Operator #

Composition operator for all drawing operations.

Constructors

OperatorClear |
OperatorSource |
OperatorOver |
OperatorIn |
OperatorOut |
OperatorAtop |
OperatorDest |
OperatorDestOver |
OperatorDestIn |
OperatorDestOut |
OperatorDestAtop |
OperatorXor |
OperatorAdd |
OperatorSaturate |
OperatorMultiply |
OperatorScreen |
OperatorOverlay |
OperatorDarken |
OperatorLighten |
OperatorColorDodge |
OperatorColorBurn |
OperatorHardLight |
OperatorSoftLight |
OperatorDifference |
OperatorExclusion |
OperatorHslHue |
OperatorHslSaturation |
OperatorHslColor |
OperatorHslLuminosity |

#### Instances

Instances details

Enum Operator # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: Operator -> Operator # pred :: Operator -> Operator # toEnum :: Int -> Operator # fromEnum :: Operator -> Int # enumFrom :: Operator -> [Operator] # enumFromThen :: Operator -> Operator -> [Operator] # enumFromTo :: Operator -> Operator -> [Operator] # enumFromThenTo :: Operator -> Operator -> Operator -> [Operator] #
Show Operator # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> Operator -> ShowS # show :: Operator -> String # showList :: [Operator] -> ShowS #
Eq Operator # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: Operator -> Operator -> Bool # (/=) :: Operator -> Operator -> Bool #

data Antialias #

Specifies the type of antialiasing to do when rendering text or shapes

`AntialiasDefault`
  Use the default antialiasing for the subsystem and target device.
`AntialiasNone`
  Use a bilevel alpha mask.
`AntialiasGray`
  Perform single-color antialiasing (using shades of gray for black text on a white background, for example).
`AntialiasSubpixel`
  Perform antialiasing by taking advantage of the order of subpixel elements on devices such as LCD panels.

Constructors

AntialiasDefault |
AntialiasNone |
AntialiasGray |
AntialiasSubpixel |
AntialiasFast |
AntialiasGood |
AntialiasBest |

#### Instances

Instances details

Enum Antialias # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: Antialias -> Antialias # pred :: Antialias -> Antialias # toEnum :: Int -> Antialias # fromEnum :: Antialias -> Int # enumFrom :: Antialias -> [Antialias] # enumFromThen :: Antialias -> Antialias -> [Antialias] # enumFromTo :: Antialias -> Antialias -> [Antialias] # enumFromThenTo :: Antialias -> Antialias -> Antialias -> [Antialias] #
Show Antialias # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> Antialias -> ShowS # show :: Antialias -> String # showList :: [Antialias] -> ShowS #
Eq Antialias # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: Antialias -> Antialias -> Bool # (/=) :: Antialias -> Antialias -> Bool #

data FillRule #

Specify how paths are filled.

- For both fill rules, whether or not a point is included in the fill is determined by taking a ray from that point to infinity and looking at intersections with the path. The ray can be in any direction, as long as it doesn't pass through the end point of a segment or have a tricky intersection such as intersecting tangent to the path. (Note that filling is not actually implemented in this way. This is just a description of the rule that is applied.)

`FillRuleWinding`
  If the path crosses the ray from left-to-right, counts +1. If the path crosses the ray from right to left, counts -1. (Left and right are determined from the perspective of looking along the ray from the starting point.) If the total count is non-zero, the point will be filled.
`FillRuleEvenOdd`
  Counts the total number of intersections, without regard to the orientation of the contour. If the total number of intersections is odd, the point will be filled.

Constructors

FillRuleWinding |
FillRuleEvenOdd |

#### Instances

Instances details

Enum FillRule # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: FillRule -> FillRule # pred :: FillRule -> FillRule # toEnum :: Int -> FillRule # fromEnum :: FillRule -> Int # enumFrom :: FillRule -> [FillRule] # enumFromThen :: FillRule -> FillRule -> [FillRule] # enumFromTo :: FillRule -> FillRule -> [FillRule] # enumFromThenTo :: FillRule -> FillRule -> FillRule -> [FillRule] #
Show FillRule # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> FillRule -> ShowS # show :: FillRule -> String # showList :: [FillRule] -> ShowS #
Eq FillRule # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: FillRule -> FillRule -> Bool # (/=) :: FillRule -> FillRule -> Bool #

data LineCap #

Constructors

LineCapButt |
LineCapRound |
LineCapSquare |

#### Instances

Instances details

Enum LineCap # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: LineCap -> LineCap # pred :: LineCap -> LineCap # toEnum :: Int -> LineCap # fromEnum :: LineCap -> Int # enumFrom :: LineCap -> [LineCap] # enumFromThen :: LineCap -> LineCap -> [LineCap] # enumFromTo :: LineCap -> LineCap -> [LineCap] # enumFromThenTo :: LineCap -> LineCap -> LineCap -> [LineCap] #
Show LineCap # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> LineCap -> ShowS # show :: LineCap -> String # showList :: [LineCap] -> ShowS #
Eq LineCap # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: LineCap -> LineCap -> Bool # (/=) :: LineCap -> LineCap -> Bool #

data LineJoin #

Specify how lines join.

Constructors

LineJoinMiter |
LineJoinRound |
LineJoinBevel |

#### Instances

Instances details

Enum LineJoin # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: LineJoin -> LineJoin # pred :: LineJoin -> LineJoin # toEnum :: Int -> LineJoin # fromEnum :: LineJoin -> Int # enumFrom :: LineJoin -> [LineJoin] # enumFromThen :: LineJoin -> LineJoin -> [LineJoin] # enumFromTo :: LineJoin -> LineJoin -> [LineJoin] # enumFromThenTo :: LineJoin -> LineJoin -> LineJoin -> [LineJoin] #
Show LineJoin # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> LineJoin -> ShowS # show :: LineJoin -> String # showList :: [LineJoin] -> ShowS #
Eq LineJoin # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: LineJoin -> LineJoin -> Bool # (/=) :: LineJoin -> LineJoin -> Bool #

data ScaledFont #

data FontFace #

data Glyph #

data TextExtents #

Specify the extents of a text.

Constructors

TextExtents |
Fields textExtentsXbearing :: Double textExtentsYbearing :: Double textExtentsWidth :: Double textExtentsHeight :: Double textExtentsXadvance :: Double textExtentsYadvance :: Double

#### Instances

Instances details

Storable TextExtents # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods sizeOf :: TextExtents -> Int # alignment :: TextExtents -> Int # peekElemOff :: Ptr TextExtents -> Int -> IO TextExtents # pokeElemOff :: Ptr TextExtents -> Int -> TextExtents -> IO () # peekByteOff :: Ptr b -> Int -> IO TextExtents # pokeByteOff :: Ptr b -> Int -> TextExtents -> IO () # peek :: Ptr TextExtents -> IO TextExtents # poke :: Ptr TextExtents -> TextExtents -> IO () #

data FontExtents #

Result of querying the font extents.

Constructors

FontExtents |
Fields fontExtentsAscent :: Double fontExtentsDescent :: Double fontExtentsHeight :: Double fontExtentsMaxXadvance :: Double fontExtentsMaxYadvance :: Double

#### Instances

Instances details

Storable FontExtents # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods sizeOf :: FontExtents -> Int # alignment :: FontExtents -> Int # peekElemOff :: Ptr FontExtents -> Int -> IO FontExtents # pokeElemOff :: Ptr FontExtents -> Int -> FontExtents -> IO () # peekByteOff :: Ptr b -> Int -> IO FontExtents # pokeByteOff :: Ptr b -> Int -> FontExtents -> IO () # peek :: Ptr FontExtents -> IO FontExtents # poke :: Ptr FontExtents -> FontExtents -> IO () #

data FontSlant #

Specify font slant.

Constructors

FontSlantNormal |
FontSlantItalic |
FontSlantOblique |

#### Instances

Instances details

Enum FontSlant # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: FontSlant -> FontSlant # pred :: FontSlant -> FontSlant # toEnum :: Int -> FontSlant # fromEnum :: FontSlant -> Int # enumFrom :: FontSlant -> [FontSlant] # enumFromThen :: FontSlant -> FontSlant -> [FontSlant] # enumFromTo :: FontSlant -> FontSlant -> [FontSlant] # enumFromThenTo :: FontSlant -> FontSlant -> FontSlant -> [FontSlant] #
Show FontSlant # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> FontSlant -> ShowS # show :: FontSlant -> String # showList :: [FontSlant] -> ShowS #
Eq FontSlant # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: FontSlant -> FontSlant -> Bool # (/=) :: FontSlant -> FontSlant -> Bool #

data FontWeight #

Specify font weight.

Constructors

FontWeightNormal |
FontWeightBold |

#### Instances

Instances details

Enum FontWeight # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: FontWeight -> FontWeight # pred :: FontWeight -> FontWeight # toEnum :: Int -> FontWeight # fromEnum :: FontWeight -> Int # enumFrom :: FontWeight -> [FontWeight] # enumFromThen :: FontWeight -> FontWeight -> [FontWeight] # enumFromTo :: FontWeight -> FontWeight -> [FontWeight] # enumFromThenTo :: FontWeight -> FontWeight -> FontWeight -> [FontWeight] #
Show FontWeight # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> FontWeight -> ShowS # show :: FontWeight -> String # showList :: [FontWeight] -> ShowS #
Eq FontWeight # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: FontWeight -> FontWeight -> Bool # (/=) :: FontWeight -> FontWeight -> Bool #

data SubpixelOrder #

The subpixel order specifies the order of color elements within each pixel on the display device when rendering with an antialiasing mode of `AntialiasSubpixel`.

`SubpixelOrderDefault`
  Use the default subpixel order for for the target device
`SubpixelOrderRgb`
  Subpixel elements are arranged horizontally with red at the left
`SubpixelOrderBgr`
  Subpixel elements are arranged horizontally with blue at the left
`SubpixelOrderVrgb`
  Subpixel elements are arranged vertically with red at the top
`SubpixelOrderVbgr`
  Subpixel elements are arranged vertically with blue at the top

Constructors

SubpixelOrderDefault |
SubpixelOrderRgb |
SubpixelOrderBgr |
SubpixelOrderVrgb |
SubpixelOrderVbgr |

#### Instances

Instances details

Enum SubpixelOrder # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: SubpixelOrder -> SubpixelOrder # pred :: SubpixelOrder -> SubpixelOrder # toEnum :: Int -> SubpixelOrder # fromEnum :: SubpixelOrder -> Int # enumFrom :: SubpixelOrder -> [SubpixelOrder] # enumFromThen :: SubpixelOrder -> SubpixelOrder -> [SubpixelOrder] # enumFromTo :: SubpixelOrder -> SubpixelOrder -> [SubpixelOrder] # enumFromThenTo :: SubpixelOrder -> SubpixelOrder -> SubpixelOrder -> [SubpixelOrder] #
Show SubpixelOrder # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> SubpixelOrder -> ShowS # show :: SubpixelOrder -> String # showList :: [SubpixelOrder] -> ShowS #
Eq SubpixelOrder # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: SubpixelOrder -> SubpixelOrder -> Bool # (/=) :: SubpixelOrder -> SubpixelOrder -> Bool #

data HintStyle #

Specifies the type of hinting to do on font outlines.

Hinting is the process of fitting outlines to the pixel grid in order to improve the appearance of the result. Since hinting outlines involves distorting them, it also reduces the faithfulness to the original outline shapes. Not all of the outline hinting styles are supported by all font backends.

`HintStyleDefault`
  Use the default hint style for for font backend and target device
`HintStyleNone`
  Do not hint outlines
`HintStyleSlight`
  Hint outlines slightly to improve contrast while retaining good fidelity to the original shapes.
`HintStyleMedium`
  Hint outlines with medium strength giving a compromise between fidelity to the original shapes and contrast
`HintStyleFull`
  Hint outlines to maximize contrast

Constructors

HintStyleDefault |
HintStyleNone |
HintStyleSlight |
HintStyleMedium |
HintStyleFull |

#### Instances

Instances details

Enum HintStyle # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: HintStyle -> HintStyle # pred :: HintStyle -> HintStyle # toEnum :: Int -> HintStyle # fromEnum :: HintStyle -> Int # enumFrom :: HintStyle -> [HintStyle] # enumFromThen :: HintStyle -> HintStyle -> [HintStyle] # enumFromTo :: HintStyle -> HintStyle -> [HintStyle] # enumFromThenTo :: HintStyle -> HintStyle -> HintStyle -> [HintStyle] #

data HintMetrics #

Specifies whether to hint font metrics.

Hinting font metrics means quantizing them so that they are integer values in device space. Doing this improves the consistency of letter and line spacing, however it also means that text will be laid out differently at different zoom factors.

`HintMetricsDefault`
  Hint metrics in the default manner for the font backend and target device
`HintMetricsOff`
  Do not hint font metrics
`HintMetricsOn`
  Hint font metrics

Constructors

HintMetricsDefault |
HintMetricsOff |
HintMetricsOn |

#### Instances

Instances details

Enum HintMetrics # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: HintMetrics -> HintMetrics # pred :: HintMetrics -> HintMetrics # toEnum :: Int -> HintMetrics # fromEnum :: HintMetrics -> Int # enumFrom :: HintMetrics -> [HintMetrics] # enumFromThen :: HintMetrics -> HintMetrics -> [HintMetrics] # enumFromTo :: HintMetrics -> HintMetrics -> [HintMetrics] # enumFromThenTo :: HintMetrics -> HintMetrics -> HintMetrics -> [HintMetrics] #
Show HintMetrics # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> HintMetrics -> ShowS # show :: HintMetrics -> String # showList :: [HintMetrics] -> ShowS #
Eq HintMetrics # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: HintMetrics -> HintMetrics -> Bool # (/=) :: HintMetrics -> HintMetrics -> Bool #

data FontOptions #

Specifies how to render text.

type Path = [PathElement] #

A Cairo path.

- A path is a sequence of drawing operations that are accumulated until `stroke` is called. Using a path is particularly useful when drawing lines with special join styles and `closePath`.

data PathElement #

Constructors

MoveTo Double Double |
LineTo Double Double |
CurveTo Double Double Double Double Double Double |
ClosePath |

#### Instances

Instances details

Read PathElement # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods readsPrec :: Int -> ReadS PathElement # readList :: ReadS [PathElement] # readPrec :: ReadPrec PathElement # readListPrec :: ReadPrec [PathElement] #
Show PathElement # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> PathElement -> ShowS # show :: PathElement -> String # showList :: [PathElement] -> ShowS #
Eq PathElement # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: PathElement -> PathElement -> Bool # (/=) :: PathElement -> PathElement -> Bool #

data SurfaceType #

Constructors

SurfaceTypeImage |
SurfaceTypePdf |
SurfaceTypePs |
SurfaceTypeXlib |
SurfaceTypeXcb |
SurfaceTypeGlitz |
SurfaceTypeQuartz |
SurfaceTypeWin32 |
SurfaceTypeBeos |
SurfaceTypeDirectfb |
SurfaceTypeSvg |
SurfaceTypeOs2 |
SurfaceTypeWin32Printing |
SurfaceTypeQuartzImage |
SurfaceTypeScript |
SurfaceTypeQt |
SurfaceTypeRecording |
SurfaceTypeVg |
SurfaceTypeGl |
SurfaceTypeDrm |
SurfaceTypeTee |
SurfaceTypeXml |
SurfaceTypeSkia |
SurfaceTypeSubsurface |
SurfaceTypeCogl |

#### Instances

Instances details

Enum SurfaceType # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: SurfaceType -> SurfaceType # pred :: SurfaceType -> SurfaceType # toEnum :: Int -> SurfaceType # fromEnum :: SurfaceType -> Int # enumFrom :: SurfaceType -> [SurfaceType] # enumFromThen :: SurfaceType -> SurfaceType -> [SurfaceType] # enumFromTo :: SurfaceType -> SurfaceType -> [SurfaceType] # enumFromThenTo :: SurfaceType -> SurfaceType -> SurfaceType -> [SurfaceType] #
Read SurfaceType # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods readsPrec :: Int -> ReadS SurfaceType # readList :: ReadS [SurfaceType] # readPrec :: ReadPrec SurfaceType # readListPrec :: ReadPrec [SurfaceType] #
Show SurfaceType # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> SurfaceType -> ShowS # show :: SurfaceType -> String # showList :: [SurfaceType] -> ShowS #
Eq SurfaceType # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: SurfaceType -> SurfaceType -> Bool # (/=) :: SurfaceType -> SurfaceType -> Bool #

data PatternType #

Constructors

PatternTypeSolid |
PatternTypeSurface |
PatternTypeLinear |
PatternTypeRadial |
PatternTypeMesh |
PatternTypeRasterSource |

#### Instances

Instances details

Enum PatternType # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: PatternType -> PatternType # pred :: PatternType -> PatternType # toEnum :: Int -> PatternType # fromEnum :: PatternType -> Int # enumFrom :: PatternType -> [PatternType] # enumFromThen :: PatternType -> PatternType -> [PatternType] # enumFromTo :: PatternType -> PatternType -> [PatternType] # enumFromThenTo :: PatternType -> PatternType -> PatternType -> [PatternType] #
Read PatternType # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods readsPrec :: Int -> ReadS PatternType # readList :: ReadS [PatternType] # readPrec :: ReadPrec PatternType # readListPrec :: ReadPrec [PatternType] #
Show PatternType # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> PatternType -> ShowS # show :: PatternType -> String # showList :: [PatternType] -> ShowS #
Eq PatternType # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: PatternType -> PatternType -> Bool # (/=) :: PatternType -> PatternType -> Bool #

data RectangleInt #

A data structure for holding a rectangle with integer coordinates.

Constructors

RectangleInt |
Fields x :: Int y :: Int width :: Int height :: Int

#### Instances

Instances details

Storable RectangleInt # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods sizeOf :: RectangleInt -> Int # alignment :: RectangleInt -> Int # peekElemOff :: Ptr RectangleInt -> Int -> IO RectangleInt # pokeElemOff :: Ptr RectangleInt -> Int -> RectangleInt -> IO () # peekByteOff :: Ptr b -> Int -> IO RectangleInt # pokeByteOff :: Ptr b -> Int -> RectangleInt -> IO () # peek :: Ptr RectangleInt -> IO RectangleInt # poke :: Ptr RectangleInt -> RectangleInt -> IO () #

data RegionOverlap #

Used as the return value for regionContainsRectangle.

Constructors

RegionOverlapIn |
RegionOverlapOut |
RegionOverlapPart |

#### Instances

Instances details

Enum RegionOverlap # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: RegionOverlap -> RegionOverlap # pred :: RegionOverlap -> RegionOverlap # toEnum :: Int -> RegionOverlap # fromEnum :: RegionOverlap -> Int # enumFrom :: RegionOverlap -> [RegionOverlap] # enumFromThen :: RegionOverlap -> RegionOverlap -> [RegionOverlap] # enumFromTo :: RegionOverlap -> RegionOverlap -> [RegionOverlap] # enumFromThenTo :: RegionOverlap -> RegionOverlap -> RegionOverlap -> [RegionOverlap] #
Show RegionOverlap # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> RegionOverlap -> ShowS # show :: RegionOverlap -> String # showList :: [RegionOverlap] -> ShowS #
Eq RegionOverlap # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: RegionOverlap -> RegionOverlap -> Bool # (/=) :: RegionOverlap -> RegionOverlap -> Bool #

data Region #

A Cairo region. Represents a set of integer-aligned rectangles.

It allows set-theoretical operations like regionUnion and regionIntersect to be performed on them.

data Content #

Constructors

ContentColor |
ContentAlpha |
ContentColorAlpha |

#### Instances

Instances details

Enum Content # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: Content -> Content # pred :: Content -> Content # toEnum :: Int -> Content # fromEnum :: Content -> Int # enumFrom :: Content -> [Content] # enumFromThen :: Content -> Content -> [Content] # enumFromTo :: Content -> Content -> [Content] # enumFromThenTo :: Content -> Content -> Content -> [Content] #
Show Content # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> Content -> ShowS # show :: Content -> String # showList :: [Content] -> ShowS #
Eq Content # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: Content -> Content -> Bool # (/=) :: Content -> Content -> Bool #

data Format #

Constructors

FORMAT_INVALID |
FormatARGB32 |
FormatRGB24 |
FormatA8 |
FormatA1 |
FormatRGB16565 |
FormatRGB30 |
FORMAT_RGB96F |
FORMAT_RGBA128F |

#### Instances

Instances details

Enum Format # | FIXME: We should find out about this.
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: Format -> Format # pred :: Format -> Format # toEnum :: Int -> Format # fromEnum :: Format -> Int # enumFrom :: Format -> [Format] # enumFromThen :: Format -> Format -> [Format] # enumFromTo :: Format -> Format -> [Format] # enumFromThenTo :: Format -> Format -> Format -> [Format] #
Show Format # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> Format -> ShowS # show :: Format -> String # showList :: [Format] -> ShowS #
Eq Format # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: Format -> Format -> Bool # (/=) :: Format -> Format -> Bool #

data Extend #

Constructors

ExtendNone |
ExtendRepeat |
ExtendReflect |
ExtendPad |

#### Instances

Instances details

Enum Extend # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: Extend -> Extend # pred :: Extend -> Extend # toEnum :: Int -> Extend # fromEnum :: Extend -> Int # enumFrom :: Extend -> [Extend] # enumFromThen :: Extend -> Extend -> [Extend] # enumFromTo :: Extend -> Extend -> [Extend] # enumFromThenTo :: Extend -> Extend -> Extend -> [Extend] #
Show Extend # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> Extend -> ShowS # show :: Extend -> String # showList :: [Extend] -> ShowS #
Eq Extend # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: Extend -> Extend -> Bool # (/=) :: Extend -> Extend -> Bool #

data Filter #

Specify how filtering is done.

Constructors

FilterFast |
FilterGood |
FilterBest |
FilterNearest |
FilterBilinear |
FilterGaussian |

#### Instances

Instances details

Enum Filter # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: Filter -> Filter # pred :: Filter -> Filter # toEnum :: Int -> Filter # fromEnum :: Filter -> Int # enumFrom :: Filter -> [Filter] # enumFromThen :: Filter -> Filter -> [Filter] # enumFromTo :: Filter -> Filter -> [Filter] # enumFromThenTo :: Filter -> Filter -> Filter -> [Filter] #
Show Filter # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> Filter -> ShowS # show :: Filter -> String # showList :: [Filter] -> ShowS #
Eq Filter # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: Filter -> Filter -> Bool # (/=) :: Filter -> Filter -> Bool #

data SvgUnit #

Specify the unit used in SVG surfaces.

Constructors

SvgUnitUser |
SvgUnitEm |
SvgUnitEx |
SvgUnitPx |
SvgUnitIn |
SvgUnitCm |
SvgUnitMm |
SvgUnitPt |
SvgUnitPc |
SvgUnitPercent |

#### Instances

Instances details

Enum SvgUnit # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods succ :: SvgUnit -> SvgUnit # pred :: SvgUnit -> SvgUnit # toEnum :: Int -> SvgUnit # fromEnum :: SvgUnit -> Int # enumFrom :: SvgUnit -> [SvgUnit] # enumFromThen :: SvgUnit -> SvgUnit -> [SvgUnit] # enumFromTo :: SvgUnit -> SvgUnit -> [SvgUnit] # enumFromThenTo :: SvgUnit -> SvgUnit -> SvgUnit -> [SvgUnit] #
Show SvgUnit # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods showsPrec :: Int -> SvgUnit -> ShowS # show :: SvgUnit -> String # showList :: [SvgUnit] -> ShowS #
Eq SvgUnit # |
Instance details Defined in Graphics.Rendering.Cairo.Types Methods (==) :: SvgUnit -> SvgUnit -> Bool # (/=) :: SvgUnit -> SvgUnit -> Bool #

createMeshPattern :: MonadIO m => m Pattern #

Create a new mesh pattern.

Mesh patterns are tensor-product patch meshes (type 7 shadings in PDF). Mesh patterns may also be used to create other types of shadings that are special cases of tensor-product patch meshes such as Coons patch meshes (type 6 shading in PDF) and Gouraud-shaded triangle meshes (type 4 and 5 shadings in PDF).

Refer to https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-pattern-create-mesh for a more detailed explanation of their usage, as this library merely provides a wrapper around the underlying C API.

meshPatternAddPatchRGB #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> Path | a path to use as the boundary of the mesh pattern
-> [(Double, Double)] | a list of control points as `(x,y)` pairs
-> [(Double, Double, Double)] | a list of corner colors, each of the form `(r,g,b)`
-> m Status |

A convenience method that adds a patch to the mesh pattern in a single call.

It translates the provided path into calls to meshPatternMoveTo, meshPatternLineTo, and meshPatternCurveTo, as appropriate. The control points are set using meshPatternSetControlPoint and the corner colors are set using meshPatternSetCornerColorRGB. The above operations are wrapped in calls to At most the first 4 elements of the provided list will be used.

meshPatternAddPatchRGBA #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> Path | a path to use as the boundary of the mesh pattern
-> [(Double, Double)] | a list of control points as `(x,y)` pairs
-> [(Double, Double, Double, Double)] | a list of corner colors, each of the form `(r,g,b,a)`
-> m Status |

as `meshPatternAddPatchRGB`, but the colors contain an alpha channel.

The corner colors are set using meshPatternSetCornerColorRGBA.

meshPatternBeginPatch #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> m () |

Begin a patch in a mesh pattern.

Safer, more convenient methods `meshPatternAddPatchRGB` and `meshPatternAddPatchRGBA` are provided to avoid the begin/end idiom of the procedural language.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-begin-patch

meshPatternEndPatch #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> m () |

Indicates the end of the current patch in a mesh pattern.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-end-patch

meshPatternMoveTo #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> Double | the `x` coordinate of the point
-> Double | the `y` coordinate of the point
-> m () |

Define the first point of the current patch in a mesh pattern.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-move-to

meshPatternLineTo #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> Double | the `x` coordinate of the endpoint
-> Double | the `y` coordinate of the endpoint
-> m () |

Adds a line to the current patch from the current point to position `(x,y)` in pattern-space coordinates.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-line-to

meshPatternCurveTo #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> Double |
    x1
-> Double |
    y1
-> Double |
    x2
-> Double |
    y2
-> Double |
    x3
-> Double |
    y3
-> m () |

Adds a cubic Bézier spline to the current patch from the current point to position `(x3,y3)` in pattern-space coordinates, using `(x1,y1)` and `(x2,y2)` as the control points.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-curve-to

meshPatternSetControlPoint #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> Int | the number of the control point to modify, from 0 to 3
-> Double | the `x` coordinate of the control point
-> Double | the `y` coordinate of the control point
-> m () |

Set an internal control point of the current mesh patch.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-set-control-point

meshPatternSetCornerColorRGB #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> Int | the number of the corner to modify, from 0 to 3
-> Double | the `r` component of a color
-> Double | the `g` component of a color
-> Double | the `b` component of a color
-> m () |

Sets the color of a corner of the current patch in a mesh pattern.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-set-corner-color-rgb

meshPatternSetCornerColorRGBA #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to modify
-> Int | the number of the corner to modify, from 0 to 3
-> Double | the `r` component of a color
-> Double | the `g` component of a color
-> Double | the `b` component of a color
-> Double | the `a` component of a color
-> m () |

Sets the color of a corner of the current patch in a mesh pattern.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-set-corner-color-rgba

meshPatternGetPatchCount #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to query
-> m (Status, Int) |

Gets the number of patches specified in the given mesh pattern.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-get-patch-count

meshPatternGetPath #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to query
-> Int | the zero-indexed patch number
-> m Path |

Gets path defining a specified patch from a mesh pattern.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-get-path

meshPatternGetControlPoint #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to query
-> Int |
    point_num
-> Int |
    patch_num
-> m (Status, Double, Double) |

Gets the control point `point_num` of patch `patch_num` from a mesh pattern.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-get-control-point

meshPatternGetCornerColorRGBA #

Arguments

:: MonadIO m |
=> Pattern | the `Pattern` to query
-> Int |
    corner_num
-> Int |
    patch_num
-> m (Status, Double, Double, Double, Double) |

Gets the color information in corner `corner_num` of patch `patch_num` from a mesh pattern.

qv https://www.cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-mesh-pattern-get-corner-color-rgba