{-# LANGUAGE ViewPatterns #-}
module ArrayFire.Graphics where
import Control.Exception
import Foreign.Marshal
import Foreign.Storable
import Foreign.ForeignPtr
import Foreign.C.String
import ArrayFire.Internal.Graphics
import ArrayFire.Exception
import ArrayFire.FFI
import ArrayFire.Internal.Types
createWindow
:: Int
-> Int
-> String
-> IO Window
createWindow :: Int -> Int -> String -> IO Window
createWindow (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral -> CInt
x) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral -> CInt
y) String
str =
String -> (CString -> IO Window) -> IO Window
forall a. String -> (CString -> IO a) -> IO a
withCString String
str ((CString -> IO Window) -> IO Window)
-> (CString -> IO Window) -> IO Window
forall a b. (a -> b) -> a -> b
$ \CString
cstr ->
(Ptr AFWindow -> IO AFErr) -> IO Window
createWindow' (\Ptr AFWindow
p -> Ptr AFWindow -> CInt -> CInt -> CString -> IO AFErr
af_create_window Ptr AFWindow
p CInt
x CInt
y CString
cstr)
setPosition
:: Window
-> Int
-> Int
-> IO ()
setPosition :: Window -> Int -> Int -> IO ()
setPosition Window
w (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral -> CUInt
x) (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral -> CUInt
y) =
Window
w Window -> (AFWindow -> IO AFErr) -> IO ()
`opw` (\AFWindow
p -> AFWindow -> CUInt -> CUInt -> IO AFErr
af_set_position AFWindow
p CUInt
x CUInt
y)
setTitle
:: Window
-> String
-> IO ()
setTitle :: Window -> String -> IO ()
setTitle Window
w String
str = String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
str ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
cstr ->
Window
w Window -> (AFWindow -> IO AFErr) -> IO ()
`opw` (\AFWindow
p -> AFWindow -> CString -> IO AFErr
af_set_title AFWindow
p CString
cstr)
setSize
:: Window
-> Int
-> Int
-> IO ()
setSize :: Window -> Int -> Int -> IO ()
setSize Window
w (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral -> CUInt
x) (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral -> CUInt
y) =
Window
w Window -> (AFWindow -> IO AFErr) -> IO ()
`opw` (\AFWindow
p -> AFWindow -> CUInt -> CUInt -> IO AFErr
af_set_size AFWindow
p CUInt
x CUInt
y)
drawImage
:: Window
-> Array a
-> Cell
-> IO ()
drawImage :: forall a. Window -> Array a -> Cell -> IO ()
drawImage (Window ForeignPtr ()
wfptr) (Array ForeignPtr ()
fptr) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
aptr ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
wfptr ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> AFWindow -> Ptr AFCell -> IO AFErr
af_draw_image AFWindow
wptr AFWindow
aptr Ptr AFCell
cellPtr
drawPlot
:: Window
-> Array a
-> Array a
-> Cell
-> IO ()
drawPlot :: forall a. Window -> Array a -> Array a -> Cell -> IO ()
drawPlot (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> AFWindow -> AFWindow -> Ptr AFCell -> IO AFErr
af_draw_plot AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 Ptr AFCell
cellPtr
drawPlot3
:: Window
-> Array a
-> Cell
-> IO ()
drawPlot3 :: forall a. Window -> Array a -> Cell -> IO ()
drawPlot3 (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
aptr ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> AFWindow -> Ptr AFCell -> IO AFErr
af_draw_plot3 AFWindow
wptr AFWindow
aptr Ptr AFCell
cellPtr
drawPlotNd
:: Window
-> Array a
-> Cell
-> IO ()
drawPlotNd :: forall a. Window -> Array a -> Cell -> IO ()
drawPlotNd (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
aptr ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> AFWindow -> Ptr AFCell -> IO AFErr
af_draw_plot_nd AFWindow
wptr AFWindow
aptr Ptr AFCell
cellPtr
drawPlot2d
:: Window
-> Array a
-> Array a
-> Cell
-> IO ()
drawPlot2d :: forall a. Window -> Array a -> Array a -> Cell -> IO ()
drawPlot2d (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> AFWindow -> AFWindow -> Ptr AFCell -> IO AFErr
af_draw_plot_2d AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 Ptr AFCell
cellPtr
drawPlot3d
:: Window
-> Array a
-> Array a
-> Array a
-> Cell
-> IO ()
drawPlot3d :: forall a. Window -> Array a -> Array a -> Array a -> Cell -> IO ()
drawPlot3d (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) (Array ForeignPtr ()
fptr3) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr3 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr3 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> AFWindow -> AFWindow -> AFWindow -> Ptr AFCell -> IO AFErr
af_draw_plot_3d AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 AFWindow
ptr3 Ptr AFCell
cellPtr
drawScatter
:: Window
-> Array a
-> Array a
-> MarkerType
-> Cell
-> IO ()
drawScatter :: forall a.
Window -> Array a -> Array a -> MarkerType -> Cell -> IO ()
drawScatter (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) (MarkerType -> AFMarkerType
fromMarkerType -> AFMarkerType
m) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> AFWindow -> AFWindow -> AFMarkerType -> Ptr AFCell -> IO AFErr
af_draw_scatter AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 AFMarkerType
m Ptr AFCell
cellPtr
drawScatter3
:: Window
-> Array a
-> MarkerType
-> Cell
-> IO ()
drawScatter3 :: forall a. Window -> Array a -> MarkerType -> Cell -> IO ()
drawScatter3 (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (MarkerType -> AFMarkerType
fromMarkerType -> AFMarkerType
m) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> AFWindow -> AFMarkerType -> Ptr AFCell -> IO AFErr
af_draw_scatter3 AFWindow
wptr AFWindow
ptr1 AFMarkerType
m Ptr AFCell
cellPtr
drawScatterNd
:: Window
-> Array a
-> MarkerType
-> Cell
-> IO ()
drawScatterNd :: forall a. Window -> Array a -> MarkerType -> Cell -> IO ()
drawScatterNd (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (MarkerType -> AFMarkerType
fromMarkerType -> AFMarkerType
m) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> AFWindow -> AFMarkerType -> Ptr AFCell -> IO AFErr
af_draw_scatter_nd AFWindow
wptr AFWindow
ptr1 AFMarkerType
m Ptr AFCell
cellPtr
drawScatter2d
:: Window
-> Array a
-> Array a
-> MarkerType
-> Cell
-> IO ()
drawScatter2d :: forall a.
Window -> Array a -> Array a -> MarkerType -> Cell -> IO ()
drawScatter2d (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) (MarkerType -> AFMarkerType
fromMarkerType -> AFMarkerType
m) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> AFWindow -> AFWindow -> AFMarkerType -> Ptr AFCell -> IO AFErr
af_draw_scatter_2d AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 AFMarkerType
m Ptr AFCell
cellPtr
drawScatter3d
:: Window
-> Array a
-> Array a
-> Array a
-> MarkerType
-> Cell
-> IO ()
drawScatter3d :: forall a.
Window
-> Array a -> Array a -> Array a -> MarkerType -> Cell -> IO ()
drawScatter3d (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) (Array ForeignPtr ()
fptr3) (MarkerType -> AFMarkerType
fromMarkerType -> AFMarkerType
m) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr3 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr3 ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> AFWindow
-> AFWindow
-> AFWindow
-> AFMarkerType
-> Ptr AFCell
-> IO AFErr
af_draw_scatter_3d AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 AFWindow
ptr3 AFMarkerType
m Ptr AFCell
cellPtr
drawHistogram
:: Window
-> Array a
-> Double
-> Double
-> Cell
-> IO ()
drawHistogram :: forall a. Window -> Array a -> Double -> Double -> Cell -> IO ()
drawHistogram (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) Double
minval Double
maxval Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> AFWindow -> Double -> Double -> Ptr AFCell -> IO AFErr
af_draw_hist AFWindow
wptr AFWindow
ptr1 Double
minval Double
maxval Ptr AFCell
cellPtr
drawSurface
:: Window
-> Array a
-> Array a
-> Array a
-> Cell
-> IO ()
drawSurface :: forall a. Window -> Array a -> Array a -> Array a -> Cell -> IO ()
drawSurface (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) (Array ForeignPtr ()
fptr3) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr3 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr3 ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> AFWindow -> AFWindow -> AFWindow -> Ptr AFCell -> IO AFErr
af_draw_surface AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 AFWindow
ptr3 Ptr AFCell
cellPtr
drawVectorFieldND
:: Window
-> Array a
-> Array a
-> Cell
-> IO ()
drawVectorFieldND :: forall a. Window -> Array a -> Array a -> Cell -> IO ()
drawVectorFieldND (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> AFWindow -> AFWindow -> Ptr AFCell -> IO AFErr
af_draw_vector_field_nd AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 Ptr AFCell
cellPtr
drawVectorField3d
:: Window
-> Array a
-> Array a
-> Array a
-> Array a
-> Array a
-> Array a
-> Cell
-> IO ()
drawVectorField3d :: forall a.
Window
-> Array a
-> Array a
-> Array a
-> Array a
-> Array a
-> Array a
-> Cell
-> IO ()
drawVectorField3d (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) (Array ForeignPtr ()
fptr3)
(Array ForeignPtr ()
fptr4) (Array ForeignPtr ()
fptr5) (Array ForeignPtr ()
fptr6) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr3 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr3 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr4 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr4 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr5 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr5 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr6 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr6 -> do
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> AFWindow
-> AFWindow
-> AFWindow
-> AFWindow
-> AFWindow
-> AFWindow
-> Ptr AFCell
-> IO AFErr
af_draw_vector_field_3d AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 AFWindow
ptr3 AFWindow
ptr4 AFWindow
ptr5 AFWindow
ptr6 Ptr AFCell
cellPtr
drawVectorField2d
:: Window
-> Array a
-> Array a
-> Array a
-> Array a
-> Cell
-> IO ()
drawVectorField2d :: forall a.
Window -> Array a -> Array a -> Array a -> Array a -> Cell -> IO ()
drawVectorField2d (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) (Array ForeignPtr ()
fptr3) (Array ForeignPtr ()
fptr4) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr3 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr3 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr4 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr4 ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> AFWindow
-> AFWindow
-> AFWindow
-> AFWindow
-> Ptr AFCell
-> IO AFErr
af_draw_vector_field_2d AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 AFWindow
ptr3 AFWindow
ptr4 Ptr AFCell
cellPtr
grid
:: Window
-> Int
-> Int
-> IO ()
grid :: Window -> Int -> Int -> IO ()
grid (Window ForeignPtr ()
w) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral -> CInt
rows) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral -> CInt
cols) =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ())
-> ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> CInt -> CInt -> IO AFErr
af_grid AFWindow
wptr CInt
rows CInt
cols
setAxesLimitsCompute
:: Window
-> Array a
-> Array a
-> Array a
-> Bool
-> Cell
-> IO ()
setAxesLimitsCompute :: forall a.
Window -> Array a -> Array a -> Array a -> Bool -> Cell -> IO ()
setAxesLimitsCompute (Window ForeignPtr ()
w) (Array ForeignPtr ()
fptr1) (Array ForeignPtr ()
fptr2) (Array ForeignPtr ()
fptr3) (Int -> CBool
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CBool) -> (Bool -> Int) -> Bool -> CBool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum -> CBool
exact) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr1 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr1 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr2 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr2 ->
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr3 ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
ptr3 ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> AFWindow
-> AFWindow
-> AFWindow
-> CBool
-> Ptr AFCell
-> IO AFErr
af_set_axes_limits_compute AFWindow
wptr AFWindow
ptr1 AFWindow
ptr2 AFWindow
ptr3 CBool
exact Ptr AFCell
cellPtr
setAxesLimits2d
:: Window
-> Float
-> Float
-> Float
-> Float
-> Bool
-> Cell
-> IO ()
setAxesLimits2d :: Window -> Float -> Float -> Float -> Float -> Bool -> Cell -> IO ()
setAxesLimits2d (Window ForeignPtr ()
w) Float
xmin Float
xmax Float
ymin Float
ymax (Int -> CBool
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CBool) -> (Bool -> Int) -> Bool -> CBool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum -> CBool
exact) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> Float
-> Float
-> Float
-> Float
-> CBool
-> Ptr AFCell
-> IO AFErr
af_set_axes_limits_2d AFWindow
wptr Float
xmin Float
xmax Float
ymin Float
ymax CBool
exact Ptr AFCell
cellPtr
setAxesLimits3d
:: Window
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Bool
-> Cell
-> IO ()
setAxesLimits3d :: Window
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> Bool
-> Cell
-> IO ()
setAxesLimits3d (Window ForeignPtr ()
w) Float
xmin Float
xmax Float
ymin Float
ymax Float
zmin Float
zmax (Int -> CBool
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CBool) -> (Bool -> Int) -> Bool -> CBool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum -> CBool
exact) Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow
-> Float
-> Float
-> Float
-> Float
-> Float
-> Float
-> CBool
-> Ptr AFCell
-> IO AFErr
af_set_axes_limits_3d AFWindow
wptr Float
xmin Float
xmax Float
ymin Float
ymax Float
zmin Float
zmax CBool
exact Ptr AFCell
cellPtr
setAxesTitles
:: Window
-> String
-> String
-> String
-> Cell
-> IO ()
setAxesTitles :: Window -> String -> String -> String -> Cell -> IO ()
setAxesTitles (Window ForeignPtr ()
w) String
x String
y String
z Cell
cell =
IO () -> IO ()
forall a. IO a -> IO a
mask_ (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
ForeignPtr () -> (AFWindow -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
w ((AFWindow -> IO ()) -> IO ()) -> (AFWindow -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \AFWindow
wptr ->
(Ptr AFCell -> IO ()) -> IO ()
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr AFCell -> IO ()) -> IO ()) -> (Ptr AFCell -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AFCell
cellPtr -> do
String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
x ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
xstr ->
String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
y ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
ystr ->
String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
z ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
zstr -> do
Ptr AFCell -> AFCell -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr AFCell
cellPtr (AFCell -> IO ()) -> IO AFCell -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cell -> IO AFCell
cellToAFCell Cell
cell
AFErr -> IO ()
throwAFError (AFErr -> IO ()) -> IO AFErr -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AFWindow -> CString -> CString -> CString -> Ptr AFCell -> IO AFErr
af_set_axes_titles AFWindow
wptr CString
xstr CString
ystr CString
zstr Ptr AFCell
cellPtr
showWindow
:: Window
-> IO ()
showWindow :: Window -> IO ()
showWindow = (Window -> (AFWindow -> IO AFErr) -> IO ()
`opw` AFWindow -> IO AFErr
af_show)
isWindowClosed :: Window -> IO Bool
isWindowClosed :: Window -> IO Bool
isWindowClosed Window
w =
Int -> Bool
forall a. Enum a => Int -> a
toEnum (Int -> Bool) -> (CBool -> Int) -> CBool -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CBool -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
(CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Window
w Window -> (Ptr CBool -> AFWindow -> IO AFErr) -> IO CBool
forall a.
Storable a =>
Window -> (Ptr a -> AFWindow -> IO AFErr) -> IO a
`opw1` Ptr CBool -> AFWindow -> IO AFErr
af_is_window_closed)
setVisibility
:: Window
-> Bool
-> IO ()
setVisibility :: Window -> Bool -> IO ()
setVisibility Window
w (Int -> CBool
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CBool) -> (Bool -> Int) -> Bool -> CBool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum -> CBool
b) = Window
w Window -> (AFWindow -> IO AFErr) -> IO ()
`opw` (AFWindow -> CBool -> IO AFErr
`af_set_visibility` CBool
b)