mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-24 10:27:00 -06:00
M6: the open-subpath fixture covers stroke-first paint order
A third row in open_subpaths.svg: a filled and stroked path that is only 0.001 short stays one layer, and an open triangle with paint-order="stroke" puts its stroke layer under its fill layer.
This commit is contained in:
@@ -257,8 +257,11 @@ fn fills_close_open_subpaths() {
|
||||
let (fill, stroke) = (layer(&d, f, "stroked fill"), layer(&d, f, "stroked"));
|
||||
assert_eq!((loops(fill), fill.fills.len(), fill.strokes.len()), (2, 1, 0));
|
||||
assert_eq!((loops(stroke), stroke.fills.len(), stroke.strokes.len()), (0, 0, 1));
|
||||
// Only near-closed ends: one layer, closed, stroke and all.
|
||||
let near = layer(&d, f, "near");
|
||||
assert_eq!((loops(near), near.fills.len(), near.strokes.len()), (1, 1, 1));
|
||||
let order: Vec<&str> = d.node(f).unwrap().children.iter().filter_map(|c| d.node(*c)).map(|n| n.name.as_str()).collect();
|
||||
assert_eq!(order, ["filled", "stroked fill", "stroked"], "the fill paints first, as SVG paints fill then stroke");
|
||||
assert_eq!(order, ["filled", "stroked fill", "stroked", "near", "under", "under fill"], "paint order: fill then stroke, or the stroke first");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="80">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="120">
|
||||
<!-- Fill closes every subpath (SVG painting: "fill ... as if a closepath"). Top row, one filled
|
||||
path: closed with Z; back on its start without Z; 0.001 short of its start without Z (what
|
||||
PDF exports rounded to three decimals write); an open triangle. Bottom row, filled and
|
||||
stroked: 0.001 short (closed, stroke and all); an open triangle (stroked open). -->
|
||||
stroked: 0.001 short (closed, stroke and all); an open triangle (stroked open). Third row,
|
||||
filled and stroked: only 0.001 short (one layer); an open triangle with its stroke under
|
||||
the fill. -->
|
||||
<path id="filled" fill="#000000" d="M10 10h20v20h-20z M50 10h20v20h-20v-20 M90 10h20v20h-20v-19.999 M130 10h20v20"/>
|
||||
<path id="stroked" fill="#000000" stroke="#ff0000" stroke-width="2" d="M10 50h20v20h-20v-19.999 M130 50h20v20"/>
|
||||
<path id="near" fill="#000000" stroke="#ff0000" stroke-width="2" d="M50 90h20v20h-20v-19.999"/>
|
||||
<path id="under" fill="#000000" stroke="#ff0000" stroke-width="2" paint-order="stroke" d="M130 90h20v20"/>
|
||||
<!-- probe 20 20 #000000ff -->
|
||||
<!-- probe 60 20 #000000ff -->
|
||||
<!-- probe 100 20 #000000ff -->
|
||||
@@ -15,4 +19,10 @@
|
||||
<!-- probe 140 50 #ff0000ff -->
|
||||
<!-- probe 145 55 #000000ff -->
|
||||
<!-- probe 135 65 #00000000 -->
|
||||
<!-- probe 60 100 #000000ff -->
|
||||
<!-- probe 50 100 #ff0000ff -->
|
||||
<!-- probe 140 89 #ff0000ff -->
|
||||
<!-- probe 140 90 #000000ff -->
|
||||
<!-- probe 145 95 #000000ff -->
|
||||
<!-- probe 135 105 #00000000 -->
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.5 KiB |
Reference in New Issue
Block a user