phoboslab/Ejecta — pull request #16 by Tharit (2012-10-04 14:40:10+00:00)
Title: Bevel line joins

I've implemented `bevel` lineJoins. I tried to fit them into the current implementation without any modifications to the rest of the code or introducing any additional variables. For that purpose, I'm using some approximizations for previous/next line segments..

The algorithm is based on the spec, chapter `4.8.11.1.4 Line styles`. It can also be used for the `round` lineJoin until that is implemented. Basically, round joins would just require us to generate some more triangles based on the calculations added for bevels.

I added a new method `pushTriX` to the context object to draw single triangles. Texture coordinates are fixed right now, but should probably be moved to method parameters.

Also, I seperated the `addMiter` flag from `subPathIsClosed` - because for caps and the bevel generation, this flag also needs to be checked; currently it would always be NO when miters are not used.

Here's an example of how it looks (rectangles are drawn with different winding directions):
![image](http://f.cl.ly/items/3B0C240B3o0A250g193F/Screen%20Shot%202012-10-04%20at%203.57.03%20PM.png)