{-# LINE 1 "Graphics/X11/Xrender.hsc" #-}
-----------------------------------------------------------------------------
-- Module      :  Graphics.X11.Xrender
-- Copyright   :  Clemens Fruhwirth <clemens@endorphin.org> 2007
--
-- Haskell bindings for the Xrender extension.
--
-----------------------------------------------------------------------------

module Graphics.X11.Xrender (
  peekCUShort,
  pokeCUShort,
  peekCShort,
  pokeCShort,
  XRenderColor (..),
  XGlyphInfo (..),
  XRenderDirectFormat (..),
) where

import Foreign
import Foreign.C



peekCUShort :: Ptr a -> CInt -> IO Int
peekCUShort :: forall a. Ptr a -> CInt -> IO Int
peekCUShort Ptr a
ptr CInt
off = do
        CUShort
v <- forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr a
ptr (forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
off)
        forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUShort
v::CUShort))

pokeCUShort :: Ptr a -> CInt -> Int -> IO ()
pokeCUShort :: forall a. Ptr a -> CInt -> Int -> IO ()
pokeCUShort Ptr a
ptr CInt
off Int
v =
        forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr a
ptr (forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
off) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
v::CUShort)

peekCShort :: Ptr a -> CInt -> IO Int
peekCShort :: forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr a
ptr CInt
off = do
        CShort
v <- forall a b. Storable a => Ptr b -> Int -> IO a
peekByteOff Ptr a
ptr (forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
off)
        forall (m :: * -> *) a. Monad m => a -> m a
return (forall a b. (Integral a, Num b) => a -> b
fromIntegral (CShort
v::CShort))

pokeCShort :: Ptr a -> CInt -> Int -> IO ()
pokeCShort :: forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr a
ptr CInt
off Int
v =
        forall a b. Storable a => Ptr b -> Int -> a -> IO ()
pokeByteOff Ptr a
ptr (forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
off) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
v::CShort)

data XRenderColor = XRenderColor {
      XRenderColor -> Int
xrendercolor_red   :: Int,
      XRenderColor -> Int
xrendercolor_green :: Int,
      XRenderColor -> Int
xrendercolor_blue  :: Int,
      XRenderColor -> Int
xrendercolor_alpha :: Int
}

instance Storable XRenderColor where
        sizeOf :: XRenderColor -> Int
sizeOf XRenderColor
_ = (Int
8)
{-# LINE 51 "Graphics/X11/Xrender.hsc" #-}
        alignment :: XRenderColor -> Int
alignment XRenderColor
_ = forall a. Storable a => a -> Int
alignment (forall a. HasCallStack => a
undefined::CInt)
        peek :: Ptr XRenderColor -> IO XRenderColor
peek Ptr XRenderColor
p = do
                Int
red   <- forall a. Ptr a -> CInt -> IO Int
peekCUShort Ptr XRenderColor
p (CInt
0)
{-# LINE 54 "Graphics/X11/Xrender.hsc" #-}
                Int
green <- forall a. Ptr a -> CInt -> IO Int
peekCUShort Ptr XRenderColor
p (CInt
2)
{-# LINE 55 "Graphics/X11/Xrender.hsc" #-}
                Int
blue  <- forall a. Ptr a -> CInt -> IO Int
peekCUShort Ptr XRenderColor
p (CInt
4)
{-# LINE 56 "Graphics/X11/Xrender.hsc" #-}
                Int
alpha <- forall a. Ptr a -> CInt -> IO Int
peekCUShort Ptr XRenderColor
p (CInt
6)
{-# LINE 57 "Graphics/X11/Xrender.hsc" #-}
                forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Int -> Int -> Int -> XRenderColor
XRenderColor Int
red Int
green Int
blue Int
alpha)
        poke :: Ptr XRenderColor -> XRenderColor -> IO ()
poke Ptr XRenderColor
p (XRenderColor Int
red Int
green Int
blue Int
alpha) = do
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCUShort Ptr XRenderColor
p (CInt
0) Int
red
{-# LINE 60 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCUShort Ptr XRenderColor
p (CInt
2) Int
green
{-# LINE 61 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCUShort Ptr XRenderColor
p (CInt
4) Int
blue
{-# LINE 62 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCUShort Ptr XRenderColor
p (CInt
6) Int
alpha
{-# LINE 63 "Graphics/X11/Xrender.hsc" #-}

data XGlyphInfo = XGlyphInfo {
      XGlyphInfo -> Int
xglyphinfo_width  :: Int,
      XGlyphInfo -> Int
xglyphinfo_height :: Int,
      XGlyphInfo -> Int
xglyphinfo_x      :: Int,
      XGlyphInfo -> Int
xglyphinfo_y      :: Int,
      XGlyphInfo -> Int
xglyphinfo_xOff   :: Int,
      XGlyphInfo -> Int
xglyphinfo_yOff   :: Int
}

instance Storable XGlyphInfo where
        sizeOf :: XGlyphInfo -> Int
sizeOf XGlyphInfo
_ = (Int
12)
{-# LINE 75 "Graphics/X11/Xrender.hsc" #-}
        alignment :: XGlyphInfo -> Int
alignment XGlyphInfo
_ = forall a. Storable a => a -> Int
alignment (forall a. HasCallStack => a
undefined::CInt)
        peek :: Ptr XGlyphInfo -> IO XGlyphInfo
peek Ptr XGlyphInfo
p = do
                Int
width  <- forall a. Ptr a -> CInt -> IO Int
peekCUShort Ptr XGlyphInfo
p (CInt
0)
{-# LINE 78 "Graphics/X11/Xrender.hsc" #-}
                Int
height <- forall a. Ptr a -> CInt -> IO Int
peekCUShort Ptr XGlyphInfo
p (CInt
2)
{-# LINE 79 "Graphics/X11/Xrender.hsc" #-}
                Int
x <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XGlyphInfo
p (CInt
4)
{-# LINE 80 "Graphics/X11/Xrender.hsc" #-}
                Int
y <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XGlyphInfo
p (CInt
6)
{-# LINE 81 "Graphics/X11/Xrender.hsc" #-}
                Int
xOff <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XGlyphInfo
p (CInt
8)
{-# LINE 82 "Graphics/X11/Xrender.hsc" #-}
                Int
yOff <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XGlyphInfo
p (CInt
10)
{-# LINE 83 "Graphics/X11/Xrender.hsc" #-}
                forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Int -> Int -> Int -> Int -> Int -> XGlyphInfo
XGlyphInfo Int
width Int
height Int
x Int
y Int
xOff Int
yOff)
        poke :: Ptr XGlyphInfo -> XGlyphInfo -> IO ()
poke Ptr XGlyphInfo
p (XGlyphInfo Int
width Int
height Int
x Int
y Int
xOff Int
yOff) = do
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCUShort Ptr XGlyphInfo
p (CInt
0) Int
width
{-# LINE 86 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCUShort Ptr XGlyphInfo
p (CInt
2) Int
height
{-# LINE 87 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XGlyphInfo
p (CInt
4) Int
x
{-# LINE 88 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XGlyphInfo
p (CInt
6) Int
y
{-# LINE 89 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XGlyphInfo
p (CInt
8) Int
xOff
{-# LINE 90 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XGlyphInfo
p (CInt
10) Int
yOff
{-# LINE 91 "Graphics/X11/Xrender.hsc" #-}


data XRenderDirectFormat = XRenderDirectFormat {
     XRenderDirectFormat -> Int
xrenderdirectformat_red       :: Int,
     XRenderDirectFormat -> Int
xrenderdirectformat_redMask   :: Int,
     XRenderDirectFormat -> Int
xrenderdirectformat_green     :: Int,
     XRenderDirectFormat -> Int
xrenderdirectformat_greenMask :: Int,
     XRenderDirectFormat -> Int
xrenderdirectformat_blue      :: Int,
     XRenderDirectFormat -> Int
xrenderdirectformat_blueMask  :: Int,
     XRenderDirectFormat -> Int
xrenderdirectformat_alpha     :: Int,
     XRenderDirectFormat -> Int
xrenderdirectformat_alphaMask :: Int
}

instance Storable XRenderDirectFormat where
        sizeOf :: XRenderDirectFormat -> Int
sizeOf XRenderDirectFormat
_ = (Int
16)
{-# LINE 106 "Graphics/X11/Xrender.hsc" #-}
        alignment :: XRenderDirectFormat -> Int
alignment XRenderDirectFormat
_ = forall a. Storable a => a -> Int
alignment (forall a. HasCallStack => a
undefined::CInt)
        peek :: Ptr XRenderDirectFormat -> IO XRenderDirectFormat
peek Ptr XRenderDirectFormat
p = do
                Int
red  <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XRenderDirectFormat
p (CInt
0)
{-# LINE 109 "Graphics/X11/Xrender.hsc" #-}
                Int
redMask  <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XRenderDirectFormat
p (CInt
2)
{-# LINE 110 "Graphics/X11/Xrender.hsc" #-}
                Int
green  <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XRenderDirectFormat
p (CInt
4)
{-# LINE 111 "Graphics/X11/Xrender.hsc" #-}
                Int
greenMask  <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XRenderDirectFormat
p (CInt
6)
{-# LINE 112 "Graphics/X11/Xrender.hsc" #-}
                Int
blue  <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XRenderDirectFormat
p (CInt
8)
{-# LINE 113 "Graphics/X11/Xrender.hsc" #-}
                Int
blueMask  <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XRenderDirectFormat
p (CInt
10)
{-# LINE 114 "Graphics/X11/Xrender.hsc" #-}
                Int
alpha  <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XRenderDirectFormat
p (CInt
12)
{-# LINE 115 "Graphics/X11/Xrender.hsc" #-}
                Int
alphaMask  <- forall a. Ptr a -> CInt -> IO Int
peekCShort Ptr XRenderDirectFormat
p (CInt
14)
{-# LINE 116 "Graphics/X11/Xrender.hsc" #-}
                forall (m :: * -> *) a. Monad m => a -> m a
return (Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> Int
-> XRenderDirectFormat
XRenderDirectFormat Int
red Int
redMask Int
green Int
greenMask Int
blue Int
blueMask Int
alpha Int
alphaMask)
        poke :: Ptr XRenderDirectFormat -> XRenderDirectFormat -> IO ()
poke Ptr XRenderDirectFormat
p (XRenderDirectFormat Int
red Int
redMask Int
green Int
greenMask Int
blue Int
blueMask Int
alpha Int
alphaMask) = do
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XRenderDirectFormat
p (CInt
0) Int
red
{-# LINE 119 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XRenderDirectFormat
p (CInt
2) Int
redMask
{-# LINE 120 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XRenderDirectFormat
p (CInt
8) Int
blue
{-# LINE 121 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XRenderDirectFormat
p (CInt
10) Int
blueMask
{-# LINE 122 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XRenderDirectFormat
p (CInt
4) Int
green
{-# LINE 123 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XRenderDirectFormat
p (CInt
6) Int
greenMask
{-# LINE 124 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XRenderDirectFormat
p (CInt
12) Int
alpha
{-# LINE 125 "Graphics/X11/Xrender.hsc" #-}
                forall a. Ptr a -> CInt -> Int -> IO ()
pokeCShort Ptr XRenderDirectFormat
p (CInt
14) Int
alphaMask
{-# LINE 126 "Graphics/X11/Xrender.hsc" #-}