Open ikskuh opened 2 years ago
Even if user-configurable line caps / joins are not part of the standard, it would be very useful to have at least a defined default. AFAICT the spec currently does not say anything about how line caps and joins are supposed to be drawn, which makes it ambiguous. In particular it is unclear whether the default is a "butt" or "square" line cap.
The default right now is round
, and this is definitly missing in the spec
The example pictures for "draw lines" and "draw line strip" currently do not use round caps. The source SVG files do not have the line caps specified as part of the paths' style, so they default to "butt". In case line caps are configurable maybe it would be worth it using the same default as SVG just to avoid confusion?
Looking at the encoding of lines, this would require some restructuring of the encoding as we need at least one bit for round
or square
line endings. I don't think butt
is a visually pleasing line ending, but i'm considering adding all three.
What are some cases of butt
line endings?
For encoding, it would be possible to strip two bits off the line_width
unit field, as it doesn't make much sense to have a line thickness of 1/4th of the image.
Accepting this for now, let's see how hard an implementation of this is.
What are some cases of butt line endings?
Here's an example of something that you cannot easily represent without them. Left is with butt
ending, right is how it would look with square
ends.
You can easily map square
ends to butt
ends by extending the path tangentially by half the line width, but not the other way around. Without butt endings, any path with a thick stroke that has curvature near the ends has to be rendered into a filled outline instead.
Okay, so you say we should settle on butt
or round
? I'm okay with that!
Yeah, that sounds good to me. Implementing a square to butt mapper in something like an SVG converter should be straightforward.
Someone asked me if line caps aren't in TinyVG. We maybe should add them, but they could be emulated with some path element as well.