Wednesday, 29 April 2020

Dashed Lines

Omber now has support for dashed lines. I've included a few basic types of dashes that can be chosen from, but it's fairly easy to add more types if you need more. Just let me know.



Since Omber is intended for drawing organic vector shapes with subtle shading, it's a little odd for me to add support for dashed lines. I try to use Omber for general vector art tasks, and although it's not perfect, it usually works fine for most tasks. One area that I've had trouble using Omber for is in drawing technical diagrams. With technical diagrams, you just sometimes need to use dashed lines for things. I've tried using colored lined or gray lines or semi-transparent lines, but it's just not the same. And I don't have the patience to draw each of those dashes individually. Some of Omber's icons also make use of dashes, so dash support is also necessary if I want to be able to use Omber to make all of Omber's art (this sort of bootstrapping or self-hosting tools is very pleasing to computer people). So I've finally added support for dashed lines.

Adding support for dashed lines was trickier than I originally thought. I was originally planning on implementing support for it using shaders, But when I examined SVG and various vector art tools, I realized that they added endcaps to their dashes, which means each dash is rendered as a separate line. I wasn't too keen on this initially because it seemed slow and it limits how small your dashes can be since even the smallest dash will have two big endcaps on the end. But I decided compatibility and consistency were important here, so I decided to follow the approach used by other programs. This required me to rewrite my line rendering code to be much faster to be able handle drawing all the lines. Fortunately, I was planning on doing that anyway, so that I could use Omber for large technical drawings with lots of lines. I then encountered a problem with the fact that Omber's lines can have differing widths along their lengths. This is an issue that other tools don't have to deal with. In order to look good, the dashes should scale along with the width of line. This was unexpectedly tricky, requiring me to use integrals and other calculus to render the line properly. The result can be seen above. I think it looks good.

Note: New versions of Omber supporting dashed lines will be released soon for Windows, web, and Android. Unfortunately, new releases for Mac and iOS will be delayed. I need access to a Mac to make new releases for those platforms, but I don't have one available to me during the lockdown.


No comments:

Post a comment