0 | {- Tian Z (ecburx@burx.vip) -}
 1 |
 2 | module IdrisGL.SDL.SDL_image
 3 |
 4 | import IdrisGL.DataType
 5 |
 6 | {- 
 7 |     FFI 
 8 | -}
 9 |
10 | frgn : String -> String
11 | frgn func = "C:" ++ func ++ ",sdl_image"
12 |
13 | --
14 |
15 | %foreign frgn "loadIMGSur"
16 | prim_loadIMGSur : String -> AnyPtr
17 |
18 | ||| Load an image to a surface.
19 | ||| @ path The file path of image.
20 | export
21 | loadIMGSur : HasIO io => (path : String) -> io Sur
22 | loadIMGSur path = pure $ MkSur $ prim_loadIMGSur path
23 |
24 | --
25 |
26 | %foreign frgn "loadIMG"
27 | prim_loadIMG : AnyPtr -> String -> Int -> Int -> Int -> Int -> PrimIO ()
28 |
29 | ||| Load an image.
30 | ||| @ path The file path of image.
31 | export
32 | loadIMG : HasIO io => Renderer -> (path : String) -> Rect -> io ()
33 | loadIMG (MkRenderer ren) path (MkRect x y w h) = primIO $ prim_loadIMG ren path x y w h
34 |
35 | --
36 |
37 | %foreign frgn "loadBMPSur"
38 | prim_loadBMPSur : String -> AnyPtr
39 |
40 | ||| Load a bitmap to a surface.
41 | ||| @ path The file path of bitmap.
42 | export
43 | loadBMPSur : HasIO io => (path : String) -> io Sur
44 | loadBMPSur path = pure $ MkSur $ prim_loadBMPSur path
45 |
46 | --
47 |
48 | %foreign frgn "loadBMP"
49 | prim_loadBMP : AnyPtr -> String -> Int -> Int -> Int -> Int -> PrimIO ()
50 |
51 | ||| Load a bitmap.
52 | ||| @ path The file path of bitmap.
53 | export
54 | loadBMP : HasIO io => Renderer -> (path : String) -> Rect -> io ()
55 | loadBMP (MkRenderer ren) path (MkRect x y w h) = primIO $ prim_loadBMP ren path x y w h