    {-# LINE 1 "Graphics/UI/SDL/Types.hsc" #-}

    {-# LINE 5 "Graphics/UI/SDL/Types.hsc" #-}
    -----------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.UI.SDL.Types
    -- Copyright   :  (c) David Himmelstrup 2005
    -- License     :  BSD-like
    --
    -- Maintainer  :  lemmih@gmail.com
    -- Stability   :  provisional
    -- Portability :  portable
    --
    -----------------------------------------------------------------------------
    module Graphics.UI.SDL.Types
        ( SurfaceStruct
        , Surface
        , VideoInfoStruct
        , VideoInfo
        , RWopsStruct
        , RWops
        , PixelFormatStruct
        , PixelFormat
        , JoystickStruct
        , Joystick
        , Hat(..)
        , TimerIDStruct
        , SurfaceFlag (..)
        , surfaceGetPixelFormat
        , surfaceGetWidth
        , surfaceGetHeight
        , surfaceGetFlags
        , surfaceGetPitch
        , surfaceGetPixels
        , pixelFormatGetAlpha
        , pixelFormatGetColorKey
        , pixelFormatGetBitsPerPixel
        , pixelFormatGetBytesPerPixel
        , videoInfoWidth
        , videoInfoHeight
        ) where

    import Foreign.C (CInt)
    import Foreign (Word8, Word16, Word32, Ptr, Storable(peekByteOff),
                    newForeignPtr_, ForeignPtr, withForeignPtr)
    import System.IO.Unsafe (unsafePerformIO)

    import Graphics.UI.SDL.Utilities (Enum(..), fromBitmask)
    import Graphics.UI.SDL.Color (Pixel(..))

    import Prelude hiding (Enum(..))

    data SurfaceStruct
    type Surface = ForeignPtr SurfaceStruct

    data VideoInfoStruct
    type VideoInfo = ForeignPtr VideoInfoStruct

    data RWopsStruct
    type RWops = ForeignPtr RWopsStruct

    data PixelFormatStruct
    type PixelFormat = ForeignPtr PixelFormatStruct

    data TimerIDStruct

    data PixelsData
    type Pixels = Ptr PixelsData

    data JoystickStruct
    type Joystick = ForeignPtr JoystickStruct

    data Hat
        = HatCentered
        | HatUp
        | HatRight
        | HatDown
        | HatLeft
        | HatRightUp
        | HatRightDown
        | HatLeftUp
        | HatLeftDown
          deriving (Int -> Hat -> ShowS
    [Hat] -> ShowS
    Hat -> String
    (Int -> Hat -> ShowS)
    -> (Hat -> String) -> ([Hat] -> ShowS) -> Show Hat
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Hat -> ShowS
    showsPrec :: Int -> Hat -> ShowS
    $cshow :: Hat -> String
    show :: Hat -> String
    $cshowList :: [Hat] -> ShowS
    showList :: [Hat] -> ShowS
    Show,Hat -> Hat -> Bool
    (Hat -> Hat -> Bool) -> (Hat -> Hat -> Bool) -> Eq Hat
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Hat -> Hat -> Bool
    == :: Hat -> Hat -> Bool
    $c/= :: Hat -> Hat -> Bool
    /= :: Hat -> Hat -> Bool
    Eq,Eq Hat
    Eq Hat
    -> (Hat -> Hat -> Ordering)
    -> (Hat -> Hat -> Bool)
    -> (Hat -> Hat -> Bool)
    -> (Hat -> Hat -> Bool)
    -> (Hat -> Hat -> Bool)
    -> (Hat -> Hat -> Hat)
    -> (Hat -> Hat -> Hat)
    -> Ord Hat
    Hat -> Hat -> Bool
    Hat -> Hat -> Ordering
    Hat -> Hat -> Hat
    forall a.
    Eq a
    -> (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Hat -> Hat -> Ordering
    compare :: Hat -> Hat -> Ordering
    $c< :: Hat -> Hat -> Bool
    < :: Hat -> Hat -> Bool
    $c<= :: Hat -> Hat -> Bool
    <= :: Hat -> Hat -> Bool
    $c> :: Hat -> Hat -> Bool
    > :: Hat -> Hat -> Bool
    $c>= :: Hat -> Hat -> Bool
    >= :: Hat -> Hat -> Bool
    $cmax :: Hat -> Hat -> Hat
    max :: Hat -> Hat -> Hat
    $cmin :: Hat -> Hat -> Hat
    min :: Hat -> Hat -> Hat
    Ord)

    instance Bounded Hat where
        minBound :: Hat
    minBound = Hat
    HatCentered
        maxBound :: Hat
    maxBound = Hat
    HatLeftDown

    instance Enum Hat Word8 where
        fromEnum :: Hat -> Word8
    fromEnum Hat
    HatCentered = Word8
    0
    {-# LINE 92 "Graphics/UI/SDL/Types.hsc" #-}
        fromEnum HatUp = 1
    {-# LINE 93 "Graphics/UI/SDL/Types.hsc" #-}
        fromEnum HatRight = 2
    {-# LINE 94 "Graphics/UI/SDL/Types.hsc" #-}
        fromEnum HatDown = 4
    {-# LINE 95 "Graphics/UI/SDL/Types.hsc" #-}
        fromEnum HatLeft = 8
    {-# LINE 96 "Graphics/UI/SDL/Types.hsc" #-}
        fromEnum HatRightUp = 3
    {-# LINE 97 "Graphics/UI/SDL/Types.hsc" #-}
        fromEnum HatRightDown = 6
    {-# LINE 98 "Graphics/UI/SDL/Types.hsc" #-}
        fromEnum HatLeftUp = 9
    {-# LINE 99 "Graphics/UI/SDL/Types.hsc" #-}
        fromEnum HatLeftDown = 12
    {-# LINE 100 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum 0 = HatCentered
    {-# LINE 101 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum 1 = HatUp
    {-# LINE 102 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum 2 = HatRight
    {-# LINE 103 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum 4 = HatDown
    {-# LINE 104 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum 8 = HatLeft
    {-# LINE 105 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum 3 = HatRightUp
    {-# LINE 106 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum 6 = HatRightDown
    {-# LINE 107 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum 9 = HatLeftUp
    {-# LINE 108 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum 12 = HatLeftDown
    {-# LINE 109 "Graphics/UI/SDL/Types.hsc" #-}
        toEnum _ = error "Graphics.UI.SDL.Types.toEnum: bad argument"
        succ :: Hat -> Hat
    succ Hat
    HatCentered = Hat
    HatUp
        succ Hat
    HatUp = Hat
    HatRight
        succ Hat
    HatRight = Hat
    HatDown
        succ Hat
    HatDown = Hat
    HatLeft
        succ Hat
    HatLeft = Hat
    HatRightUp
        succ Hat
    HatRightUp = Hat
    HatRightDown
        succ Hat
    HatRightDown = Hat
    HatLeftUp
        succ Hat
    HatLeftUp = Hat
    HatLeftDown
        succ Hat
    _ = String -> Hat
    forall a. HasCallStack => String -> a
    error String
    "Graphics.UI.SDL.Types.succ: bad argument"
        pred :: Hat -> Hat
    pred Hat
    HatUp = Hat
    HatCentered
        pred Hat
    HatRight = Hat
    HatUp
        pred Hat
    HatDown = Hat
    HatRight
        pred Hat
    HatLeft = Hat
    HatDown
        pred Hat
    HatRightUp = Hat
    HatLeft
        pred Hat
    HatRightDown = Hat
    HatRightUp
        pred Hat
    HatLeftUp = Hat
    HatRightDown
        pred Hat
    HatLeftDown = Hat
    HatLeftUp
        pred Hat
    _ = String -> Hat
    forall a. HasCallStack => String -> a
    error String
    "Graphics.UI.SDL.Types.pred: bad argument"
        enumFromTo :: Hat -> Hat -> [Hat]
    enumFromTo Hat
    x Hat
    y | Hat
    x Hat -> Hat -> Bool
    forall a. Ord a => a -> a -> Bool
    > Hat
    y = []
                       | Hat
    x Hat -> Hat -> Bool
    forall a. Eq a => a -> a -> Bool
    == Hat
    y = [Hat
    y]
                       | Bool
    True = Hat
    x Hat -> [Hat] -> [Hat]
    forall a. a -> [a] -> [a]
    : Hat -> Hat -> [Hat]
    forall a b. Enum a b => a -> a -> [a]
    enumFromTo (Hat -> Hat
    forall a b. Enum a b => a -> a
    succ Hat
    x) Hat
    y

    data SurfaceFlag
        = SWSurface
        | HWSurface
        | OpenGL
        | ASyncBlit
        | OpenGLBlit
        | Resizable
        | NoFrame
        | HWAccel
        | SrcColorKey
        | RLEAccel
        | SrcAlpha
        | PreAlloc
        | AnyFormat
        | HWPalette
        | DoubleBuf
        | Fullscreen
        deriving (SurfaceFlag -> SurfaceFlag -> Bool
    (SurfaceFlag -> SurfaceFlag -> Bool)
    -> (SurfaceFlag -> SurfaceFlag -> Bool) -> Eq SurfaceFlag
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SurfaceFlag -> SurfaceFlag -> Bool
    == :: SurfaceFlag -> SurfaceFlag -> Bool
    $c/= :: SurfaceFlag -> SurfaceFlag -> Bool
    /= :: SurfaceFlag -> SurfaceFlag -> Bool
    Eq, Eq SurfaceFlag
    Eq SurfaceFlag
    -> (SurfaceFlag -> SurfaceFlag -> Ordering)
    -> (SurfaceFlag -> SurfaceFlag -> Bool)
    -> (SurfaceFlag -> SurfaceFlag -> Bool)
    -> (SurfaceFlag -> SurfaceFlag -> Bool)
    -> (SurfaceFlag -> SurfaceFlag -> Bool)
    -> (SurfaceFlag -> SurfaceFlag -> SurfaceFlag)
    -> (SurfaceFlag -> SurfaceFlag -> SurfaceFlag)
    -> Ord SurfaceFlag
    SurfaceFlag -> SurfaceFlag -> Bool
    SurfaceFlag -> SurfaceFlag -> Ordering
    SurfaceFlag -> SurfaceFlag -> SurfaceFlag
    forall a.
    Eq a
    -> (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: SurfaceFlag -> SurfaceFlag -> Ordering
    compare :: SurfaceFlag -> SurfaceFlag -> Ordering
    $c< :: SurfaceFlag -> SurfaceFlag -> Bool
    < :: SurfaceFlag -> SurfaceFlag -> Bool
    $c<= :: SurfaceFlag -> SurfaceFlag -> Bool
    <= :: SurfaceFlag -> SurfaceFlag -> Bool
    $c> :: SurfaceFlag -> SurfaceFlag -> Bool
    > :: SurfaceFlag -> SurfaceFlag -> Bool
    $c>= :: SurfaceFlag -> SurfaceFlag -> Bool
    >= :: SurfaceFlag -> SurfaceFlag -> Bool
    $cmax :: SurfaceFlag -> SurfaceFlag -> SurfaceFlag
    max :: SurfaceFlag -> SurfaceFlag -> SurfaceFlag
    $cmin :: SurfaceFlag -> SurfaceFlag -> SurfaceFlag
    min :: SurfaceFlag -> SurfaceFlag -> SurfaceFlag
    Ord, Int -> SurfaceFlag -> ShowS
    [SurfaceFlag] -> ShowS
    SurfaceFlag -> String
    (Int -> SurfaceFlag -> ShowS)
    -> (SurfaceFlag -> String)
    -> ([SurfaceFlag] -> ShowS)
    -> Show SurfaceFlag
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SurfaceFlag -> ShowS
    showsPrec :: Int -> SurfaceFlag -> ShowS
    $cshow :: SurfaceFlag -> String
    show :: SurfaceFlag -> String
    $cshowList :: [SurfaceFlag] -> ShowS
    showList :: [SurfaceFlag] -> ShowS
    Show, ReadPrec [SurfaceFlag]
    ReadPrec SurfaceFlag
    Int -> ReadS SurfaceFlag
    ReadS [SurfaceFlag]
    (Int -> ReadS SurfaceFlag)
    -> ReadS [SurfaceFlag]
    -> ReadPrec SurfaceFlag
    -> ReadPrec [SurfaceFlag]
    -> Read SurfaceFlag
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS SurfaceFlag
    readsPrec :: Int -> ReadS SurfaceFlag
    $creadList :: ReadS [SurfaceFlag]
    readList :: ReadS [SurfaceFlag]
    $creadPrec :: ReadPrec SurfaceFlag
    readPrec :: ReadPrec SurfaceFlag
    $creadListPrec :: ReadPrec [SurfaceFlag]
    readListPrec :: ReadPrec [SurfaceFlag]
    Read)
    instance Bounded SurfaceFlag where
          minBound :: SurfaceFlag
    minBound = SurfaceFlag
    SWSurface
          maxBound :: SurfaceFlag
    maxBound = SurfaceFlag
    Fullscreen
    instance Enum SurfaceFlag Word32 where
          fromEnum :: SurfaceFlag -> Word32
    fromEnum SurfaceFlag
    SWSurface = Word32
    0
          fromEnum SurfaceFlag
    HWSurface = Word32
    1
          fromEnum SurfaceFlag
    OpenGL    = Word32
    2
          fromEnum SurfaceFlag
    ASyncBlit = Word32
    4
          fromEnum SurfaceFlag
    OpenGLBlit = Word32
    10
          fromEnum SurfaceFlag
    Resizable = Word32
    16
          fromEnum SurfaceFlag
    NoFrame = Word32
    32
          fromEnum SurfaceFlag
    HWAccel = Word32
    256
          fromEnum SurfaceFlag
    SrcColorKey = Word32
    4096
          fromEnum SurfaceFlag
    RLEAccel = Word32
    16384
          fromEnum SurfaceFlag
    SrcAlpha = Word32
    65536
          fromEnum SurfaceFlag
    PreAlloc = Word32
    16777216
          fromEnum SurfaceFlag
    AnyFormat = Word32
    268435456
          fromEnum SurfaceFlag
    HWPalette = Word32
    536870912
          fromEnum SurfaceFlag
    DoubleBuf = Word32
    1073741824
          fromEnum SurfaceFlag
    Fullscreen = Word32
    2147483648
          toEnum :: Word32 -> SurfaceFlag
    toEnum Word32
    0 = SurfaceFlag
    SWSurface
          toEnum Word32
    1 = SurfaceFlag
    HWSurface
          toEnum Word32
    4 = SurfaceFlag
    ASyncBlit
          toEnum Word32
    2 = SurfaceFlag
    OpenGL
          toEnum Word32
    10 = SurfaceFlag
    OpenGLBlit
          toEnum Word32
    16 = SurfaceFlag
    Resizable
          toEnum Word32
    32 = SurfaceFlag
    NoFrame
          toEnum Word32
    256 = SurfaceFlag
    HWAccel
          toEnum Word32
    4096 = SurfaceFlag
    SrcColorKey
          toEnum Word32
    16384 = SurfaceFlag
    RLEAccel
          toEnum Word32
    65536 = SurfaceFlag
    SrcAlpha
          toEnum Word32
    16777216 = SurfaceFlag
    PreAlloc
          toEnum Word32
    268435456 = SurfaceFlag
    AnyFormat
          toEnum Word32
    536870912 = SurfaceFlag
    HWPalette
          toEnum Word32
    1073741824 = SurfaceFlag
    DoubleBuf
          toEnum Word32
    2147483648 = SurfaceFlag
    Fullscreen
          toEnum Word32
    _ = String -> SurfaceFlag
    forall a. HasCallStack => String -> a
    error String
    "Graphics.UI.SDL.Types.fromEnum: bad argument"
          succ :: SurfaceFlag -> SurfaceFlag
    succ SurfaceFlag
    SWSurface = SurfaceFlag
    HWSurface
          succ SurfaceFlag
    HWSurface = SurfaceFlag
    OpenGL
          succ SurfaceFlag
    OpenGL = SurfaceFlag
    ASyncBlit
          succ SurfaceFlag
    ASyncBlit = SurfaceFlag
    OpenGLBlit
          succ SurfaceFlag
    OpenGLBlit = SurfaceFlag
    Resizable
          succ SurfaceFlag
    Resizable = SurfaceFlag
    NoFrame
          succ SurfaceFlag
    NoFrame = SurfaceFlag
    HWAccel
          succ SurfaceFlag
    HWAccel = SurfaceFlag
    SrcColorKey
          succ SurfaceFlag
    SrcColorKey = SurfaceFlag
    RLEAccel
          succ SurfaceFlag
    RLEAccel = SurfaceFlag
    SrcAlpha
          succ SurfaceFlag
    SrcAlpha = SurfaceFlag
    PreAlloc
          succ SurfaceFlag
    PreAlloc = SurfaceFlag
    AnyFormat
          succ SurfaceFlag
    AnyFormat = SurfaceFlag
    HWPalette
          succ SurfaceFlag
    HWPalette = SurfaceFlag
    DoubleBuf
          succ SurfaceFlag
    DoubleBuf = SurfaceFlag
    Fullscreen
          succ SurfaceFlag
    _ = String -> SurfaceFlag
    forall a. HasCallStack => String -> a
    error String
    "Graphics.UI.SDL.Types.succ: bad argument"

          pred :: SurfaceFlag -> SurfaceFlag
    pred SurfaceFlag
    HWSurface = SurfaceFlag
    SWSurface
          pred SurfaceFlag
    OpenGL = SurfaceFlag
    HWSurface
          pred SurfaceFlag
    ASyncBlit = SurfaceFlag
    OpenGL
          pred SurfaceFlag
    OpenGLBlit = SurfaceFlag
    ASyncBlit
          pred SurfaceFlag
    Resizable = SurfaceFlag
    OpenGLBlit
          pred SurfaceFlag
    NoFrame = SurfaceFlag
    Resizable
          pred SurfaceFlag
    HWAccel = SurfaceFlag
    NoFrame
          pred SurfaceFlag
    SrcColorKey = SurfaceFlag
    HWAccel
          pred SurfaceFlag
    RLEAccel = SurfaceFlag
    SrcColorKey
          pred SurfaceFlag
    SrcAlpha = SurfaceFlag
    RLEAccel
          pred SurfaceFlag
    PreAlloc = SurfaceFlag
    SrcAlpha
          pred SurfaceFlag
    AnyFormat = SurfaceFlag
    PreAlloc
          pred SurfaceFlag
    HWPalette = SurfaceFlag
    AnyFormat
          pred SurfaceFlag
    DoubleBuf = SurfaceFlag
    HWPalette
          pred SurfaceFlag
    Fullscreen = SurfaceFlag
    DoubleBuf
          pred SurfaceFlag
    _ = String -> SurfaceFlag
    forall a. HasCallStack => String -> a
    error String
    "Graphics.UI.SDL.Types.pred: bad argument"

          enumFromTo :: SurfaceFlag -> SurfaceFlag -> [SurfaceFlag]
    enumFromTo SurfaceFlag
    x SurfaceFlag
    y | SurfaceFlag
    x SurfaceFlag -> SurfaceFlag -> Bool
    forall a. Ord a => a -> a -> Bool
    > SurfaceFlag
    y = []
                         | SurfaceFlag
    x SurfaceFlag -> SurfaceFlag -> Bool
    forall a. Eq a => a -> a -> Bool
    == SurfaceFlag
    y = [SurfaceFlag
    y]
                         | Bool
    True = SurfaceFlag
    x SurfaceFlag -> [SurfaceFlag] -> [SurfaceFlag]
    forall a. a -> [a] -> [a]
    : SurfaceFlag -> SurfaceFlag -> [SurfaceFlag]
    forall a b. Enum a b => a -> a -> [a]
    enumFromTo (SurfaceFlag -> SurfaceFlag
    forall a b. Enum a b => a -> a
    succ SurfaceFlag
    x) SurfaceFlag
    y

    surfaceGetPixelFormat :: Surface -> PixelFormat
    surfaceGetPixelFormat :: Surface -> PixelFormat
    surfaceGetPixelFormat Surface
    surface
        = IO PixelFormat -> PixelFormat
    forall a. IO a -> a
    unsafePerformIO (IO PixelFormat -> PixelFormat) -> IO PixelFormat -> PixelFormat
    forall a b. (a -> b) -> a -> b
    $
          Surface -> (Ptr SurfaceStruct -> IO PixelFormat) -> IO PixelFormat
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr Surface
    surface ((Ptr SurfaceStruct -> IO PixelFormat) -> IO PixelFormat)
    -> (Ptr SurfaceStruct -> IO PixelFormat) -> IO PixelFormat
    forall a b. (a -> b) -> a -> b
    $ \Ptr SurfaceStruct
    ptr ->
          Ptr PixelFormatStruct -> IO PixelFormat
    forall a. Ptr a -> IO (ForeignPtr a)
    newForeignPtr_ (Ptr PixelFormatStruct -> IO PixelFormat)
    -> IO (Ptr PixelFormatStruct) -> IO PixelFormat
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< (\Ptr SurfaceStruct
    hsc_ptr -> Ptr SurfaceStruct -> Int -> IO (Ptr PixelFormatStruct)
    forall b. Ptr b -> Int -> IO (Ptr PixelFormatStruct)
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr SurfaceStruct
    hsc_ptr Int
    8) Ptr SurfaceStruct
    ptr
    {-# LINE 232 "Graphics/UI/SDL/Types.hsc" #-}

    pixelFormatGetAlpha :: PixelFormat -> IO Word8
    pixelFormatGetAlpha :: PixelFormat -> IO Word8
    pixelFormatGetAlpha PixelFormat
    format =
        PixelFormat -> (Ptr PixelFormatStruct -> IO Word8) -> IO Word8
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr PixelFormat
    format ((Ptr PixelFormatStruct -> IO Word8) -> IO Word8)
    -> (Ptr PixelFormatStruct -> IO Word8) -> IO Word8
    forall a b. (a -> b) -> a -> b
    $
        (\Ptr PixelFormatStruct
    hsc_ptr -> Ptr PixelFormatStruct -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr PixelFormatStruct
    hsc_ptr Int
    40)
    {-# LINE 237 "Graphics/UI/SDL/Types.hsc" #-}

    pixelFormatGetColorKey :: PixelFormat -> IO Pixel
    pixelFormatGetColorKey :: PixelFormat -> IO Pixel
    pixelFormatGetColorKey PixelFormat
    format =
        (Word32 -> Pixel) -> IO Word32 -> IO Pixel
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Word32 -> Pixel
    Pixel (IO Word32 -> IO Pixel) -> IO Word32 -> IO Pixel
    forall a b. (a -> b) -> a -> b
    $
        PixelFormat -> (Ptr PixelFormatStruct -> IO Word32) -> IO Word32
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr PixelFormat
    format ((Ptr PixelFormatStruct -> IO Word32) -> IO Word32)
    -> (Ptr PixelFormatStruct -> IO Word32) -> IO Word32
    forall a b. (a -> b) -> a -> b
    $
        (\Ptr PixelFormatStruct
    hsc_ptr -> Ptr PixelFormatStruct -> Int -> IO Word32
    forall b. Ptr b -> Int -> IO Word32
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr PixelFormatStruct
    hsc_ptr Int
    36)
    {-# LINE 243 "Graphics/UI/SDL/Types.hsc" #-}

    pixelFormatGetBitsPerPixel :: PixelFormat -> IO Word8
    pixelFormatGetBitsPerPixel :: PixelFormat -> IO Word8
    pixelFormatGetBitsPerPixel PixelFormat
    format
        = PixelFormat -> (Ptr PixelFormatStruct -> IO Word8) -> IO Word8
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr PixelFormat
    format ((Ptr PixelFormatStruct -> IO Word8) -> IO Word8)
    -> (Ptr PixelFormatStruct -> IO Word8) -> IO Word8
    forall a b. (a -> b) -> a -> b
    $
          (\Ptr PixelFormatStruct
    hsc_ptr -> Ptr PixelFormatStruct -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr PixelFormatStruct
    hsc_ptr Int
    8)
    {-# LINE 248 "Graphics/UI/SDL/Types.hsc" #-}

    pixelFormatGetBytesPerPixel :: PixelFormat -> IO Word8
    pixelFormatGetBytesPerPixel :: PixelFormat -> IO Word8
    pixelFormatGetBytesPerPixel PixelFormat
    format
        = PixelFormat -> (Ptr PixelFormatStruct -> IO Word8) -> IO Word8
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr PixelFormat
    format ((Ptr PixelFormatStruct -> IO Word8) -> IO Word8)
    -> (Ptr PixelFormatStruct -> IO Word8) -> IO Word8
    forall a b. (a -> b) -> a -> b
    $
          (\Ptr PixelFormatStruct
    hsc_ptr -> Ptr PixelFormatStruct -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr PixelFormatStruct
    hsc_ptr Int
    9)
    {-# LINE 253 "Graphics/UI/SDL/Types.hsc" #-}

    cintToInt :: CInt -> Int
    cintToInt :: CInt -> Int
    cintToInt = CInt -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral

    surfaceGetWidth :: Surface -> Int
    surfaceGetWidth :: Surface -> Int
    surfaceGetWidth Surface
    surface
        = CInt -> Int
    cintToInt (CInt -> Int) -> CInt -> Int
    forall a b. (a -> b) -> a -> b
    $ IO CInt -> CInt
    forall a. IO a -> a
    unsafePerformIO (IO CInt -> CInt) -> IO CInt -> CInt
    forall a b. (a -> b) -> a -> b
    $
          Surface -> (Ptr SurfaceStruct -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr Surface
    surface ((Ptr SurfaceStruct -> IO CInt) -> IO CInt)
    -> (Ptr SurfaceStruct -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $
          (\Ptr SurfaceStruct
    hsc_ptr -> Ptr SurfaceStruct -> Int -> IO CInt
    forall b. Ptr b -> Int -> IO CInt
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr SurfaceStruct
    hsc_ptr Int
    16)
    {-# LINE 262 "Graphics/UI/SDL/Types.hsc" #-}

    surfaceGetHeight :: Surface -> Int
    surfaceGetHeight :: Surface -> Int
    surfaceGetHeight Surface
    surface
        = CInt -> Int
    cintToInt (CInt -> Int) -> CInt -> Int
    forall a b. (a -> b) -> a -> b
    $ IO CInt -> CInt
    forall a. IO a -> a
    unsafePerformIO (IO CInt -> CInt) -> IO CInt -> CInt
    forall a b. (a -> b) -> a -> b
    $
          Surface -> (Ptr SurfaceStruct -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr Surface
    surface ((Ptr SurfaceStruct -> IO CInt) -> IO CInt)
    -> (Ptr SurfaceStruct -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $
          (\Ptr SurfaceStruct
    hsc_ptr -> Ptr SurfaceStruct -> Int -> IO CInt
    forall b. Ptr b -> Int -> IO CInt
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr SurfaceStruct
    hsc_ptr Int
    20)
    {-# LINE 268 "Graphics/UI/SDL/Types.hsc" #-}

    surfaceGetFlags :: Surface -> IO [SurfaceFlag]
    surfaceGetFlags :: Surface -> IO [SurfaceFlag]
    surfaceGetFlags Surface
    surface
        = Surface
    -> (Ptr SurfaceStruct -> IO [SurfaceFlag]) -> IO [SurfaceFlag]
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr Surface
    surface ((Ptr SurfaceStruct -> IO [SurfaceFlag]) -> IO [SurfaceFlag])
    -> (Ptr SurfaceStruct -> IO [SurfaceFlag]) -> IO [SurfaceFlag]
    forall a b. (a -> b) -> a -> b
    $
          (Word32 -> [SurfaceFlag]) -> IO Word32 -> IO [SurfaceFlag]
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Word32 -> [SurfaceFlag]
    forall a b. (Bounded a, Enum a b, Bits b, Num b) => b -> [a]
    fromBitmask (IO Word32 -> IO [SurfaceFlag])
    -> (Ptr SurfaceStruct -> IO Word32)
    -> Ptr SurfaceStruct
    -> IO [SurfaceFlag]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (\Ptr SurfaceStruct
    hsc_ptr -> Ptr SurfaceStruct -> Int -> IO Word32
    forall b. Ptr b -> Int -> IO Word32
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr SurfaceStruct
    hsc_ptr Int
    0)
    {-# LINE 273 "Graphics/UI/SDL/Types.hsc" #-}

    surfaceGetPitch :: Surface -> Word16
    surfaceGetPitch :: Surface -> Word16
    surfaceGetPitch Surface
    surface
        = IO Word16 -> Word16
    forall a. IO a -> a
    unsafePerformIO (IO Word16 -> Word16) -> IO Word16 -> Word16
    forall a b. (a -> b) -> a -> b
    $
          Surface -> (Ptr SurfaceStruct -> IO Word16) -> IO Word16
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr Surface
    surface ((Ptr SurfaceStruct -> IO Word16) -> IO Word16)
    -> (Ptr SurfaceStruct -> IO Word16) -> IO Word16
    forall a b. (a -> b) -> a -> b
    $
          (\Ptr SurfaceStruct
    hsc_ptr -> Ptr SurfaceStruct -> Int -> IO Word16
    forall b. Ptr b -> Int -> IO Word16
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr SurfaceStruct
    hsc_ptr Int
    24)
    {-# LINE 279 "Graphics/UI/SDL/Types.hsc" #-}

    surfaceGetPixels :: Surface -> IO Pixels
    surfaceGetPixels :: Surface -> IO Pixels
    surfaceGetPixels Surface
    surface
        = Surface -> (Ptr SurfaceStruct -> IO Pixels) -> IO Pixels
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr Surface
    surface ((Ptr SurfaceStruct -> IO Pixels) -> IO Pixels)
    -> (Ptr SurfaceStruct -> IO Pixels) -> IO Pixels
    forall a b. (a -> b) -> a -> b
    $
          (\Ptr SurfaceStruct
    hsc_ptr -> Ptr SurfaceStruct -> Int -> IO Pixels
    forall b. Ptr b -> Int -> IO Pixels
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr SurfaceStruct
    hsc_ptr Int
    32)
    {-# LINE 284 "Graphics/UI/SDL/Types.hsc" #-}

    videoInfoWidth :: VideoInfo -> Int
    videoInfoWidth :: VideoInfo -> Int
    videoInfoWidth VideoInfo
    vi
        = CInt -> Int
    cintToInt (CInt -> Int) -> CInt -> Int
    forall a b. (a -> b) -> a -> b
    $ IO CInt -> CInt
    forall a. IO a -> a
    unsafePerformIO (IO CInt -> CInt) -> IO CInt -> CInt
    forall a b. (a -> b) -> a -> b
    $
          VideoInfo -> (Ptr VideoInfoStruct -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr VideoInfo
    vi ((Ptr VideoInfoStruct -> IO CInt) -> IO CInt)
    -> (Ptr VideoInfoStruct -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $
          (\Ptr VideoInfoStruct
    hsc_ptr -> Ptr VideoInfoStruct -> Int -> IO CInt
    forall b. Ptr b -> Int -> IO CInt
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr VideoInfoStruct
    hsc_ptr Int
    16)
    {-# LINE 290 "Graphics/UI/SDL/Types.hsc" #-}

    videoInfoHeight :: VideoInfo -> Int
    videoInfoHeight :: VideoInfo -> Int
    videoInfoHeight VideoInfo
    vi
        = CInt -> Int
    cintToInt (CInt -> Int) -> CInt -> Int
    forall a b. (a -> b) -> a -> b
    $ IO CInt -> CInt
    forall a. IO a -> a
    unsafePerformIO (IO CInt -> CInt) -> IO CInt -> CInt
    forall a b. (a -> b) -> a -> b
    $
          VideoInfo -> (Ptr VideoInfoStruct -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr VideoInfo
    vi ((Ptr VideoInfoStruct -> IO CInt) -> IO CInt)
    -> (Ptr VideoInfoStruct -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $
          (\Ptr VideoInfoStruct
    hsc_ptr -> Ptr VideoInfoStruct -> Int -> IO CInt
    forall b. Ptr b -> Int -> IO CInt
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr VideoInfoStruct
    hsc_ptr Int
    20)
    {-# LINE 296 "Graphics/UI/SDL/Types.hsc" #-}