Advanced Flash Line Drawing: Intro
One of the most basic and fundamental things to draw with code is a line - in terms of importance it is right up there with the pixel.
Line drawing in Flash is, on the whole, pretty darned fantastic. You get curves, lines, varying stroke widths and colours etc. all nicely anti-aliased with just a few commands thrown at the API. However, when it comes to pure quality and flexibility it has quite a few short comings, which is especially a problem when it comes to drawing interesting, varied, magical lines.
Here’s a few (to get the ball rolling) limitations with line drawing in the Flash drawing API.
1. Fractional stroke widths aren’t supported
Want a stroke width 0.234 points / pixels wide? Bad luck champ!
2. Anti-aliasing could be better
I have no references (anyone?) to the type of anti-aliasing that Flash does, perhaps as a guess it looks like some kind of an A-Buffer or just a basic super sampling algorithm, but whatever it is it could be a whole lot smoother.
3. Dotted lines aren’t supported in code
Easy to hack for straight lines but quite a bit harder for curved lines
4. Gradients on lines don’t follow curves
5. You can’t change stroke widths, colours, alpha etc. values smoothly along the length of a line
6. Brush strokes, texturing, sampling etc. aren’t supported
7. Line “edges” are always perfect and parallel
Thankfully all of this can be worked around with code (ahh, beautiful, powerful code) which I am going to go through in series to build up some really powerful line drawing code that a lot of nice effects can be achieved with.
If there are any things that you want covered or have seen done (journal article references are also good!) please let me know so that I can have a go at incorporating into this series.
