    -- GENERATED by C->Haskell Compiler, version 0.13.13 (gtk2hs branch) "Bin IO", 27 May 2012 (Haskell)
    -- Edit the ORIGINAL .chs file instead!

    {-# LANGUAGE RecordWildCards #-}

    {-# LINE 1 "./Graphics/Rendering/Cairo/Types.chs" #-}
    {-# OPTIONS_HADDOCK hide #-}
    -----------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.Rendering.Cairo.Types
    -- Copyright   :  (c) Paolo Martini 2005
    -- License     :  BSD-style (see cairo/COPYRIGHT)
    --
    -- Maintainer  :  p.martini@neuralnoise.com
    -- Stability   :  experimental
    -- Portability :  portable
    --
    -- Haskell bindings to the cairo types.
    -----------------------------------------------------------------------------

    -- #hide
    module Graphics.Rendering.Cairo.Types (
        PixelData
      , Matrix(Matrix), MatrixPtr
      , Cairo(Cairo), unCairo
      , Surface(Surface), withSurface, mkSurface, manageSurface
      , Pattern(Pattern), withPattern, mkPattern, clonePattern
      , Status(..)
      , Operator(..)
      , Antialias(..)
      , FillRule(..)
      , LineCap(..)
      , LineJoin(..)
      , ScaledFont(..), unScaledFont
      , FontFace(..), unFontFace
      , Glyph, unGlyph
      , TextExtentsPtr
      , TextExtents(..)
      , FontExtentsPtr
      , FontExtents(..)
      , FontSlant(..)
      , FontWeight(..)
      , SubpixelOrder(..)
      , HintStyle(..)
      , HintMetrics(..)
      , FontOptions(..), withFontOptions, mkFontOptions
      , Path, PathElement(..)
      , RectangleInt(..)
      , RegionOverlap(..)
      , Region(..), withRegion, mkRegion
      , Content(..)
      , Format(..)
      , Extend(..)
      , Filter(..)
      , SurfaceType(..)
      , PatternType(..)
      , SvgUnit(..)

      , cIntConv
      , cFloatConv
      , cFromBool
      , cToBool
      , cToEnum
      , cFromEnum
      , peekFloatConv
      , withFloatConv
      , peekIntConv

      ) where

    import Graphics.Rendering.Cairo.Matrix
    {-# LINE 72 "./Graphics/Rendering/Cairo/Types.chs" #-}

    import Foreign hiding (rotate)
    import Foreign.C

    import Control.Monad (liftM)

    {-# LINE 79 "./Graphics/Rendering/Cairo/Types.chs" #-}

    type PixelData = Ptr CUChar

    -- not visible
    newtype Cairo = Cairo (Ptr (Cairo))
    {-# LINE 84 "./Graphics/Rendering/Cairo/Types.chs" #-}
    unCairo (Cairo x) = x

    -- | The medium to draw on.
    newtype Surface = Surface (ForeignPtr (Surface))
    {-# LINE 88 "./Graphics/Rendering/Cairo/Types.chs" #-}
    withSurface (Surface x) = withForeignPtr x

    mkSurface :: Ptr Surface -> IO Surface
    mkSurface :: Ptr Surface -> IO Surface
    mkSurface Ptr Surface
    surfacePtr = do
      ForeignPtr Surface
    surfaceForeignPtr <- Ptr Surface -> IO (ForeignPtr Surface)
    forall a. Ptr a -> IO (ForeignPtr a)
    newForeignPtr_ Ptr Surface
    surfacePtr
      Surface -> IO Surface
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (ForeignPtr Surface -> Surface
    Surface ForeignPtr Surface
    surfaceForeignPtr)

    manageSurface :: Surface -> IO ()
    manageSurface :: Surface -> IO ()
    manageSurface (Surface ForeignPtr Surface
    surfaceForeignPtr) = do
      FinalizerPtr Surface -> ForeignPtr Surface -> IO ()
    forall a. FinalizerPtr a -> ForeignPtr a -> IO ()
    addForeignPtrFinalizer FinalizerPtr Surface
    surfaceDestroy ForeignPtr Surface
    surfaceForeignPtr

    foreign import ccall unsafe "&cairo_surface_destroy"
      surfaceDestroy :: FinalizerPtr Surface

    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
                     deriving (Int -> SurfaceType
    SurfaceType -> Int
    SurfaceType -> [SurfaceType]
    SurfaceType -> SurfaceType
    SurfaceType -> SurfaceType -> [SurfaceType]
    SurfaceType -> SurfaceType -> SurfaceType -> [SurfaceType]
    (SurfaceType -> SurfaceType)
    -> (SurfaceType -> SurfaceType)
    -> (Int -> SurfaceType)
    -> (SurfaceType -> Int)
    -> (SurfaceType -> [SurfaceType])
    -> (SurfaceType -> SurfaceType -> [SurfaceType])
    -> (SurfaceType -> SurfaceType -> [SurfaceType])
    -> (SurfaceType -> SurfaceType -> SurfaceType -> [SurfaceType])
    -> Enum SurfaceType
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: SurfaceType -> SurfaceType
    succ :: SurfaceType -> SurfaceType
    $cpred :: SurfaceType -> SurfaceType
    pred :: SurfaceType -> SurfaceType
    $ctoEnum :: Int -> SurfaceType
    toEnum :: Int -> SurfaceType
    $cfromEnum :: SurfaceType -> Int
    fromEnum :: SurfaceType -> Int
    $cenumFrom :: SurfaceType -> [SurfaceType]
    enumFrom :: SurfaceType -> [SurfaceType]
    $cenumFromThen :: SurfaceType -> SurfaceType -> [SurfaceType]
    enumFromThen :: SurfaceType -> SurfaceType -> [SurfaceType]
    $cenumFromTo :: SurfaceType -> SurfaceType -> [SurfaceType]
    enumFromTo :: SurfaceType -> SurfaceType -> [SurfaceType]
    $cenumFromThenTo :: SurfaceType -> SurfaceType -> SurfaceType -> [SurfaceType]
    enumFromThenTo :: SurfaceType -> SurfaceType -> SurfaceType -> [SurfaceType]
    Enum,SurfaceType -> SurfaceType -> Bool
    (SurfaceType -> SurfaceType -> Bool)
    -> (SurfaceType -> SurfaceType -> Bool) -> Eq SurfaceType
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SurfaceType -> SurfaceType -> Bool
    == :: SurfaceType -> SurfaceType -> Bool
    $c/= :: SurfaceType -> SurfaceType -> Bool
    /= :: SurfaceType -> SurfaceType -> Bool
    Eq,ReadPrec [SurfaceType]
    ReadPrec SurfaceType
    Int -> ReadS SurfaceType
    ReadS [SurfaceType]
    (Int -> ReadS SurfaceType)
    -> ReadS [SurfaceType]
    -> ReadPrec SurfaceType
    -> ReadPrec [SurfaceType]
    -> Read SurfaceType
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS SurfaceType
    readsPrec :: Int -> ReadS SurfaceType
    $creadList :: ReadS [SurfaceType]
    readList :: ReadS [SurfaceType]
    $creadPrec :: ReadPrec SurfaceType
    readPrec :: ReadPrec SurfaceType
    $creadListPrec :: ReadPrec [SurfaceType]
    readListPrec :: ReadPrec [SurfaceType]
    Read,Int -> SurfaceType -> ShowS
    [SurfaceType] -> ShowS
    SurfaceType -> String
    (Int -> SurfaceType -> ShowS)
    -> (SurfaceType -> String)
    -> ([SurfaceType] -> ShowS)
    -> Show SurfaceType
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SurfaceType -> ShowS
    showsPrec :: Int -> SurfaceType -> ShowS
    $cshow :: SurfaceType -> String
    show :: SurfaceType -> String
    $cshowList :: [SurfaceType] -> ShowS
    showList :: [SurfaceType] -> ShowS
    Show)

    {-# LINE 104 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | 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'.
    --
    newtype Pattern = Pattern (ForeignPtr (Pattern))
    {-# LINE 111 "./Graphics/Rendering/Cairo/Types.chs" #-}
    withPattern (Pattern x) = withForeignPtr x

    foreign import ccall unsafe "&cairo_pattern_destroy"
      patternDestroy :: FinalizerPtr Pattern

    mkPattern :: Ptr Pattern -> IO Pattern
    mkPattern ptr = Pattern <$> newForeignPtr patternDestroy ptr

    clonePattern :: Ptr Pattern -> IO Pattern
    clonePattern ptr  =  patternReference ptr >>= mkPattern

    patternReference :: Ptr Pattern -> IO (Ptr Pattern)
    patternReference a1 =
      let {a1' = castPtr a1} in
      patternReference'_ a1' >>= \res ->
      let {res' = castPtr res} in
      return (res')
    {-# LINE 123 "./Graphics/Rendering/Cairo/Types.chs" #-}

    data PatternType = PatternTypeSolid
                     | PatternTypeSurface
                     | PatternTypeLinear
                     | PatternTypeRadial
                     | PatternTypeMesh
                     | PatternTypeRasterSource
                     deriving (Enum,Eq,Read,Show)

    {-# LINE 128 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | 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
    --   'Graphics.Rendering.Cairo.Render', the last error, if any, is stored
    --   in the monad and can be retrieved with 'Graphics.Rendering.Cairo.status'.
    --
    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
                deriving (Status -> Status -> Bool
    (Status -> Status -> Bool)
    -> (Status -> Status -> Bool) -> Eq Status
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Status -> Status -> Bool
    == :: Status -> Status -> Bool
    $c/= :: Status -> Status -> Bool
    /= :: Status -> Status -> Bool
    Eq,Int -> Status -> ShowS
    [Status] -> ShowS
    Status -> String
    (Int -> Status -> ShowS)
    -> (Status -> String) -> ([Status] -> ShowS) -> Show Status
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Status -> ShowS
    showsPrec :: Int -> Status -> ShowS
    $cshow :: Status -> String
    show :: Status -> String
    $cshowList :: [Status] -> ShowS
    showList :: [Status] -> ShowS
    Show)
    instance Enum Status where
      fromEnum :: Status -> Int
    fromEnum Status
    StatusSuccess = Int
    0
      fromEnum Status
    StatusNoMemory = Int
    1
      fromEnum Status
    StatusInvalidRestore = Int
    2
      fromEnum Status
    StatusInvalidPopGroup = Int
    3
      fromEnum Status
    StatusNoCurrentPoint = Int
    4
      fromEnum StatusInvalidMatrix = 5
      fromEnum StatusInvalidStatus = 6
      fromEnum StatusNullPointer = 7
      fromEnum StatusInvalidString = 8
      fromEnum StatusInvalidPathData = 9
      fromEnum StatusReadError = 10
      fromEnum StatusWriteError = 11
      fromEnum StatusSurfaceFinished = 12
      fromEnum Status
    StatusSurfaceTypeMismatch = Int
    13
      fromEnum StatusPatternTypeMismatch = 14
      fromEnum Status
    StatusInvalidContent = Int
    15
      fromEnum Status
    StatusInvalidFormat = Int
    16
      fromEnum StatusInvalidVisual = 17
      fromEnum Status
    StatusFileNotFound = Int
    18
      fromEnum Status
    StatusInvalidDash = Int
    19
      fromEnum StatusInvalidDscComment = 20
      fromEnum Status
    StatusInvalidIndex = Int
    21
      fromEnum Status
    StatusClipNotRepresentable = Int
    22
      fromEnum StatusTempFileError = 23
      fromEnum StatusInvalidStride = 24
      fromEnum StatusFontTypeMismatch = 25
      fromEnum StatusUserFontImmutable = 26
      fromEnum StatusUserFontError = 27
      fromEnum StatusNegativeCount = 28
      fromEnum StatusInvalidClusters = 29
      fromEnum Status
    StatusInvalidSlant = Int
    30
      fromEnum Status
    StatusInvalidWeight = Int
    31
      fromEnum Status
    StatusInvalidSize = Int
    32
      fromEnum Status
    StatusUserFontNotImplemented = Int
    33
      fromEnum Status
    StatusDeviceTypeMismatch = Int
    34
      fromEnum Status
    StatusDeviceError = Int
    35
      fromEnum Status
    StatusInvalidMeshConstruction = Int
    36
      fromEnum Status
    StatusDeviceFinished = Int
    37
      fromEnum Status
    StatusJbig2GlobalMissing = Int
    38
      fromEnum Status
    StatusPngError = Int
    39
      fromEnum Status
    StatusFreetypeError = Int
    40
      fromEnum Status
    StatusWin32GdiError = Int
    41
      fromEnum Status
    StatusTagError = Int
    42
      fromEnum Status
    StatusDwriteError = Int
    43
      fromEnum Status
    StatusSvgFontError = Int
    44
      fromEnum Status
    StatusLastStatus = Int
    45

      toEnum 0 = StatusSuccess
      toEnum 1 = StatusNoMemory
      toEnum 2 = StatusInvalidRestore
      toEnum 3 = StatusInvalidPopGroup
      toEnum 4 = StatusNoCurrentPoint
      toEnum 5 = StatusInvalidMatrix
      toEnum 6 = StatusInvalidStatus
      toEnum 7 = StatusNullPointer
      toEnum 8 = StatusInvalidString
      toEnum 9 = StatusInvalidPathData
      toEnum 10 = StatusReadError
      toEnum 11 = StatusWriteError
      toEnum 12 = StatusSurfaceFinished
      toEnum 13 = StatusSurfaceTypeMismatch
      toEnum 14 = StatusPatternTypeMismatch
      toEnum 15 = StatusInvalidContent
      toEnum 16 = StatusInvalidFormat
      toEnum 17 = StatusInvalidVisual
      toEnum 18 = StatusFileNotFound
      toEnum 19 = StatusInvalidDash
      toEnum 20 = StatusInvalidDscComment
      toEnum 21 = StatusInvalidIndex
      toEnum 22 = StatusClipNotRepresentable
      toEnum 23 = StatusTempFileError
      toEnum 24 = StatusInvalidStride
      toEnum 25 = StatusFontTypeMismatch
      toEnum 26 = StatusUserFontImmutable
      toEnum 27 = StatusUserFontError
      toEnum 28 = StatusNegativeCount
      toEnum 29 = StatusInvalidClusters
      toEnum 30 = StatusInvalidSlant
      toEnum 31 = StatusInvalidWeight
      toEnum 32 = StatusInvalidSize
      toEnum 33 = StatusUserFontNotImplemented
      toEnum 34 = StatusDeviceTypeMismatch
      toEnum 35 = StatusDeviceError
      toEnum 36 = StatusInvalidMeshConstruction
      toEnum 37 = StatusDeviceFinished
      toEnum 38 = StatusJbig2GlobalMissing
      toEnum 39 = StatusPngError
      toEnum 40 = StatusFreetypeError
      toEnum 41 = StatusWin32GdiError
      toEnum 42 = StatusTagError
      toEnum 43 = StatusDwriteError
      toEnum 44 = StatusSvgFontError
      toEnum 45 = StatusLastStatus
      toEnum unmatched = error ("Status.toEnum: Cannot match " ++ show unmatched)

      succ :: Status -> Status
    succ Status
    StatusSuccess = Status
    StatusNoMemory
      succ Status
    StatusNoMemory = Status
    StatusInvalidRestore
      succ Status
    StatusInvalidRestore = Status
    StatusInvalidPopGroup
      succ Status
    StatusInvalidPopGroup = Status
    StatusNoCurrentPoint
      succ Status
    StatusNoCurrentPoint = Status
    StatusInvalidMatrix
      succ Status
    StatusInvalidMatrix = Status
    StatusInvalidStatus
      succ Status
    StatusInvalidStatus = Status
    StatusNullPointer
      succ Status
    StatusNullPointer = Status
    StatusInvalidString
      succ Status
    StatusInvalidString = Status
    StatusInvalidPathData
      succ Status
    StatusInvalidPathData = Status
    StatusReadError
      succ Status
    StatusReadError = Status
    StatusWriteError
      succ Status
    StatusWriteError = Status
    StatusSurfaceFinished
      succ Status
    StatusSurfaceFinished = Status
    StatusSurfaceTypeMismatch
      succ Status
    StatusSurfaceTypeMismatch = Status
    StatusPatternTypeMismatch
      succ StatusPatternTypeMismatch = StatusInvalidContent
      succ StatusInvalidContent = StatusInvalidFormat
      succ StatusInvalidFormat = StatusInvalidVisual
      succ StatusInvalidVisual = StatusFileNotFound
      succ StatusFileNotFound = StatusInvalidDash
      succ Status
    StatusInvalidDash = Status
    StatusInvalidDscComment
      succ Status
    StatusInvalidDscComment = Status
    StatusInvalidIndex
      succ Status
    StatusInvalidIndex = Status
    StatusClipNotRepresentable
      succ Status
    StatusClipNotRepresentable = Status
    StatusTempFileError
      succ Status
    StatusTempFileError = Status
    StatusInvalidStride
      succ Status
    StatusInvalidStride = Status
    StatusFontTypeMismatch
      succ Status
    StatusFontTypeMismatch = Status
    StatusUserFontImmutable
      succ Status
    StatusUserFontImmutable = Status
    StatusUserFontError
      succ Status
    StatusUserFontError = Status
    StatusNegativeCount
      succ Status
    StatusNegativeCount = Status
    StatusInvalidClusters
      succ Status
    StatusInvalidClusters = Status
    StatusInvalidSlant
      succ Status
    StatusInvalidSlant = Status
    StatusInvalidWeight
      succ Status
    StatusInvalidWeight = Status
    StatusInvalidSize
      succ Status
    StatusInvalidSize = Status
    StatusUserFontNotImplemented
      succ Status
    StatusUserFontNotImplemented = Status
    StatusDeviceTypeMismatch
      succ Status
    StatusDeviceTypeMismatch = Status
    StatusDeviceError
      succ Status
    StatusDeviceError = Status
    StatusInvalidMeshConstruction
      succ Status
    StatusInvalidMeshConstruction = Status
    StatusDeviceFinished
      succ StatusDeviceFinished = StatusJbig2GlobalMissing
      succ StatusJbig2GlobalMissing = StatusPngError
      succ StatusPngError = StatusFreetypeError
      succ StatusFreetypeError = StatusWin32GdiError
      succ StatusWin32GdiError = StatusTagError
      succ Status
    StatusTagError = Status
    StatusDwriteError
      succ Status
    StatusDwriteError = Status
    StatusSvgFontError
      succ Status
    StatusSvgFontError = Status
    StatusLastStatus
      succ Status
    _ = Status
    forall a. HasCallStack => a
    undefined

      pred :: Status -> Status
    pred Status
    StatusNoMemory = Status
    StatusSuccess
      pred Status
    StatusInvalidRestore = Status
    StatusNoMemory
      pred Status
    StatusInvalidPopGroup = Status
    StatusInvalidRestore
      pred Status
    StatusNoCurrentPoint = Status
    StatusInvalidPopGroup
      pred Status
    StatusInvalidMatrix = Status
    StatusNoCurrentPoint
      pred Status
    StatusInvalidStatus = Status
    StatusInvalidMatrix
      pred Status
    StatusNullPointer = Status
    StatusInvalidStatus
      pred StatusInvalidString = StatusNullPointer
      pred StatusInvalidPathData = StatusInvalidString
      pred StatusReadError = StatusInvalidPathData
      pred Status
    StatusWriteError = Status
    StatusReadError
      pred Status
    StatusSurfaceFinished = Status
    StatusWriteError
      pred StatusSurfaceTypeMismatch = StatusSurfaceFinished
      pred Status
    StatusPatternTypeMismatch = Status
    StatusSurfaceTypeMismatch
      pred Status
    StatusInvalidContent = Status
    StatusPatternTypeMismatch
      pred StatusInvalidFormat = StatusInvalidContent
      pred StatusInvalidVisual = StatusInvalidFormat
      pred Status
    StatusFileNotFound = Status
    StatusInvalidVisual
      pred Status
    StatusInvalidDash = Status
    StatusFileNotFound
      pred StatusInvalidDscComment = StatusInvalidDash
      pred Status
    StatusInvalidIndex = Status
    StatusInvalidDscComment
      pred Status
    StatusClipNotRepresentable = Status
    StatusInvalidIndex
      pred Status
    StatusTempFileError = Status
    StatusClipNotRepresentable
      pred Status
    StatusInvalidStride = Status
    StatusTempFileError
      pred Status
    StatusFontTypeMismatch = Status
    StatusInvalidStride
      pred Status
    StatusUserFontImmutable = Status
    StatusFontTypeMismatch
      pred StatusUserFontError = StatusUserFontImmutable
      pred StatusNegativeCount = StatusUserFontError
      pred StatusInvalidClusters = StatusNegativeCount
      pred StatusInvalidSlant = StatusInvalidClusters
      pred Status
    StatusInvalidWeight = Status
    StatusInvalidSlant
      pred StatusInvalidSize = StatusInvalidWeight
      pred StatusUserFontNotImplemented = StatusInvalidSize
      pred StatusDeviceTypeMismatch = StatusUserFontNotImplemented
      pred StatusDeviceError = StatusDeviceTypeMismatch
      pred StatusInvalidMeshConstruction = StatusDeviceError
      pred StatusDeviceFinished = StatusInvalidMeshConstruction
      pred Status
    StatusJbig2GlobalMissing = Status
    StatusDeviceFinished
      pred Status
    StatusPngError = Status
    StatusJbig2GlobalMissing
      pred Status
    StatusFreetypeError = Status
    StatusPngError
      pred Status
    StatusWin32GdiError = Status
    StatusFreetypeError
      pred Status
    StatusTagError = Status
    StatusWin32GdiError
      pred StatusDwriteError = StatusTagError
      pred Status
    StatusSvgFontError = Status
    StatusDwriteError
      pred Status
    StatusLastStatus = Status
    StatusSvgFontError
      pred Status
    _ = Status
    forall a. HasCallStack => a
    undefined

      enumFromTo x y | fromEnum x == fromEnum y = [ y ]
                     | otherwise = x : enumFromTo (succ x) y
      enumFrom x = enumFromTo x StatusLastStatus
      enumFromThen _ _ =     error "Enum Status: enumFromThen not implemented"
      enumFromThenTo :: Status -> Status -> Status -> [Status]
    enumFromThenTo Status
    _ Status
    _ Status
    _ =     String -> [Status]
    forall a. HasCallStack => String -> a
    error String
    "Enum Status: enumFromThenTo not implemented"

    {-# LINE 138 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | Composition operator for all drawing operations.
    --
    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
                  deriving (Enum,Eq,Show)

    {-# LINE 142 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | 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.
    --
    data Antialias = AntialiasDefault
                   | AntialiasNone
                   | AntialiasGray
                   | AntialiasSubpixel
                   | AntialiasFast
                   | AntialiasGood
                   | AntialiasBest
                   deriving (Enum,Eq,Show)

    {-# LINE 157 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | 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.
    --
    data FillRule = FillRuleWinding
                  | FillRuleEvenOdd
                  deriving (Enum,Eq,Show)

    {-# LINE 179 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | 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
    --
    data LineCap = LineCapButt
                 | LineCapRound
                 | LineCapSquare
                 deriving (Enum,Eq,Show)

    {-# LINE 191 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | Specify how lines join.
    --
    data LineJoin = LineJoinMiter
                  | LineJoinRound
                  | LineJoinBevel
                  deriving (Enum,Eq,Show)

    {-# LINE 195 "./Graphics/Rendering/Cairo/Types.chs" #-}

    newtype ScaledFont = ScaledFont (Ptr (ScaledFont))
    {-# LINE 197 "./Graphics/Rendering/Cairo/Types.chs" #-}
    unScaledFont (ScaledFont x) = x

    newtype FontFace = FontFace (Ptr (FontFace))
    {-# LINE 200 "./Graphics/Rendering/Cairo/Types.chs" #-}
    unFontFace (FontFace x) = x

    newtype Glyph = Glyph (Ptr (Glyph))
    {-# LINE 203 "./Graphics/Rendering/Cairo/Types.chs" #-}
    unGlyph (Glyph x) = x

    type TextExtentsPtr = Ptr (TextExtents)
    {-# LINE 206 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | Specify the extents of a text.
    data TextExtents = TextExtents {
        textExtentsXbearing :: Double
      , textExtentsYbearing :: Double
      , textExtentsWidth    :: Double
      , textExtentsHeight   :: Double
      , textExtentsXadvance :: Double
      , textExtentsYadvance :: Double
      }

    instance Storable TextExtents where
      sizeOf _ = 48
    {-# LINE 219 "./Graphics/Rendering/Cairo/Types.chs" #-}
      alignment _ = alignment (undefined :: CDouble)
      peek p = do
        x_bearing <- (\ptr -> do {peekByteOff ptr 0 ::IO CDouble}) p
        y_bearing <- (\ptr -> do {peekByteOff ptr 8 ::IO CDouble}) p
        width     <- (\ptr -> do {peekByteOff ptr 16 ::IO CDouble})     p
        height    <- (\ptr -> do {peekByteOff ptr 24 ::IO CDouble})    p
        x_advance <- (\ptr -> do {peekByteOff ptr 32 ::IO CDouble}) p
        y_advance <- (\ptr -> do {peekByteOff ptr 40 ::IO CDouble}) p
        return $ TextExtents (cFloatConv x_bearing) (cFloatConv y_bearing)
                             (cFloatConv width)     (cFloatConv height)
                             (cFloatConv x_advance) (cFloatConv y_advance)
      poke p (TextExtents x_bearing y_bearing width height x_advance y_advance) = do
        (\ptr val -> do {pokeByteOff ptr 0 (val::CDouble)}) p (cFloatConv x_bearing)
        (\ptr val -> do {pokeByteOff ptr 8 (val::CDouble)}) p (cFloatConv y_bearing)
        (\ptr val -> do {pokeByteOff ptr 16 (val::CDouble)})     p (cFloatConv width)
        (\ptr val -> do {pokeByteOff ptr 24 (val::CDouble)})    p (cFloatConv height)
        (\ptr val -> do {pokeByteOff ptr 32 (val::CDouble)}) p (cFloatConv x_advance)
        (\ptr val -> do {pokeByteOff ptr 40 (val::CDouble)}) p (cFloatConv y_advance)
        return ()

    type FontExtentsPtr = Ptr (FontExtents)
    {-# LINE 240 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | Result of querying the font extents.
    data FontExtents = FontExtents {
        fontExtentsAscent      :: Double
      , fontExtentsDescent     :: Double
      , fontExtentsHeight      :: Double
      , fontExtentsMaxXadvance :: Double
      , fontExtentsMaxYadvance :: Double
      }

    instance Storable FontExtents where
      sizeOf _ = 40
    {-# LINE 252 "./Graphics/Rendering/Cairo/Types.chs" #-}
      alignment _ = alignment (undefined :: CDouble)
      peek p = do
        ascent        <- (\ptr -> do {peekByteOff ptr 0 ::IO CDouble})        p
        descent       <- (\ptr -> do {peekByteOff ptr 8 ::IO CDouble})       p
        height        <- (\ptr -> do {peekByteOff ptr 16 ::IO CDouble})        p
        max_x_advance <- (\ptr -> do {peekByteOff ptr 24 ::IO CDouble}) p
        max_y_advance <- (\ptr -> do {peekByteOff ptr 32 ::IO CDouble}) p
        return $ FontExtents (cFloatConv ascent) (cFloatConv descent) (cFloatConv height)
                             (cFloatConv max_x_advance) (cFloatConv max_y_advance)
      poke p (FontExtents ascent descent height max_x_advance max_y_advance) = do
        (\ptr val -> do {pokeByteOff ptr 0 (val::CDouble)})        p (cFloatConv ascent)
        (\ptr val -> do {pokeByteOff ptr 8 (val::CDouble)})       p (cFloatConv descent)
        (\ptr val -> do {pokeByteOff ptr 16 (val::CDouble)})        p (cFloatConv height)
        (\ptr val -> do {pokeByteOff ptr 24 (val::CDouble)}) p (cFloatConv max_x_advance)
        (\ptr val -> do {pokeByteOff ptr 32 (val::CDouble)}) p (cFloatConv max_y_advance)
        return ()

    -- | Specify font slant.
    data FontSlant = FontSlantNormal
                   | FontSlantItalic
                   | FontSlantOblique
                   deriving (Enum,Eq,Show)

    {-# LINE 271 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | Specify font weight.
    data FontWeight = FontWeightNormal
                    | FontWeightBold
                    deriving (Enum,Eq,Show)

    {-# LINE 274 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | 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
    --
    data SubpixelOrder = SubpixelOrderDefault
                       | SubpixelOrderRgb
                       | SubpixelOrderBgr
                       | SubpixelOrderVrgb
                       | SubpixelOrderVbgr
                       deriving (Enum,Eq,Show)

    {-# LINE 295 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | 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
    --
    data HintStyle = HintStyleDefault
                   | HintStyleNone
                   | HintStyleSlight
                   | HintStyleMedium
                   | HintStyleFull
                   deriving (Enum)

    {-# LINE 318 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | 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
    --
    --
    data HintMetrics = HintMetricsDefault
                     | HintMetricsOff
                     | HintMetricsOn
                     deriving (Enum,Eq,Show)

    {-# LINE 335 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | Specifies how to render text.
    newtype FontOptions = FontOptions (ForeignPtr (FontOptions))
    {-# LINE 338 "./Graphics/Rendering/Cairo/Types.chs" #-}

    withFontOptions (FontOptions fptr) = withForeignPtr fptr

    mkFontOptions :: Ptr FontOptions -> IO FontOptions
    mkFontOptions fontOptionsPtr = do
      fontOptionsForeignPtr <- newForeignPtr fontOptionsDestroy fontOptionsPtr
      return (FontOptions fontOptionsForeignPtr)

    foreign import ccall unsafe "&cairo_font_options_destroy"
      fontOptionsDestroy :: FinalizerPtr FontOptions

    -- XXX: pathToList :: Path -> [PathData]
    --
    -- http://cairographics.org/manual/bindings-path.html
    --
    data PathElement = MoveTo Double Double
                     | LineTo Double Double
                     | CurveTo Double Double Double Double Double Double
                     | ClosePath
       deriving (Eq, Read, Show)
    -- | A Cairo path.
    --
    -- * A path is a sequence of drawing operations that are accumulated until
    --   'Graphics.Rendering.Cairo.stroke' is called. Using a path is particularly
    --   useful when drawing lines with special join styles and
    --   'Graphics.Rendering.Cairo.closePath'.
    --
    type Path = [PathElement]

    type RectangleIntPtr = Ptr (RectangleInt)
    {-# LINE 371 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | A data structure for holding a rectangle with integer coordinates.
    data RectangleInt = RectangleInt {
        x      :: Int
      , y      :: Int
      , width  :: Int
      , height :: Int
      }

    instance Storable RectangleInt where
      sizeOf _ = 16
    {-# LINE 382 "./Graphics/Rendering/Cairo/Types.chs" #-}
      alignment _ = alignment (undefined :: CInt)
      peek p = do
        x      <- (\ptr -> do {peekByteOff ptr 0 ::IO CInt})      p
        y      <- (\ptr -> do {peekByteOff ptr 4 ::IO CInt})      p
        width  <- (\ptr -> do {peekByteOff ptr 8 ::IO CInt})  p
        height <- (\ptr -> do {peekByteOff ptr 12 ::IO CInt}) p
        return $ RectangleInt (fromIntegral x) (fromIntegral y) (fromIntegral width) (fromIntegral height)
      poke p (RectangleInt {..}) = do
        (\ptr val -> do {pokeByteOff ptr 0 (val::CInt)})      p (fromIntegral x)
        (\ptr val -> do {pokeByteOff ptr 4 (val::CInt)})      p (fromIntegral y)
        (\ptr val -> do {pokeByteOff ptr 8 (val::CInt)})  p (fromIntegral width)
        (\ptr val -> do {pokeByteOff ptr 12 (val::CInt)}) p (fromIntegral height)
        return ()

    -- | Used as the return value for regionContainsRectangle.
    data RegionOverlap = RegionOverlapIn
                       | RegionOverlapOut
                       | RegionOverlapPart
                       deriving (Int -> RegionOverlap
    RegionOverlap -> Int
    RegionOverlap -> [RegionOverlap]
    RegionOverlap -> RegionOverlap
    RegionOverlap -> RegionOverlap -> [RegionOverlap]
    RegionOverlap -> RegionOverlap -> RegionOverlap -> [RegionOverlap]
    (RegionOverlap -> RegionOverlap)
    -> (RegionOverlap -> RegionOverlap)
    -> (Int -> RegionOverlap)
    -> (RegionOverlap -> Int)
    -> (RegionOverlap -> [RegionOverlap])
    -> (RegionOverlap -> RegionOverlap -> [RegionOverlap])
    -> (RegionOverlap -> RegionOverlap -> [RegionOverlap])
    -> (RegionOverlap
        -> RegionOverlap -> RegionOverlap -> [RegionOverlap])
    -> Enum RegionOverlap
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: RegionOverlap -> RegionOverlap
    succ :: RegionOverlap -> RegionOverlap
    $cpred :: RegionOverlap -> RegionOverlap
    pred :: RegionOverlap -> RegionOverlap
    $ctoEnum :: Int -> RegionOverlap
    toEnum :: Int -> RegionOverlap
    $cfromEnum :: RegionOverlap -> Int
    fromEnum :: RegionOverlap -> Int
    $cenumFrom :: RegionOverlap -> [RegionOverlap]
    enumFrom :: RegionOverlap -> [RegionOverlap]
    $cenumFromThen :: RegionOverlap -> RegionOverlap -> [RegionOverlap]
    enumFromThen :: RegionOverlap -> RegionOverlap -> [RegionOverlap]
    $cenumFromTo :: RegionOverlap -> RegionOverlap -> [RegionOverlap]
    enumFromTo :: RegionOverlap -> RegionOverlap -> [RegionOverlap]
    $cenumFromThenTo :: RegionOverlap -> RegionOverlap -> RegionOverlap -> [RegionOverlap]
    enumFromThenTo :: RegionOverlap -> RegionOverlap -> RegionOverlap -> [RegionOverlap]
    Enum,RegionOverlap -> RegionOverlap -> Bool
    (RegionOverlap -> RegionOverlap -> Bool)
    -> (RegionOverlap -> RegionOverlap -> Bool) -> Eq RegionOverlap
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: RegionOverlap -> RegionOverlap -> Bool
    == :: RegionOverlap -> RegionOverlap -> Bool
    $c/= :: RegionOverlap -> RegionOverlap -> Bool
    /= :: RegionOverlap -> RegionOverlap -> Bool
    Eq,Int -> RegionOverlap -> ShowS
    [RegionOverlap] -> ShowS
    RegionOverlap -> String
    (Int -> RegionOverlap -> ShowS)
    -> (RegionOverlap -> String)
    -> ([RegionOverlap] -> ShowS)
    -> Show RegionOverlap
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> RegionOverlap -> ShowS
    showsPrec :: Int -> RegionOverlap -> ShowS
    $cshow :: RegionOverlap -> String
    show :: RegionOverlap -> String
    $cshowList :: [RegionOverlap] -> ShowS
    showList :: [RegionOverlap] -> ShowS
    Show)

    {-# LINE 398 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | A Cairo region. Represents a set of integer-aligned rectangles.
    --
    -- It allows set-theoretical operations like regionUnion and regionIntersect to be performed on them.
    newtype Region = Region (ForeignPtr (Region))
    {-# LINE 403 "./Graphics/Rendering/Cairo/Types.chs" #-}

    withRegion :: Region -> (Ptr Region -> IO b) -> IO b
    withRegion (Region ForeignPtr Region
    fptr) = ForeignPtr Region -> (Ptr Region -> IO b) -> IO b
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Region
    fptr

    mkRegion :: Ptr Region -> IO Region
    mkRegion :: Ptr Region -> IO Region
    mkRegion Ptr Region
    regionPtr = do
      ForeignPtr Region
    regionForeignPtr <- FinalizerPtr Region -> Ptr Region -> IO (ForeignPtr Region)
    forall a. FinalizerPtr a -> Ptr a -> IO (ForeignPtr a)
    newForeignPtr FinalizerPtr Region
    regionDestroy Ptr Region
    regionPtr
      Region -> IO Region
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (ForeignPtr Region -> Region
    Region ForeignPtr Region
    regionForeignPtr)

    foreign import ccall unsafe "&cairo_region_destroy"
      regionDestroy :: FinalizerPtr Region

    data Content = ContentColor
                 | ContentAlpha
                 | ContentColorAlpha
                 deriving (Content -> Content -> Bool
    (Content -> Content -> Bool)
    -> (Content -> Content -> Bool) -> Eq Content
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Content -> Content -> Bool
    == :: Content -> Content -> Bool
    $c/= :: Content -> Content -> Bool
    /= :: Content -> Content -> Bool
    Eq,Int -> Content -> ShowS
    [Content] -> ShowS
    Content -> String
    (Int -> Content -> ShowS)
    -> (Content -> String) -> ([Content] -> ShowS) -> Show Content
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Content -> ShowS
    showsPrec :: Int -> Content -> ShowS
    $cshow :: Content -> String
    show :: Content -> String
    $cshowList :: [Content] -> ShowS
    showList :: [Content] -> ShowS
    Show)
    instance Enum Content where
      fromEnum :: Content -> Int
    fromEnum Content
    ContentColor = Int
    4096
      fromEnum Content
    ContentAlpha = Int
    8192
      fromEnum Content
    ContentColorAlpha = Int
    12288

      toEnum :: Int -> Content
    toEnum Int
    4096 = Content
    ContentColor
      toEnum Int
    8192 = Content
    ContentAlpha
      toEnum Int
    12288 = Content
    ContentColorAlpha
      toEnum Int
    unmatched = String -> Content
    forall a. HasCallStack => String -> a
    error (String
    "Content.toEnum: Cannot match " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    unmatched)

      succ ContentColor = ContentAlpha
      succ ContentAlpha = ContentColorAlpha
      succ _ = undefined

      pred ContentAlpha = ContentColor
      pred ContentColorAlpha = ContentAlpha
      pred _ = undefined

      enumFromTo x y | fromEnum x == fromEnum y = [ y ]
                     | otherwise = x : enumFromTo (succ x) y
      enumFrom x = enumFromTo x ContentColorAlpha
      enumFromThen _ _ =     error "Enum Content: enumFromThen not implemented"
      enumFromThenTo _ _ _ =     error "Enum Content: enumFromThenTo not implemented"

    {-# LINE 417 "./Graphics/Rendering/Cairo/Types.chs" #-}

    data Format = FORMAT_INVALID
                | FormatARGB32
                | FormatRGB24
                | FormatA8
                | FormatA1
                | FormatRGB16565
                | FormatRGB30
                | FORMAT_RGB96F
                | FORMAT_RGBA128F
                deriving (Eq,Show)
    instance Enum Format where
      fromEnum FORMAT_INVALID = (-1)
      fromEnum FormatARGB32 = 0
      fromEnum FormatRGB24 = 1
      fromEnum FormatA8 = 2
      fromEnum FormatA1 = 3
      fromEnum FormatRGB16565 = 4
      fromEnum FormatRGB30 = 5
      fromEnum FORMAT_RGB96F = 6
      fromEnum FORMAT_RGBA128F = 7

      toEnum (-1) = FORMAT_INVALID
      toEnum 0 = FormatARGB32
      toEnum 1 = FormatRGB24
      toEnum 2 = FormatA8
      toEnum 3 = FormatA1
      toEnum 4 = FormatRGB16565
      toEnum 5 = FormatRGB30
      toEnum 6 = FORMAT_RGB96F
      toEnum 7 = FORMAT_RGBA128F
      toEnum unmatched = error ("Format.toEnum: Cannot match " ++ show unmatched)

      succ FORMAT_INVALID = FormatARGB32
      succ FormatARGB32 = FormatRGB24
      succ FormatRGB24 = FormatA8
      succ FormatA8 = FormatA1
      succ FormatA1 = FormatRGB16565
      succ FormatRGB16565 = FormatRGB30
      succ FormatRGB30 = FORMAT_RGB96F
      succ FORMAT_RGB96F = FORMAT_RGBA128F
      succ _ Int
    = undefined

      pred :: Format -> Format
    pred Format
    FormatARGB32 = Format
    FORMAT_INVALID
      pred Format
    FormatRGB24 = Format
    FormatARGB32
      pred Format
    FormatA8 = Format
    FormatRGB24
      pred Format
    FormatA1 = Format
    FormatA8
      pred Format
    FormatRGB16565 = Format
    FormatA1
      pred Format
    FormatRGB30 = Format
    FormatRGB16565
      pred Format
    FORMAT_RGB96F = Format
    FormatRGB30
      pred Format
    FORMAT_RGBA128F = Format
    FORMAT_RGB96F
      pred Format
    _ = Format
    forall a. HasCallStack => a
    undefined

      enumFromTo :: Format -> Format -> [Format]
    enumFromTo Format
    x Format
    y | fromEnum x Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == Format -> Int
    forall a. Enum a => a -> Int
    fromEnum Format
    y = [ Format
    y ]
                     | Bool
    otherwise = Format
    x Format -> [Format] -> [Format]
    forall a. a -> [a] -> [a]
    : Format -> Format -> [Format]
    forall a. Enum a => a -> a -> [a]
    enumFromTo (Format -> Format
    forall a. Enum a => a -> a
    succ Format
    x) Format
    y
      enumFrom :: Format -> [Format]
    enumFrom Format
    x = enumFromTo x Format
    FORMAT_RGBA128F
      enumFromThen :: Format -> Format -> [Format]
    enumFromThen Format
    _ Format
    _ =     String -> [Format]
    forall a. HasCallStack => String -> a
    error String
    "Enum Format: enumFromThen not implemented"
      enumFromThenTo :: Format -> Format -> Format -> [Format]
    enumFromThenTo Format
    _ Format
    _ Format
    _ =     String -> [Format]
    forall a. HasCallStack => String -> a
    error String
    "Enum Format: enumFromThenTo not implemented"

    {-# LINE 426 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | FIXME: We should find out about this.
    data Extend = ExtendNone
                | ExtendRepeat
                | ExtendReflect
                | ExtendPad
                deriving (Enum,Eq,Show)

    {-# LINE 430 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | Specify how filtering is done.
    data Filter = FilterFast
                | FilterGood
                | FilterBest
                | FilterNearest
                | FilterBilinear
                | FilterGaussian
                deriving (Enum,Eq,Show)

    {-# LINE 433 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- | Specify the unit used in SVG surfaces.
    data SvgUnit = SvgUnitUser
                 | SvgUnitEm
                 | SvgUnitEx
                 | SvgUnitPx
                 | SvgUnitIn
                 | SvgUnitCm
                 | SvgUnitMm
                 | SvgUnitPt
                 | SvgUnitPc
                 | SvgUnitPercent
                 deriving (Eq,Show)
    instance Enum SvgUnit where
      fromEnum SvgUnitUser = 0
      fromEnum SvgUnitEm = 1
      fromEnum SvgUnitEx = 2
      fromEnum SvgUnitPx = 3
      fromEnum SvgUnitIn = 4
      fromEnum SvgUnitCm = 5
      fromEnum SvgUnitMm = 6
      fromEnum SvgUnitPt = 7
      fromEnum SvgUnitPc = 8
      fromEnum SvgUnitPercent = 9

      toEnum 0 = SvgUnitUser
      toEnum 1 = SvgUnitEm
      toEnum 2 = SvgUnitEx
      toEnum 3 = SvgUnitPx
      toEnum 4 = SvgUnitIn
      toEnum 5 = SvgUnitCm
      toEnum 6 = SvgUnitMm
      toEnum 7 = SvgUnitPt
      toEnum 8 = SvgUnitPc
      toEnum 9 = SvgUnitPercent
      toEnum unmatched = error ("SvgUnit.toEnum: Cannot match " ++ show unmatched)

      succ SvgUnitUser = SvgUnitEm
      succ SvgUnitEm = SvgUnitEx
      succ SvgUnitEx = SvgUnitPx
      succ SvgUnitPx = SvgUnitIn
      succ SvgUnitIn = SvgUnitCm
      succ SvgUnitCm = SvgUnitMm
      succ SvgUnitMm = SvgUnitPt
      succ SvgUnitPt = SvgUnitPc
      succ SvgUnitPc = SvgUnitPercent
      succ _ = undefined

      pred SvgUnitEm = SvgUnitUser
      pred SvgUnitEx = SvgUnitEm
      pred SvgUnitPx = SvgUnitEx
      pred SvgUnitIn = SvgUnitPx
      pred SvgUnitCm = SvgUnitIn
      pred SvgUnitMm = SvgUnitCm
      pred SvgUnitPt = SvgUnitMm
      pred SvgUnitPc = SvgUnitPt
      pred SvgUnitPercent = SvgUnitPc
      pred _ = undefined

      enumFromTo :: SvgUnit -> SvgUnit -> [SvgUnit]
    enumFromTo SvgUnit
    x SvgUnit
    y | SvgUnit -> Int
    forall a. Enum a => a -> Int
    fromEnum SvgUnit
    x Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == SvgUnit -> Int
    forall a. Enum a => a -> Int
    fromEnum SvgUnit
    y = [ SvgUnit
    y ]
                     | Bool
    otherwise = SvgUnit
    x SvgUnit -> [SvgUnit] -> [SvgUnit]
    forall a. a -> [a] -> [a]
    : SvgUnit -> SvgUnit -> [SvgUnit]
    forall a. Enum a => a -> a -> [a]
    enumFromTo (SvgUnit -> SvgUnit
    forall a. Enum a => a -> a
    succ SvgUnit
    x) SvgUnit
    y
      enumFrom :: SvgUnit -> [SvgUnit]
    enumFrom SvgUnit
    x = SvgUnit -> SvgUnit -> [SvgUnit]
    forall a. Enum a => a -> a -> [a]
    enumFromTo SvgUnit
    x SvgUnit
    SvgUnitPercent
      enumFromThen :: SvgUnit -> SvgUnit -> [SvgUnit]
    enumFromThen SvgUnit
    _ SvgUnit
    _ =     String -> [SvgUnit]
    forall a. HasCallStack => String -> a
    error String
    "Enum SvgUnit: enumFromThen not implemented"
      enumFromThenTo :: SvgUnit -> SvgUnit -> SvgUnit -> [SvgUnit]
    enumFromThenTo SvgUnit
    _ SvgUnit
    _ SvgUnit
    _ =     String -> [SvgUnit]
    forall a. HasCallStack => String -> a
    error String
    "Enum SvgUnit: enumFromThenTo not implemented"

    {-# LINE 440 "./Graphics/Rendering/Cairo/Types.chs" #-}

    -- Marshalling functions

    {-# INLINE cIntConv #-}
    cIntConv :: (Integral a, Integral b) => a -> b
    cIntConv  = fromIntegral

    {-# INLINE cFloatConv #-}
    cFloatConv :: (RealFloat a, RealFloat b) => a -> b
    cFloatConv  = realToFrac

    {-# INLINE cFromBool #-}
    cFromBool :: Num a => Bool -> a
    cFromBool  = fromBool

    {-# INLINE cToBool #-}
    cToBool :: (Eq a, Num a) => a -> Bool
    cToBool  = toBool

    {-# INLINE cToEnum #-}
    cToEnum :: (Integral i, Enum e) => i -> e
    cToEnum  = toEnum . cIntConv

    {-# INLINE cFromEnum #-}
    cFromEnum :: (Enum e, Integral i) => e -> i
    cFromEnum  = cIntConv . fromEnum

    {-# INLINE peekFloatConv #-}
    peekFloatConv :: (Storable a, RealFloat a, RealFloat b) =>  Ptr a -> IO b
    peekFloatConv  = liftM cFloatConv . peek

    {-# INLINE withFloatConv #-}
    withFloatConv :: (Storable b, RealFloat a, RealFloat b) => a -> (Ptr b -> IO c) -> IO c
    withFloatConv  = with . cFloatConv

    {-# INLINE withArrayFloatConv #-}
    withArrayFloatConv :: (Storable b, RealFloat a, RealFloat b) => [a] -> (Ptr b -> IO b1) -> IO b1
    withArrayFloatConv = withArray . map (cFloatConv)

    {-# INLINE peekIntConv #-}
    peekIntConv :: (Storable a, Integral a, Integral b) =>  Ptr a -> IO b
    peekIntConv  = liftM cIntConv . peek

    foreign import ccall safe "dist-ghc/build/Graphics/Rendering/Cairo/Types.h cairo_pattern_reference"
      patternReference'_ :: ((Ptr Pattern) -> (IO (Ptr Pattern)))