module GEGL.FFI.Rectangle
( GeglRectangle(..)
, c_gegl_rectangle_intersect
) where
import Foreign
import Foreign.Ptr
import Foreign.C.Types
data GeglRectangle = GeglRectangle
{ rectangleX :: Int
, rectangleY :: Int
, rectangleWidth :: Int
, rectangleHeight :: Int
} deriving (Show)
instance Storable GeglRectangle where
sizeOf _ = ((16))
alignment _ = alignment (undefined :: CDouble)
peek ptr = do
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr :: IO CInt
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr :: IO CInt
width <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr :: IO CInt
height <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr :: IO CInt
return GeglRectangle
{ rectangleX = fromIntegral x
, rectangleY = fromIntegral y
, rectangleWidth = fromIntegral width
, rectangleHeight = fromIntegral height
}
poke ptr (GeglRectangle x y w h) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr (CInt $ fromIntegral x)
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr (CInt $ fromIntegral y)
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr (CInt $ fromIntegral w)
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr (CInt $ fromIntegral h)
foreign import ccall unsafe "gegl.h gegl_rectangle_intersect"
c_gegl_rectangle_intersect
:: Ptr GeglRectangle
-> Ptr GeglRectangle
-> Ptr GeglRectangle
-> IO Bool