-- GENERATED by C->Haskell Compiler, version 0.18.2 The shapeless maps, 31 Oct 2014 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Bitmap
 (
  bitmapNew
 )
where



import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import Foreign.C.Types
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Utils
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Dispatch

flBitmapNew' :: (Ptr CChar) -> (Int) -> (Int) -> IO ((Ptr ()))
flBitmapNew' a1 a2 a3 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  flBitmapNew''_ a1' a2' a3' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 19 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

bitmapNew :: BitmapHs -> IO (Ref Bitmap)
bitmapNew bitmap = withBitmap bitmap (\ptr width' height' -> flBitmapNew' ptr width' height' >>= toRef)
flBitmapDestroy' :: (Ptr ()) -> IO ((()))
flBitmapDestroy' a1 =
  let {a1' = id a1} in 
  flBitmapDestroy''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 22 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ (IO ())) => Op (Destroy ()) Bitmap orig impl where
  runOp _ _ bitmap = withRef bitmap $ \bitmapPtr -> flBitmapDestroy' bitmapPtr
w' :: (Ptr ()) -> IO ((Int))
w' a1 =
  let {a1' = id a1} in 
  w''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 25 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ ( IO (Int))) => Op (GetW ()) Bitmap orig impl where
  runOp _ _ bitmap = withRef bitmap $ \bitmapPtr -> w' bitmapPtr
h' :: (Ptr ()) -> IO ((Int))
h' a1 =
  let {a1' = id a1} in 
  h''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 28 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ ( IO (Int))) => Op (GetH ()) Bitmap orig impl where
  runOp _ _ bitmap = withRef bitmap $ \bitmapPtr -> h' bitmapPtr
d' :: (Ptr ()) -> IO ((Int))
d' a1 =
  let {a1' = id a1} in 
  d''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 31 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ ( IO (Int))) => Op (GetD ()) Bitmap orig impl where
  runOp _ _ bitmap = withRef bitmap $ \bitmapPtr -> d' bitmapPtr
ld' :: (Ptr ()) -> IO ((Int))
ld' a1 =
  let {a1' = id a1} in 
  ld''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 34 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ ( IO (Int))) => Op (GetLd ()) Bitmap orig impl where
  runOp _ _ bitmap = withRef bitmap $ \bitmapPtr -> ld' bitmapPtr
count' :: (Ptr ()) -> IO ((Int))
count' a1 =
  let {a1' = id a1} in 
  count''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 37 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ ( IO (Int))) => Op (GetCount ()) Bitmap orig impl where
  runOp _ _ bitmap = withRef bitmap $ \bitmapPtr -> count' bitmapPtr
copyWithWH' :: (Ptr ()) -> (Int) -> (Int) -> IO ((Ptr ()))
copyWithWH' a1 a2 a3 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  copyWithWH''_ a1' a2' a3' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 40 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

copy' :: (Ptr ()) -> IO ((Ptr ()))
copy' a1 =
  let {a1' = id a1} in 
  copy''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 41 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ ( Maybe Size -> IO (Ref Bitmap))) => Op (Copy ()) Bitmap orig impl where
  runOp _ _ bitmap size' = case size' of
    Just (Size (Width w) (Height h)) -> withRef bitmap $ \bitmapPtr -> copyWithWH' bitmapPtr w h >>= toRef
    Nothing -> withRef bitmap $ \bitmapPtr -> copy' bitmapPtr >>= toRef
colorAverage' :: (Ptr ()) -> (Color) -> (Float) -> IO ()
colorAverage' a1 a2 a3 =
  let {a1' = id a1} in 
  let {a2' = cFromColor a2} in 
  let {a3' = realToFrac a3} in 
  colorAverage''_ a1' a2' a3' >>
  return ()

{-# LINE 46 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ (Color -> Float ->  IO ())) => Op (ColorAverage ()) Bitmap orig impl where
  runOp _ _ bitmap c i = withRef bitmap $ \bitmapPtr -> colorAverage' bitmapPtr c i
inactive' :: (Ptr ()) -> IO ()
inactive' a1 =
  let {a1' = id a1} in 
  inactive''_ a1' >>
  return ()

{-# LINE 49 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ ( IO ())) => Op (Inactive ()) Bitmap orig impl where
  runOp _ _ bitmap = withRef bitmap $ \bitmapPtr -> inactive' bitmapPtr
desaturate' :: (Ptr ()) -> IO ()
desaturate' a1 =
  let {a1' = id a1} in 
  desaturate''_ a1' >>
  return ()

{-# LINE 52 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ ( IO ())) => Op (Desaturate ()) Bitmap orig impl where
  runOp _ _ bitmap = withRef bitmap $ \bitmapPtr -> desaturate' bitmapPtr

drawWithCxCy' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ()
drawWithCxCy' a1 a2 a3 a4 a5 a6 a7 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  let {a6' = fromIntegral a6} in 
  let {a7' = fromIntegral a7} in 
  drawWithCxCy''_ a1' a2' a3' a4' a5' a6' a7' >>
  return ()

{-# LINE 56 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

drawWithCx' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ()
drawWithCx' a1 a2 a3 a4 a5 a6 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  let {a6' = fromIntegral a6} in 
  drawWithCx''_ a1' a2' a3' a4' a5' a6' >>
  return ()

{-# LINE 57 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

drawWithCy' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ()
drawWithCy' a1 a2 a3 a4 a5 a6 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  let {a6' = fromIntegral a6} in 
  drawWithCy''_ a1' a2' a3' a4' a5' a6' >>
  return ()

{-# LINE 58 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

drawWith' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ()
drawWith' a1 a2 a3 a4 a5 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  drawWith''_ a1' a2' a3' a4' a5' >>
  return ()

{-# LINE 59 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ (Position -> Size -> Maybe X -> Maybe Y -> IO ())) => Op (DrawResize ()) Bitmap orig impl where
  runOp _ _ bitmap (Position (X x) (Y y)) (Size (Width w) (Height h)) xOffset yOffset =
    case (xOffset, yOffset) of
      (Just (X xOff), Just (Y yOff)) ->
        withRef bitmap $ \bitmapPtr -> drawWithCxCy' bitmapPtr x y w h (fromIntegral xOff) (fromIntegral yOff)
      (Just (X xOff), Nothing) ->
        withRef bitmap $ \bitmapPtr -> drawWithCx' bitmapPtr x y w h (fromIntegral xOff)
      (Nothing, Just (Y yOff)) ->
        withRef bitmap $ \bitmapPtr -> drawWithCy' bitmapPtr x y w h (fromIntegral yOff)
      (Nothing, Nothing) ->
        withRef bitmap $ \bitmapPtr -> drawWith' bitmapPtr x y w h

draw' :: (Ptr ()) -> (Int) -> (Int) -> IO ()
draw' a1 a2 a3 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  draw''_ a1' a2' a3' >>
  return ()

{-# LINE 72 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ (Position ->  IO ())) => Op (Draw ()) Bitmap orig impl where
  runOp _ _ image (Position (X x_pos') (Y y_pos')) = withRef image $ \imagePtr -> draw' imagePtr x_pos' y_pos'
uncache' :: (Ptr ()) -> IO ()
uncache' a1 =
  let {a1' = id a1} in 
  uncache''_ a1' >>
  return ()

{-# LINE 75 "src/Graphics/UI/FLTK/LowLevel/Bitmap.chs" #-}

instance (impl ~ ( IO ())) => Op (Uncache ()) Bitmap orig impl where
  runOp _ _ bitmap = withRef bitmap $ \bitmapPtr -> uncache' bitmapPtr

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_New"
  flBitmapNew''_ :: ((Ptr CChar) -> (CInt -> (CInt -> (IO (Ptr ())))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_Destroy"
  flBitmapDestroy''_ :: ((Ptr ()) -> (IO ()))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_w"
  w''_ :: ((Ptr ()) -> (IO CInt))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_h"
  h''_ :: ((Ptr ()) -> (IO CInt))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_d"
  d''_ :: ((Ptr ()) -> (IO CInt))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_ld"
  ld''_ :: ((Ptr ()) -> (IO CInt))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_count"
  count''_ :: ((Ptr ()) -> (IO CInt))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_copy_with_w_h"
  copyWithWH''_ :: ((Ptr ()) -> (CInt -> (CInt -> (IO (Ptr ())))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_copy"
  copy''_ :: ((Ptr ()) -> (IO (Ptr ())))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_color_average"
  colorAverage''_ :: ((Ptr ()) -> (CUInt -> (CFloat -> (IO ()))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_inactive"
  inactive''_ :: ((Ptr ()) -> (IO ()))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_desaturate"
  desaturate''_ :: ((Ptr ()) -> (IO ()))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_draw_with_cx_cy"
  drawWithCxCy''_ :: ((Ptr ()) -> (CInt -> (CInt -> (CInt -> (CInt -> (CInt -> (CInt -> (IO ()))))))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_draw_with_cx"
  drawWithCx''_ :: ((Ptr ()) -> (CInt -> (CInt -> (CInt -> (CInt -> (CInt -> (IO ())))))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_draw_with_cy"
  drawWithCy''_ :: ((Ptr ()) -> (CInt -> (CInt -> (CInt -> (CInt -> (CInt -> (IO ())))))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_draw_with"
  drawWith''_ :: ((Ptr ()) -> (CInt -> (CInt -> (CInt -> (CInt -> (IO ()))))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_draw"
  draw''_ :: ((Ptr ()) -> (CInt -> (CInt -> (IO ()))))

foreign import ccall unsafe "Graphics/UI/FLTK/LowLevel/Bitmap.chs.h Fl_Bitmap_uncache"
  uncache''_ :: ((Ptr ()) -> (IO ()))