-- GENERATED by C->Haskell Compiler, version 0.28.6 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Pixmap.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Pixmap
 (
  pixmapNew
  -- * Hierarchy
  --
  -- $hierarchy

  -- * Functions
  --
  -- $functions
 )
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp





import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
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

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

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

pixmapNew :: PixmapHs -> IO (Ref Pixmap)
pixmapNew pixmap = withPixmap pixmap (\ptr -> flPixmapNew' ptr >>= toRef)
flPixmapDestroy' :: (Ptr ()) -> IO ((()))
flPixmapDestroy' a1 =
  let {a1' = id a1} in
  flPixmapDestroy''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

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

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

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

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

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

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

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

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

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

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

{-# LINE 43 "src/Graphics/UI/FLTK/LowLevel/Pixmap.chs" #-}

instance (impl ~ ( IO (Int))) => Op (GetCount ()) Pixmap orig impl where
  runOp _ _ pixmap = withRef pixmap $ \pixmapPtr -> count' pixmapPtr
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 46 "src/Graphics/UI/FLTK/LowLevel/Pixmap.chs" #-}

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

{-# LINE 47 "src/Graphics/UI/FLTK/LowLevel/Pixmap.chs" #-}

instance (impl ~ ( Maybe Size -> IO (Maybe (Ref Pixmap)))) => Op (Copy ()) Pixmap orig impl where
  runOp _ _ pixmap size' = case size' of
    Just (Size (Width w) (Height h)) -> withRef pixmap $ \pixmapPtr -> copyWithWH' pixmapPtr w h >>= toMaybeRef
    Nothing -> withRef pixmap $ \pixmapPtr -> copy' pixmapPtr >>= toMaybeRef
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 52 "src/Graphics/UI/FLTK/LowLevel/Pixmap.chs" #-}

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

{-# LINE 55 "src/Graphics/UI/FLTK/LowLevel/Pixmap.chs" #-}

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

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

instance (impl ~ ( IO ())) => Op (Desaturate ()) Pixmap orig impl where
  runOp _ _ pixmap = withRef pixmap $ \pixmapPtr -> desaturate' pixmapPtr

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 62 "src/Graphics/UI/FLTK/LowLevel/Pixmap.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 63 "src/Graphics/UI/FLTK/LowLevel/Pixmap.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 64 "src/Graphics/UI/FLTK/LowLevel/Pixmap.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 65 "src/Graphics/UI/FLTK/LowLevel/Pixmap.chs" #-}

instance (impl ~ (Position -> Size -> Maybe X -> Maybe Y -> IO ())) => Op (DrawResize ()) Pixmap orig impl where
  runOp _ _ pixmap (Position (X x) (Y y)) (Size (Width w) (Height h)) xOffset yOffset =
    case (xOffset, yOffset) of
      (Just (X xOff), Just (Y yOff)) ->
        withRef pixmap $ \pixmapPtr -> drawWithCxCy' pixmapPtr x y w h (fromIntegral xOff) (fromIntegral yOff)
      (Just (X xOff), Nothing) ->
        withRef pixmap $ \pixmapPtr -> drawWithCx' pixmapPtr x y w h (fromIntegral xOff)
      (Nothing, Just (Y yOff)) ->
        withRef pixmap $ \pixmapPtr -> drawWithCy' pixmapPtr x y w h (fromIntegral yOff)
      (Nothing, Nothing) ->
        withRef pixmap $ \pixmapPtr -> drawWith' pixmapPtr 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 78 "src/Graphics/UI/FLTK/LowLevel/Pixmap.chs" #-}

instance (impl ~ (Position ->  IO ())) => Op (Draw ()) Pixmap 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 81 "src/Graphics/UI/FLTK/LowLevel/Pixmap.chs" #-}

instance (impl ~ ( IO ())) => Op (Uncache ()) Pixmap orig impl where
  runOp _ _ pixmap = withRef pixmap $ \pixmapPtr -> uncache' pixmapPtr

-- $functions
-- @
--
-- colorAverage :: 'Ref' 'Pixmap' -> 'Color' -> 'Float' -> 'IO' ()
--
-- copy :: 'Ref' 'Pixmap' -> 'Maybe' 'Size' -> 'IO' ('Maybe' ('Ref' 'Pixmap'))
--
-- desaturate :: 'Ref' 'Pixmap' -> 'IO' ()
--
-- destroy :: 'Ref' 'Pixmap' -> 'IO' ()
--
-- draw :: 'Ref' 'Pixmap' -> 'Position' -> 'IO' ()
--
-- drawResize :: 'Ref' 'Pixmap' -> 'Position' -> 'Size' -> 'Maybe' 'X' -> 'Maybe' 'Y' -> 'IO' ()
--
-- getCount :: 'Ref' 'Pixmap' -> 'IO' ('Int')
--
-- getD :: 'Ref' 'Pixmap' -> 'IO' ('Int')
--
-- getH :: 'Ref' 'Pixmap' -> 'IO' ('Int')
--
-- getLd :: 'Ref' 'Pixmap' -> 'IO' ('Int')
--
-- getW :: 'Ref' 'Pixmap' -> 'IO' ('Int')
--
-- inactive :: 'Ref' 'Pixmap' -> 'IO' ()
--
-- uncache :: 'Ref' 'Pixmap' -> 'IO' ()
-- @

-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Image"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Pixmap"
-- @

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_New"
  flPixmapNew''_ :: ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_Destroy"
  flPixmapDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_w"
  w''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_h"
  h''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_d"
  d''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_ld"
  ld''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_count"
  count''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_copy_with_w_h"
  copyWithWH''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ())))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_copy"
  copy''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_color_average"
  colorAverage''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUInt -> (C2HSImp.CFloat -> (IO ()))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_inactive"
  inactive''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_desaturate"
  desaturate''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_draw_with_cx_cy"
  drawWithCxCy''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_draw_with_cx"
  drawWithCx''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ())))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_draw_with_cy"
  drawWithCy''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ())))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_draw_with"
  drawWith''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_draw"
  draw''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pixmap.chs.h Fl_Pixmap_uncache"
  uncache''_ :: ((C2HSImp.Ptr ()) -> (IO ()))