During these last years, this blog showed the development of my
2D drawing library called Maccala. I really passed through many problems and challenges since I started it more than four years ago.
Nowadays I have a very comprehensive, professional, powerful and robust library for 2D drawing, font rendering and vector based effects, but I knew it had a point to be solved: the polygon filling modes. Since its first days, the library had only the alternative filling mode. I always knew about this weakness, but I have let it behind, since its only mode always was enough to my needs until now.
Currently I'm developing a new sub-library especially to make typography effects. At this point, the lack of another filling mode became a barrier to creation of my new effects.
I'm (finally) implementing the winding filling mode in Maccala. Since it's more complex by nature, I'm taking a big care about performance, so I can draw using any filling mode with no (or very few) performance penalty.
If you don't know what I'm talking about, let's put it simple: the winding mode can be imperative when filling some kinds of polygons that have self-intersection. This kind of polygon is very common, mainly when you make some operations like polyline thickness widening.
Below there is a simple example. First I show a self-intersected polygon. Second I show the same polygon filled using the alternative mode. As you can see, a colateral effect of this technique is that, in this case, the polygon is not completely filled. Finally I show the winding mode applied to our polygon. It has the behavior we usually want in this situation: the polygon is totally filled.



Subscribe in a reader