@@ -1,8 +1,9 @@
2module Graphics.Collage where
2module Graphics.Collage where
5+import Native.Utils (toFloat)
4import Either
6import Either
5−import Graphics.Geometry
6import Native.Matrix2D as Matrix
7import Native.Matrix2D as Matrix
7import Native.Graphics.Collage as N
8import Native.Graphics.Collage as N
8import Graphics.Element
9import Graphics.Element
@@ -96,3 +97,39 @@ moveX x f = { f | x <- f.x + x }
96moveY y f = { f | y <- f.y + y }
97moveY y f = { f | y <- f.y + y }
98collage : Int -> Int -> [Form] -> Element
99collage : Int -> Int -> [Form] -> Element
102+type Path = [(Float,Float)]
104+path : [(Number a,Number a)] -> Path
107+segment : (Number a,Number a) -> (Number a,Number a) -> Path
108+segment p1 p2 = [p1,p2]
110+type Shape = [(Float,Float)]
112+polygon : [(Number a,Number a)] -> Shape
113+polygon points = points
115+rect : Number a -> Number a -> Shape
116+rect w h = [ (0-w/2,0-h/2), (0-w/2,h/2), (w/2,h/2), (w/2,0-h/2) ]
118+oval : Number a -> Number a -> Shape
124+ f i = (hw * Math.cos (t*i), hh * Math.sin (t*i))
127+circle : Number a -> Shape
128+circle r = oval (2*r) (2*r)
130+ngon : Int -> Number a -> Shape
134+ f i = ( r * Math.cos (t*i), r * Math.sin (t*i) )