Skip to content

Commit d495366

Browse files
committed
Update Image haddocks.
1 parent 0fc23d8 commit d495366

File tree

2 files changed

+539
-55
lines changed

2 files changed

+539
-55
lines changed

src/ArrayFire/Graphics.hs

Lines changed: 149 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ drawImage (Window wfptr) (Array fptr) cell =
112112
-- @
113113
-- >>> drawPlot window ('constant' \@'Int' 1) ('constant' \@'Int' 1) ('Cell' 10 10 "test" 'ColorMapSpectrum')
114114
-- @
115-
drawPlot :: Window -> Array a -> Array a -> Cell -> IO ()
115+
--
116+
drawPlot
117+
:: Window
118+
-> Array a
119+
-> Array a
120+
-> Cell
121+
-> IO ()
116122
drawPlot (Window w) (Array fptr1) (Array fptr2) cell =
117123
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
118124
withForeignPtr fptr2 $ \ptr2 ->
@@ -122,7 +128,11 @@ drawPlot (Window w) (Array fptr1) (Array fptr2) cell =
122128
throwAFError =<< af_draw_plot wptr ptr1 ptr2 cellPtr
123129
free cellPtr
124130

125-
drawPlot3 :: Window -> Array a -> Cell -> IO ()
131+
drawPlot3
132+
:: Window
133+
-> Array a
134+
-> Cell
135+
-> IO ()
126136
drawPlot3 (Window w) (Array fptr) cell =
127137
mask_ $ withForeignPtr fptr $ \aptr ->
128138
withForeignPtr w $ \wptr ->
@@ -131,7 +141,11 @@ drawPlot3 (Window w) (Array fptr) cell =
131141
throwAFError =<< af_draw_plot3 wptr aptr cellPtr
132142
free cellPtr
133143

134-
drawPlotNd :: Window -> Array a -> Cell -> IO ()
144+
drawPlotNd
145+
:: Window
146+
-> Array a
147+
-> Cell
148+
-> IO ()
135149
drawPlotNd (Window w) (Array fptr) cell =
136150
mask_ $ withForeignPtr fptr $ \aptr ->
137151
withForeignPtr w $ \wptr ->
@@ -140,7 +154,12 @@ drawPlotNd (Window w) (Array fptr) cell =
140154
throwAFError =<< af_draw_plot_nd wptr aptr cellPtr
141155
free cellPtr
142156

143-
drawPlot2d :: Window -> Array a -> Array a -> Cell -> IO ()
157+
drawPlot2d
158+
:: Window
159+
-> Array a
160+
-> Array a
161+
-> Cell
162+
-> IO ()
144163
drawPlot2d (Window w) (Array fptr1) (Array fptr2) cell =
145164
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
146165
withForeignPtr fptr2 $ \ptr2 ->
@@ -150,7 +169,13 @@ drawPlot2d (Window w) (Array fptr1) (Array fptr2) cell =
150169
throwAFError =<< af_draw_plot_2d wptr ptr1 ptr2 cellPtr
151170
free cellPtr
152171

153-
drawPlot3d :: Window -> Array a -> Array a -> Array a -> Cell -> IO ()
172+
drawPlot3d
173+
:: Window
174+
-> Array a
175+
-> Array a
176+
-> Array a
177+
-> Cell
178+
-> IO ()
154179
drawPlot3d (Window w) (Array fptr1) (Array fptr2) (Array fptr3) cell =
155180
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
156181
withForeignPtr fptr2 $ \ptr2 ->
@@ -161,7 +186,13 @@ drawPlot3d (Window w) (Array fptr1) (Array fptr2) (Array fptr3) cell =
161186
throwAFError =<< af_draw_plot_3d wptr ptr1 ptr2 ptr3 cellPtr
162187
free cellPtr
163188

164-
drawScatter :: Window -> Array a -> Array a -> MarkerType -> Cell -> IO ()
189+
drawScatter
190+
:: Window
191+
-> Array a
192+
-> Array a
193+
-> MarkerType
194+
-> Cell
195+
-> IO ()
165196
drawScatter (Window w) (Array fptr1) (Array fptr2) (fromMarkerType -> m) cell =
166197
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
167198
withForeignPtr fptr2 $ \ptr2 ->
@@ -171,7 +202,12 @@ drawScatter (Window w) (Array fptr1) (Array fptr2) (fromMarkerType -> m) cell =
171202
throwAFError =<< af_draw_scatter wptr ptr1 ptr2 m cellPtr
172203
free cellPtr
173204

174-
drawScatter3 :: Window -> Array a -> MarkerType -> Cell -> IO ()
205+
drawScatter3
206+
:: Window
207+
-> Array a
208+
-> MarkerType
209+
-> Cell
210+
-> IO ()
175211
drawScatter3 (Window w) (Array fptr1) (fromMarkerType -> m) cell =
176212
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
177213
withForeignPtr w $ \wptr ->
@@ -180,8 +216,12 @@ drawScatter3 (Window w) (Array fptr1) (fromMarkerType -> m) cell =
180216
throwAFError =<< af_draw_scatter3 wptr ptr1 m cellPtr
181217
free cellPtr
182218

183-
184-
drawScatterNd :: Window -> Array a -> MarkerType -> Cell -> IO ()
219+
drawScatterNd
220+
:: Window
221+
-> Array a
222+
-> MarkerType
223+
-> Cell
224+
-> IO ()
185225
drawScatterNd (Window w) (Array fptr1) (fromMarkerType -> m) cell =
186226
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
187227
withForeignPtr w $ \wptr ->
@@ -190,8 +230,13 @@ drawScatterNd (Window w) (Array fptr1) (fromMarkerType -> m) cell =
190230
throwAFError =<< af_draw_scatter_nd wptr ptr1 m cellPtr
191231
free cellPtr
192232

193-
194-
drawScatter2d :: Window -> Array a -> Array a -> MarkerType -> Cell -> IO ()
233+
drawScatter2d
234+
:: Window
235+
-> Array a
236+
-> Array a
237+
-> MarkerType
238+
-> Cell
239+
-> IO ()
195240
drawScatter2d (Window w) (Array fptr1) (Array fptr2) (fromMarkerType -> m) cell =
196241
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
197242
withForeignPtr w $ \wptr ->
@@ -201,8 +246,14 @@ drawScatter2d (Window w) (Array fptr1) (Array fptr2) (fromMarkerType -> m) cell
201246
throwAFError =<< af_draw_scatter_2d wptr ptr1 ptr2 m cellPtr
202247
free cellPtr
203248

204-
205-
drawScatter3d :: Window -> Array a -> Array a -> Array a -> MarkerType -> Cell -> IO ()
249+
drawScatter3d
250+
:: Window
251+
-> Array a
252+
-> Array a
253+
-> Array a
254+
-> MarkerType
255+
-> Cell
256+
-> IO ()
206257
drawScatter3d (Window w) (Array fptr1) (Array fptr2) (Array fptr3) (fromMarkerType -> m) cell =
207258
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
208259
withForeignPtr w $ \wptr ->
@@ -213,17 +264,27 @@ drawScatter3d (Window w) (Array fptr1) (Array fptr2) (Array fptr3) (fromMarkerTy
213264
throwAFError =<< af_draw_scatter_3d wptr ptr1 ptr2 ptr3 m cellPtr
214265
free cellPtr
215266

216-
217-
drawHistogram :: Window -> Array a -> Double -> Double -> Cell -> IO ()
267+
drawHistogram
268+
:: Window
269+
-> Array a
270+
-> Double
271+
-> Double
272+
-> Cell
273+
-> IO ()
218274
drawHistogram (Window w) (Array fptr1) minval maxval cell =
219275
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
220276
withForeignPtr w $ \wptr ->
221277
alloca $ \cellPtr -> do
222278
poke cellPtr =<< cellToAFCell cell
223279
throwAFError =<< af_draw_hist wptr ptr1 minval maxval cellPtr
224280

225-
226-
drawSurface :: Window -> Array a -> Array a -> Array a -> Cell -> IO ()
281+
drawSurface
282+
:: Window
283+
-> Array a
284+
-> Array a
285+
-> Array a
286+
-> Cell
287+
-> IO ()
227288
drawSurface (Window w) (Array fptr1) (Array fptr2) (Array fptr3) cell =
228289
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
229290
withForeignPtr w $ \wptr ->
@@ -235,7 +296,12 @@ drawSurface (Window w) (Array fptr1) (Array fptr2) (Array fptr3) cell =
235296
free cellPtr
236297

237298

238-
drawVectorFieldND :: Window -> Array a -> Array a -> Cell -> IO ()
299+
drawVectorFieldND
300+
:: Window
301+
-> Array a
302+
-> Array a
303+
-> Cell
304+
-> IO ()
239305
drawVectorFieldND (Window w) (Array fptr1) (Array fptr2) cell =
240306
mask_ $ withForeignPtr fptr1 $ \ptr1 ->
241307
withForeignPtr fptr2 $ \ptr2 ->
@@ -246,7 +312,16 @@ drawVectorFieldND (Window w) (Array fptr1) (Array fptr2) cell =
246312
free cellPtr
247313

248314

249-
drawVectorField3d :: Window -> Array a -> Array a -> Array a -> Array a -> Array a -> Array a -> Cell -> IO ()
315+
drawVectorField3d
316+
:: Window
317+
-> Array a
318+
-> Array a
319+
-> Array a
320+
-> Array a
321+
-> Array a
322+
-> Array a
323+
-> Cell
324+
-> IO ()
250325
drawVectorField3d (Window w) (Array fptr1) (Array fptr2) (Array fptr3)
251326
(Array fptr4) (Array fptr5) (Array fptr6) cell =
252327
mask_ $ do
@@ -262,8 +337,14 @@ drawVectorField3d (Window w) (Array fptr1) (Array fptr2) (Array fptr3)
262337
throwAFError =<< af_draw_vector_field_3d wptr ptr1 ptr2 ptr3 ptr4 ptr5 ptr6 cellPtr
263338
free cellPtr
264339

265-
266-
drawVectorField2d :: Window -> Array a -> Array a -> Array a -> Array a -> Cell -> IO ()
340+
drawVectorField2d
341+
:: Window
342+
-> Array a
343+
-> Array a
344+
-> Array a
345+
-> Array a
346+
-> Cell
347+
-> IO ()
267348
drawVectorField2d (Window w) (Array fptr1) (Array fptr2) (Array fptr3) (Array fptr4) cell =
268349
mask_ $ do
269350
withForeignPtr w $ \wptr ->
@@ -276,14 +357,24 @@ drawVectorField2d (Window w) (Array fptr1) (Array fptr2) (Array fptr3) (Array fp
276357
throwAFError =<< af_draw_vector_field_2d wptr ptr1 ptr2 ptr3 ptr4 cellPtr
277358
free cellPtr
278359

279-
280-
grid :: Window -> Int -> Int -> IO ()
360+
grid
361+
:: Window
362+
-> Int
363+
-> Int
364+
-> IO ()
281365
grid (Window w) (fromIntegral -> rows) (fromIntegral -> cols) =
282366
mask_ . withForeignPtr w $ \wptr ->
283367
throwAFError =<< af_grid wptr rows cols
284368

285369

286-
setAxesLimitsCompute :: Window -> Array a -> Array a -> Array a -> Bool -> Cell -> IO ()
370+
setAxesLimitsCompute
371+
:: Window
372+
-> Array a
373+
-> Array a
374+
-> Array a
375+
-> Bool
376+
-> Cell
377+
-> IO ()
287378
setAxesLimitsCompute (Window w) (Array fptr1) (Array fptr2) (Array fptr3) (fromIntegral . fromEnum -> exact) cell =
288379
mask_ $ do
289380
withForeignPtr w $ \wptr ->
@@ -296,7 +387,15 @@ setAxesLimitsCompute (Window w) (Array fptr1) (Array fptr2) (Array fptr3) (fromI
296387
free cellPtr
297388

298389

299-
setAxesLimits2d :: Window -> Float -> Float -> Float -> Float -> Bool -> Cell -> IO ()
390+
setAxesLimits2d
391+
:: Window
392+
-> Float
393+
-> Float
394+
-> Float
395+
-> Float
396+
-> Bool
397+
-> Cell
398+
-> IO ()
300399
setAxesLimits2d (Window w) xmin xmax ymin ymax (fromIntegral . fromEnum -> exact) cell =
301400
mask_ $ do
302401
withForeignPtr w $ \wptr ->
@@ -306,7 +405,17 @@ setAxesLimits2d (Window w) xmin xmax ymin ymax (fromIntegral . fromEnum -> exact
306405
free cellPtr
307406

308407

309-
setAxesLimits3d :: Window -> Float -> Float -> Float -> Float -> Float -> Float -> Bool -> Cell -> IO ()
408+
setAxesLimits3d
409+
:: Window
410+
-> Float
411+
-> Float
412+
-> Float
413+
-> Float
414+
-> Float
415+
-> Float
416+
-> Bool
417+
-> Cell
418+
-> IO ()
310419
setAxesLimits3d (Window w) xmin xmax ymin ymax zmin zmax (fromIntegral . fromEnum -> exact) cell =
311420
mask_ $ do
312421
withForeignPtr w $ \wptr ->
@@ -315,9 +424,13 @@ setAxesLimits3d (Window w) xmin xmax ymin ymax zmin zmax (fromIntegral . fromEnu
315424
throwAFError =<< af_set_axes_limits_3d wptr xmin xmax ymin ymax zmin zmax exact cellPtr
316425
free cellPtr
317426

318-
319-
320-
setAxesTitles :: Window -> String -> String -> String -> Cell -> IO ()
427+
setAxesTitles
428+
:: Window
429+
-> String
430+
-> String
431+
-> String
432+
-> Cell
433+
-> IO ()
321434
setAxesTitles (Window w) x y z cell =
322435
mask_ $ do
323436
withForeignPtr w $ \wptr ->
@@ -329,16 +442,19 @@ setAxesTitles (Window w) x y z cell =
329442
throwAFError =<< af_set_axes_titles wptr xstr ystr zstr cellPtr
330443
free cellPtr
331444

332-
333-
showWindow :: Window -> IO ()
445+
showWindow
446+
:: Window
447+
-> IO ()
334448
showWindow = (`opw` af_show)
335449

336-
337450
isWindowClosed :: Window -> IO Bool
338451
isWindowClosed w =
339452
toEnum . fromIntegral
340453
<$> (w `opw1` af_is_window_closed)
341454

342455

343-
setVisibility :: Window -> Bool -> IO ()
456+
setVisibility
457+
:: Window
458+
-> Bool
459+
-> IO ()
344460
setVisibility w (fromIntegral . fromEnum -> b) = w `opw` (`af_set_visibility` b)

0 commit comments

Comments
 (0)