Weekend hacking

Hi!

Here is code I played with yesterday. It is a bit ugly but I hope, it can help somehow.

Images are clickable.

Some comments:

- I am not sure State is a right thing to use here

- Transparency seems to work
![2013-03-31-200919_1920x1080_scrot](https://f.cloud.github.com/assets/347050/321996/37678eee-9a1f-11e2-96d2-e14aa34c40ea.png)
![2013-03-31-200721_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322005/4a713972-9a1f-11e2-95ff-c9a2153e0a74.png)
![2013-03-31-200820_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322015/4bfb7e88-9a1f-11e2-804b-2a4f5ec7739a.png)
![2013-03-31-200744_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322000/4a00ceb2-9a1f-11e2-8269-1b23dfa476fc.png)

- For concave polygons, self-intersections, clipping and fill rules I use GLU tesselate. For most cases it works but sometimes I get wrong results. Example:

``` haskell
{-# LANGUAGE NoMonomorphismRestriction #-}
import Diagrams.Prelude
import Diagrams.Backend.OpenGL.CmdLine

main :: IO ()
main = defaultMain example

example = square 3
        # rotateBy (1/100000) -- If I comment this line I see strange bugs.
                              -- Some triangles are not clipped
        # fc green
        # lw 0.05
        # clipBy (square 3.2 # rotateBy (1/10))
```

![2013-03-31-200732_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322004/4a467bc4-9a1f-11e2-97f4-cf21357e1295.png)
![2013-03-31-200657_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322007/4a8ed3f6-9a1f-11e2-9958-cc4d0ebe8a0f.png)
![2013-03-31-200621_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322011/4b88d766-9a1f-11e2-8faa-3c77484facfe.png)
![2013-03-31-200633_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322008/4ac76b80-9a1f-11e2-8a7a-bfae9753976d.png)

- Spline ends is not correct. Horizontal and vertical lines in the center of the next picture are not orthogonal.
![2013-03-31-200855_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322001/4a2735e8-9a1f-11e2-8cea-1f34a83f24fd.png)
![2013-03-31-200534_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322012/4baf58f0-9a1f-11e2-8341-a1ecf225b1a8.png)

- Caps, joins and dashes are work but code needs reviewing and rewriting
![2013-03-31-200808_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322014/4bdb4b68-9a1f-11e2-8db0-c6e41cfdc160.png)
![2013-03-31-200558_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322009/4b16c64e-9a1f-11e2-8786-688515aff898.png)

- some more pictures

![2013-03-31-200756_1920x1080_scrot](https://f.cloud.github.com/assets/347050/321999/49d7c15c-9a1f-11e2-8463-299184f4c934.png)
![2013-03-31-200843_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322002/4a28f202-9a1f-11e2-8ef9-56074632936c.png)
![2013-03-31-200832_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322003/4a2f28e8-9a1f-11e2-8bc0-f5fc5a0416eb.png)
![2013-03-31-200709_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322006/4a74847e-9a1f-11e2-8e01-1eec58e482cf.png)
![2013-03-31-200907_1920x1080_scrot](https://f.cloud.github.com/assets/347050/321998/49b0c444-9a1f-11e2-9937-d0d6caf4f757.png)
![2013-03-31-200645_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322010/4b6f6c72-9a1f-11e2-94f7-7fcdda38b997.png)
![2013-03-31-200610_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322013/4bb070a0-9a1f-11e2-994a-790bc4423c57.png)
![2013-03-31-200546_1920x1080_scrot](https://f.cloud.github.com/assets/347050/322016/4c369310-9a1f-11e2-96c7-2cc793a2f4ba.png)

Please feel free to ask questions, correct, criticize. Sorry, code is not well commented.