2 | module IdrisGL.SDL.SDL_gfx
4 | import IdrisGL.DataType
11 | frgn : String -> String
12 | frgn func = "C:" ++ func ++ ",sdl_gfx"
16 | %foreign frgn "pixel"
19 | -> Int -> Int -> Int -> Int
24 | pixel : HasIO io => Renderer -> Coordinate -> Color -> io ()
25 | pixel (MkRenderer ren) (MkCoor x y) color
26 | = let (r,g,b,a) = rgbaOfColor color in
27 | primIO $
prim_pixel ren x y r g b a
31 | %foreign frgn "thickLine"
32 | prim_thickLine : AnyPtr
33 | -> Int -> Int -> Int -> Int
34 | -> Int -> Int -> Int -> Int
41 | thickLine : HasIO io => Renderer
42 | -> Coordinate -> Coordinate -> Color
45 | thickLine (MkRenderer ren) (MkCoor x1 y1) (MkCoor x2 y2) color width
46 | = let (r,g,b,a) = rgbaOfColor color in
47 | primIO $
prim_thickLine ren x1 y1 x2 y2 r g b a width
51 | %foreign frgn "aaline"
52 | prim_aaline : AnyPtr
53 | -> Int -> Int -> Int -> Int
54 | -> Int -> Int -> Int -> Int
59 | aaline : HasIO io => Renderer -> Coordinate -> Coordinate -> Color -> io ()
60 | aaline (MkRenderer ren) (MkCoor x1 y1) (MkCoor x2 y2) color
61 | = let (r,g,b,a) = rgbaOfColor color in
62 | primIO $
prim_aaline ren x1 y1 x2 y2 r g b a
66 | %foreign frgn "rect"
68 | -> Int -> Int -> Int -> Int
69 | -> Int -> Int -> Int -> Int
74 | rectangle : HasIO io => Renderer -> Rect -> Color -> io ()
75 | rectangle (MkRenderer ren) (MkRect x y w h) color
76 | = let (r,g,b,a) = rgbaOfColor color in
77 | primIO $
prim_rect ren x y w h r g b a
81 | %foreign frgn "roundedRect"
82 | prim_roundedRect : AnyPtr
83 | -> Int -> Int -> Int -> Int
84 | -> Int -> Int -> Int -> Int
91 | roundedRect : HasIO io => Renderer -> Rect -> Color -> (rad : Int) -> io ()
92 | roundedRect (MkRenderer ren) (MkRect x y w h) color rad
93 | = let (r,g,b,a) = rgbaOfColor color in
94 | primIO $
prim_roundedRect ren x y w h r g b a rad
98 | %foreign frgn "filledRect"
99 | prim_filledRect : AnyPtr
100 | -> Int -> Int -> Int -> Int
101 | -> Int -> Int -> Int -> Int
106 | filledRect : HasIO io => Renderer -> Rect -> Color -> io ()
107 | filledRect (MkRenderer ren) (MkRect x y w h) color
108 | = let (r,g,b,a) = rgbaOfColor color in
109 | primIO $
prim_filledRect ren x y w h r g b a
113 | %foreign frgn "roundedFilledRect"
114 | prim_roundedFilledRect : AnyPtr
115 | -> Int -> Int -> Int -> Int
116 | -> Int -> Int -> Int -> Int
123 | roundedFilledRect : HasIO io => Renderer -> Rect -> Color -> (rad : Int) -> io ()
124 | roundedFilledRect (MkRenderer ren) (MkRect x y w h) color rad
125 | = let (r,g,b,a) = rgbaOfColor color in
126 | primIO $
prim_roundedFilledRect ren x y w h r g b a rad
130 | %foreign frgn "circle"
131 | prim_circle : AnyPtr
133 | -> Int -> Int -> Int -> Int
140 | circle : HasIO io => Renderer -> Coordinate -> Color -> (rad : Int) -> io ()
141 | circle (MkRenderer ren) (MkCoor x y) color rad
142 | = let (r,g,b,a) = rgbaOfColor color in
143 | primIO $
prim_circle ren x y r g b a rad
147 | %foreign frgn "aaCircle"
148 | prim_aaCircle : AnyPtr
150 | -> Int -> Int -> Int -> Int
157 | aaCircle : HasIO io => Renderer -> Coordinate -> Color -> Int -> io ()
158 | aaCircle (MkRenderer ren) (MkCoor x y) color rad
159 | = let (r,g,b,a) = rgbaOfColor color in
160 | primIO $
prim_aaCircle ren x y r g b a rad
164 | %foreign frgn "filledCircle"
165 | prim_filledCircle : AnyPtr
167 | -> Int -> Int -> Int -> Int
174 | filledCircle : HasIO io => Renderer -> Coordinate -> Color -> Int -> io ()
175 | filledCircle (MkRenderer ren) (MkCoor x y) color rad
176 | = let (r,g,b,a) = rgbaOfColor color in
177 | primIO $
prim_filledCircle ren x y r g b a rad
181 | %foreign frgn "thickCircle"
182 | prim_thickCircle : AnyPtr
184 | -> Int -> Int -> Int -> Int
192 | thickCircle : HasIO io => Renderer -> Coordinate -> Color -> (rad : Int) -> (width : Int) -> io ()
193 | thickCircle (MkRenderer ren) (MkCoor x y) color rad width
194 | = let (r,g,b,a) = rgbaOfColor color in
195 | primIO $
prim_thickCircle ren x y r g b a rad width
199 | %foreign frgn "arc"
202 | -> Int -> Int -> Int -> Int
203 | -> Int -> Int -> Int
211 | arc : HasIO io => Renderer
212 | -> Coordinate -> Color
213 | -> (rad : Int) -> (start : Int) -> (end : Int)
215 | arc (MkRenderer ren) (MkCoor x y) color rad start end
216 | = let (r,g,b,a) = rgbaOfColor color in
217 | primIO $
prim_arc ren x y r g b a rad start end
221 | %foreign frgn "ellipse"
222 | prim_ellipse : AnyPtr
223 | -> Int -> Int -> Int -> Int
224 | -> Int -> Int -> Int -> Int
231 | ellipse : HasIO io => Renderer -> Coordinate
232 | -> (rx : Int) -> (ry : Int) -> Color
234 | ellipse (MkRenderer ren) (MkCoor x y) rx ry color
235 | = let (r,g,b,a) = rgbaOfColor color in
236 | primIO $
prim_ellipse ren x y rx ry r g b a
240 | %foreign frgn "filledEllipse"
241 | prim_filledEllipse : AnyPtr
242 | -> Int -> Int -> Int -> Int
243 | -> Int -> Int -> Int -> Int
250 | filledEllipse : HasIO io => Renderer -> Coordinate
251 | -> (rx : Int) -> (ry : Int) -> Color
253 | filledEllipse (MkRenderer ren) (MkCoor x y) rx ry color
254 | = let (r,g,b,a) = rgbaOfColor color in
255 | primIO $
prim_filledEllipse ren x y rx ry r g b a
259 | %foreign frgn "aaellipse"
260 | prim_aaellipse : AnyPtr
261 | -> Int -> Int -> Int -> Int
262 | -> Int -> Int -> Int -> Int
269 | aaellipse : HasIO io => Renderer -> Coordinate
270 | -> (rx : Int) -> (ry : Int) -> Color
272 | aaellipse (MkRenderer ren) (MkCoor x y) rx ry color
273 | = let (r,g,b,a) = rgbaOfColor color in
274 | primIO $
prim_aaellipse ren x y rx ry r g b a
278 | %foreign frgn "pie"
281 | -> Int -> Int -> Int -> Int
282 | -> Int -> Int -> Int
285 | %foreign frgn "filledPie"
286 | prim_filledPie : AnyPtr
288 | -> Int -> Int -> Int -> Int
289 | -> Int -> Int -> Int
297 | pie : HasIO io => Renderer -> Coordinate -> Color
298 | -> (rad : Int) -> (start : Int) -> (end : Int)
300 | pie (MkRenderer ren) (MkCoor x y) color rad start end
301 | = let (r,g,b,a) = rgbaOfColor color in
302 | primIO $
prim_pie ren x y r g b a rad start end
309 | filledPie : HasIO io => Renderer -> Coordinate -> Color
310 | -> (rad : Int) -> (start : Int) -> (end : Int)
312 | filledPie (MkRenderer ren) (MkCoor x y) color rad start end
313 | = let (r,g,b,a) = rgbaOfColor color in
314 | primIO $
prim_filledPie ren x y r g b a rad start end
319 | %foreign frgn "trigon"
320 | prim_trigon : AnyPtr
321 | -> Int -> Int -> Int -> Int -> Int -> Int
322 | -> Int -> Int -> Int -> Int
327 | trigon : HasIO io => Renderer -> Coordinate -> Coordinate -> Coordinate -> Color -> io ()
328 | trigon (MkRenderer ren) (MkCoor x1 y1) (MkCoor x2 y2) (MkCoor x3 y3) color
329 | = let (r,g,b,a) = rgbaOfColor color in
330 | primIO $
prim_trigon ren x1 y1 x2 y2 x3 y3 r g b a
334 | %foreign frgn "filledTrigon"
335 | prim_filledTrigon : AnyPtr
336 | -> Int -> Int -> Int -> Int -> Int -> Int
337 | -> Int -> Int -> Int -> Int
342 | filledTrigon : HasIO io => Renderer -> Coordinate -> Coordinate -> Coordinate -> Color -> io ()
343 | filledTrigon (MkRenderer ren) (MkCoor x1 y1) (MkCoor x2 y2) (MkCoor x3 y3) color
344 | = let (r,g,b,a) = rgbaOfColor color in
345 | primIO $
prim_filledTrigon ren x1 y1 x2 y2 x3 y3 r g b a
349 | %foreign frgn "aatrigon"
350 | prim_aatrigon : AnyPtr
351 | -> Int -> Int -> Int -> Int -> Int -> Int
352 | -> Int -> Int -> Int -> Int
357 | aatrigon : HasIO io => Renderer -> Coordinate -> Coordinate -> Coordinate -> Color -> io ()
358 | aatrigon (MkRenderer ren) (MkCoor x1 y1) (MkCoor x2 y2) (MkCoor x3 y3) color
359 | = let (r,g,b,a) = rgbaOfColor color in
360 | primIO $
prim_aatrigon ren x1 y1 x2 y2 x3 y3 r g b a