Added hairline support to the stroke style panel.
Adds hairline support to the stroke style panel.
Demonstration: https://youtu.be/bNl8OiYRKVo
Some notes:
- I also have a PR for adding hairlines to cairo submitted, here: https://gitlab.freedesktop.org/cairo/cairo/merge_requests/21 (that one could use some love too!)
- The cairo patch is necessary if you want to save your hairlines to PDF or send them to your printer/laser cutter/whatever. If you just want to make SVGs and PNGs, you don't need the cairo patch.
- I've disabled all the stroke style settings that don't make sense for hairlines: dashes and markers are scaled by the stroke width, which is logically zero units wide, so that doesn't work, and corners and caps don't really make sense when hairlines are always rendered at the device's smallest resolution.
- To save hairlines in .svg files, I've added an
-inkscape-stroke: hairline
property. In order to make sure these files still look reasonable when opened in other software, I added a backup, so it's always encoded asstroke-width: 1px; vector-effect: non-scaling-stroke; -inkscape-stroke: hairline
. - Theoretically, a stroke width of 1px and a filter-effect of non-scaling-stroke would do a reasonable job of simulating a hairline when viewing SVGs in other software on pixel-based devices, but I decided to be conservative for now, lest that interfere with people who are intentionally using filter-effect or non-scaling-stroke for something else. I figured it would be good to get some feedback on the basic implementation first.
Here's the spec for the new -inkscape-stroke
property:
Inkscape Stroke Extensions
This property houses any non-standard Inkscape specific extensions to the stroke
property. Currently it's only used for defining hairlines.
Name: | -inkscape-stroke |
Value: | none | hairline |
Initial: | none |
Applies to: | graphics elements |
Inherited: | no |
Percentages: | N/A |
Media: | visual |
Computed value: | as specified |
Animation type: | not animatable |
none
Specifies that no vector effect shall be applied, i.e. the default rendering behaviour from SVG 1.1 is used.
hairline
Specifies that the stroke is always drawn with a visual width of 1 device unit, but has a zero-width logical size. For compatibility with other renderers, this should always be accompanied with stroke-width: 1px; vector-effect: non-scaling-stroke
.
Edited by Rick Yorgason