{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables, UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.RGBImage
(
rgbImageNew,
checkImage,
)
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp
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
import Data.ByteString as B
rgbImageNew' :: (Ptr CUChar) -> (Int) -> (Int) -> IO ((Ptr ()))
rgbImageNew' a1 a2 a3 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
rgbImageNew''_ a1' a2' a3' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 28 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
rgbImageNew_WithD' :: (Ptr CUChar) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
rgbImageNew_WithD' a1 a2 a3 a4 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = fromIntegral a4} in
rgbImageNew_WithD''_ a1' a2' a3' a4' >>= \res ->
let {res' = id res} in
return (res')
;
rgbImageNew_WithLD' :: (Ptr CUChar) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
rgbImageNew_WithLD' a1 a2 a3 a4 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = fromIntegral a4} in
rgbImageNew_WithLD''_ a1' a2' a3' a4' >>= \res ->
let {res' = id res} in
return (res')
;
rgbImageNew_WithD_LD' :: (Ptr CUChar) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
rgbImageNew_WithD_LD' 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
rgbImageNew_WithD_LD''_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = id res} in
return (res')
;
rgbImageNew :: B.ByteString -> Size -> Maybe Depth -> Maybe LineSize -> IO (Ref RGBImage)
rgbImageNew bits' (Size (Width width') (Height height')) depth' linesize' = do
asCString <- copyByteStringToCString bits'
case (depth', linesize') of
(Just (Depth imageDepth) , Nothing) -> rgbImageNew_WithD' (castPtr asCString) width' height' imageDepth >>= toRef
(Nothing, Just (LineSize l')) -> rgbImageNew_WithLD' (castPtr asCString) width' height' l' >>= toRef
(Just (Depth imageDepth), Just (LineSize l')) -> rgbImageNew_WithD_LD' (castPtr asCString) width' height' imageDepth l' >>= toRef
(Nothing, Nothing) -> rgbImageNew' (castPtr asCString) width' height' >>= toRef
checkImage :: (
Parent orig RGBImage,
Match x ~ FindOp orig orig (GetW ()),
Op (GetW ()) x orig (IO Int),
Match y ~ FindOp orig orig (Destroy ()),
Op (Destroy ()) y orig (IO ())
)
=> Ref orig -> IO (Either UnknownError (Ref orig))
checkImage ref' = do
imageWidth <- getW ref'
if (imageWidth == (0 :: Int))
then do
() <- destroy ref'
return (Left UnknownError)
else (return (Right ref'))
flImageDestroy' :: (Ptr ()) -> IO ((()))
flImageDestroy' a1 =
let {a1' = id a1} in
flImageDestroy''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 61 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ (IO ())) => Op (Destroy ()) RGBImage orig impl where
runOp _ _ image = withRef image $ \imagePtr -> flImageDestroy' imagePtr
w' :: (Ptr ()) -> IO ((Int))
w' a1 =
let {a1' = id a1} in
w''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 64 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ ( IO (Int))) => Op (GetW ()) RGBImage orig impl where
runOp _ _ image = withRef image $ \imagePtr -> w' imagePtr
h' :: (Ptr ()) -> IO ((Int))
h' a1 =
let {a1' = id a1} in
h''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 67 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ ( IO (Int))) => Op (GetH ()) RGBImage orig impl where
runOp _ _ image = withRef image $ \imagePtr -> h' imagePtr
d' :: (Ptr ()) -> IO ((Int))
d' a1 =
let {a1' = id a1} in
d''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 70 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ ( IO (Int))) => Op (GetD ()) RGBImage orig impl where
runOp _ _ image = withRef image $ \imagePtr -> d' imagePtr
ld' :: (Ptr ()) -> IO ((Int))
ld' a1 =
let {a1' = id a1} in
ld''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 73 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ ( IO (Int))) => Op (GetLd ()) RGBImage orig impl where
runOp _ _ image = withRef image $ \imagePtr -> ld' imagePtr
count' :: (Ptr ()) -> IO ((Int))
count' a1 =
let {a1' = id a1} in
count''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 76 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ ( IO (Int))) => Op (GetCount ()) RGBImage orig impl where
runOp _ _ image = withRef image $ \imagePtr -> count' imagePtr
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 80 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
copy' :: (Ptr ()) -> IO ((Ptr ()))
copy' a1 =
let {a1' = id a1} in
copy''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 81 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (Parent a RGBImage, impl ~ ( Maybe Size -> IO (Maybe (Ref a)))) => Op (Copy ()) RGBImage orig impl where
runOp _ _ image size' = case size' of
Just (Size (Width imageWidth) (Height imageHeight)) ->
withRef image $ \imagePtr -> copyWithWH' imagePtr imageWidth imageHeight >>= toMaybeRef
Nothing -> withRef image $ \imagePtr -> copy' imagePtr >>= 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 88 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ (Color -> Float -> IO ())) => Op (ColorAverage ()) RGBImage orig impl where
runOp _ _ image c i = withRef image $ \imagePtr -> colorAverage' imagePtr c i
inactive' :: (Ptr ()) -> IO ()
inactive' a1 =
let {a1' = id a1} in
inactive''_ a1' >>
return ()
{-# LINE 92 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ ( IO ())) => Op (Inactive ()) RGBImage orig impl where
runOp _ _ image = withRef image $ \imagePtr -> inactive' imagePtr
desaturate' :: (Ptr ()) -> IO ()
desaturate' a1 =
let {a1' = id a1} in
desaturate''_ a1' >>
return ()
{-# LINE 96 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ ( IO ())) => Op (Desaturate ()) RGBImage orig impl where
runOp _ _ image = withRef image $ \imagePtr -> desaturate' imagePtr
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 100 "src/Graphics/UI/FLTK/LowLevel/RGBImage.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 101 "src/Graphics/UI/FLTK/LowLevel/RGBImage.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 102 "src/Graphics/UI/FLTK/LowLevel/RGBImage.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 103 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ (Position -> Size -> Maybe X -> Maybe Y -> IO ())) => Op (DrawResize ()) RGBImage orig impl where
runOp _ _ image (Position (X imageX) (Y imageY)) (Size (Width imageWidth) (Height imageHeight)) xOffset yOffset =
case (xOffset, yOffset) of
(Just (X xOff), Just (Y yOff)) ->
withRef image $ \imagePtr -> drawWithCxCy' imagePtr imageX imageY imageWidth imageHeight (fromIntegral xOff) (fromIntegral yOff)
(Just (X xOff), Nothing) ->
withRef image $ \imagePtr -> drawWithCx' imagePtr imageX imageY imageWidth imageHeight (fromIntegral xOff)
(Nothing, Just (Y yOff)) ->
withRef image $ \imagePtr -> drawWithCy' imagePtr imageX imageY imageWidth imageHeight (fromIntegral yOff)
(Nothing, Nothing) ->
withRef image $ \imagePtr -> drawWith' imagePtr imageX imageY imageWidth imageHeight
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 116 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ (Position -> IO ())) => Op (Draw ()) RGBImage 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 119 "src/Graphics/UI/FLTK/LowLevel/RGBImage.chs" #-}
instance (impl ~ ( IO ())) => Op (Uncache ()) RGBImage orig impl where
runOp _ _ image = withRef image $ \imagePtr -> uncache' imagePtr
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_New"
rgbImageNew''_ :: ((C2HSImp.Ptr C2HSImp.CUChar) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ())))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_New_With_D"
rgbImageNew_WithD''_ :: ((C2HSImp.Ptr C2HSImp.CUChar) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_New_With_LD"
rgbImageNew_WithLD''_ :: ((C2HSImp.Ptr C2HSImp.CUChar) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_New_With_D_LD"
rgbImageNew_WithD_LD''_ :: ((C2HSImp.Ptr C2HSImp.CUChar) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_Destroy"
flImageDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_w"
w''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_h"
h''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_d"
d''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_ld"
ld''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_count"
count''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_copy_with_w_h"
copyWithWH''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ())))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_copy"
copy''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_color_average"
colorAverage''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUInt -> (C2HSImp.CFloat -> (IO ()))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_inactive"
inactive''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_desaturate"
desaturate''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_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/RGBImage.chs.h Fl_RGB_Image_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/RGBImage.chs.h Fl_RGB_Image_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/RGBImage.chs.h Fl_RGB_Image_draw_with"
drawWith''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_draw"
draw''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/RGBImage.chs.h Fl_RGB_Image_uncache"
uncache''_ :: ((C2HSImp.Ptr ()) -> (IO ()))