@@ -1,85 +0,0 @@
1−
2−module Graphics.Collage where
3−
4−import Either
5−import Graphics.LineStyle
6−import Geometry
7−
8−data Transform
9− = Rotate Float
10− | Move Float Float
11− | Scale Float Float
12− | Transform Float Float Float Float Float Float
13−
14−data Form = Form [Transform] BasicForm
15−
16−data FillStyle
17− = NoFill
18− | Solid Color
19− | Texture String
20− | Gradient Gradient
21−
22−data BasicForm
23− = FLine LineStyle Line
24− | FShape (Either LineStyle FillStyle) Shape
25− | FImage Int Int Int Int String
26− | FElement Element
27− | FGroup [Form]
28−
29−fill style shape = FShape (Right style) shape
30−
31−filled : Color -> Shape -> Form
32−filled color shape = fill (Solid color) shape
33−
34−textured : String -> Shape -> Form
35−textured src shape = fill (Texture src) shape
36−
37−gradient : Gradient -> Shape -> Form
38−gradient grad shape = fill (Gradient grad) shape
39−
40−outline style shape = FShape (Left style) shape
41−trace = FLine
42−
43−
44−linearGradient stops start end = setFillStyle (LinearGradient stops start end)
45−radialGradient stops innerP innerR outerP outerR =
46− setStyle (RadialGradient stops innerP innerR outerP outerR)
47−
48−plain = { width=1, cap=Butt, join=Miter, miterLimit=10,
49− fillStyle=...,
50− dashing=[], dashOffset=0 }
51−
52−solid c = Form [] . FLine c
53−dotted c = Form [] . FLine c
54−dashed c = Form [] . FLine c
55−lineStyle = Form [] . FLine
56−
57−
58−filled clr shp = Form [] (FShape shp)
59−outlined clr shp = Form [] (FShape shp)
60−customOutline pattern clr (Shape ps pos) =
61− Form [] (FShape (CustomOutline pattern) clr (Shape ps pos))
62−textured src (Shape ps pos) = Form [] (FShape (Textured src) black (Shape ps pos))
63−
64−fromLine = FLine
65−fromShape = FShape
66−fromElement = FElement
67−
68−sprite w h pos src = Form 0 1 pos (FImage w h src)
69−toForm pos e = Form 0 1 pos (FElement e)
70−
71−addTransform t (Form ts form) = Form (t:ts) form
72−
73−rotateRad rad = addTransform $ Rotate rad
74−rotateDeg deg = addTransform $ Rotate (pi * deg / 180)
75−rotate rot = addTransform $ Rotate (2 * pi * rot)
76−
77−scale s = addTransform (Scale s s)
78−scaleX s = addTransform (Scale s 1)
79−scaleY s = addTransform (Scale 1 s)
80−
81−move x y = addTransform (Move x y)
82−moveX x = addTransform (Move x 0)
83−moveY y = addTransform (Move 0 y)
84−
85−transform a b c d e f = addTransform (Transform a b c d e f)