-
Notifications
You must be signed in to change notification settings - Fork 4
/
Image.purs
32 lines (25 loc) · 1.32 KB
/
Image.purs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module P5.Image
( createImage
, saveCanvas
, module P5.Image.Pixels
, module P5.Image.LoadingAndDisplaying
) where
import Data.Function.Uncurried (Fn1, Fn10, Fn2, Fn3, Fn4, Fn5, Fn6, Fn7, Fn9, runFn1, runFn10, runFn2, runFn3, runFn4, runFn5, runFn6, runFn7, runFn9)
import Effect (Effect)
import Prelude (Unit)
import P5.Types
import Foreign (Foreign, unsafeToForeign)
import Data.Maybe (Maybe, maybe)
import Foreign.NullOrUndefined (undefined)
import P5.Image.Pixels
import P5.Image.LoadingAndDisplaying
foreign import createImageImpl :: Fn3 P5 Int Int Image
foreign import saveCanvasImpl :: Fn3 P5 (Maybe String) (Maybe String) (Effect Unit)
-- | [p5js.org documentation](https://p5js.org/reference/#/p5/createImage)
createImage :: P5 -> Int -> Int -> Image
createImage p5 width height = runFn3 createImageImpl p5 width height
-- | [p5js.org documentation](https://p5js.org/reference/#/p5/saveCanvas)
saveCanvas :: P5 -> (Maybe String) -> (Maybe String) -> (Effect Unit)
saveCanvas p5 filename extension = runFn3 saveCanvasImpl p5 filename extension
-- TODO: unsupported: saveCanvas2 :: P5 -> UnsupportedProduct(Unsupported(HTMLCanvasElement)|Element) -> (Maybe String) -> (Maybe String) -> (Effect Unit)
-- TODO: unsupported: saveFrames :: P5 -> String -> String -> Number -> Number -> Unsupported(Function(Array)) -> (Effect Unit)