Add support for shape filling to whiskers#188
Open
abey79 wants to merge 12 commits into
Open
Conversation
This was referenced Jan 4, 2026
7268e0f to
c064346
Compare
d3d02ef to
6dfc072
Compare
c064346 to
953df45
Compare
de11ee0 to
b7e27df
Compare
953df45 to
69fbf67
Compare
763c3c0 to
4838e7a
Compare
ea243dc to
38d515f
Compare
69fbf67 to
a0db2dd
Compare
38d515f to
cad2568
Compare
a0db2dd to
10d677b
Compare
cad2568 to
22cacc2
Compare
10d677b to
69f7d5c
Compare
22cacc2 to
06a14cb
Compare
31300b2 to
77f7fdb
Compare
06a14cb to
5ef5e59
Compare
77f7fdb to
e77e60e
Compare
5ef5e59 to
53da09d
Compare
e77e60e to
60b6bfd
Compare
53da09d to
6c07a27
Compare
60b6bfd to
fbb909a
Compare
6c07a27 to
f856c2c
Compare
fbb909a to
e473904
Compare
f856c2c to
bb22373
Compare
- Removed target_layer field and set_layer() method
- Added stroke_layer: Option<LayerID> and fill_layer: Option<LayerID> fields
- Added style_stack: Vec<StyleState> for push/pop style
- Added LayerHandle struct with pen_width(), color(), name(), hatch_angle() methods
- Added routing methods: stroke_layer(), fill_layer(), stroke_only(), fill_only(), stroke_and_fill()
- Added style stack: push_style(), pop_style(), with_style()
- Updated add_path() to route to stroke/fill layers with hatching support
- Added 13 unit tests
e473904 to
2358c23
Compare
bb22373 to
0dd86f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR builds on the previous ones to introduce hatch fill support. This required refactoring the layer state handling, so we can have separate stroke and fill routing, replacing the single
set_layer()method.It also fixes per-path color/stroke_width defaults: paths now inherit from their layer instead of defaulting to
BLACK/1.0, which caused layer colors to be overridden (e.g. crescent strokes appearing black instead of the layer's CMY color inquadri_circle).Removed API
set_layer(layer_id)stroke_layer(Some(layer_id))color(c)override_color(c)for per-path overrides, orlayer(id).color(c)for layer defaultsstroke_width(w)override_stroke_width(w)for per-path overrides, orlayer(id).pen_width(w)for layer defaultsNew API
layer(id) -> LayerHandlestroke_layer(Option<LayerID>)Nonedisables)fill_layer(Option<LayerID>)Nonedisables)stroke_only(layer)fill_only(layer)stroke_and_fill(layer)override_color(c)override_stroke_width(w)clear_overrides()push_style()/pop_style()with_style(closure)New traits:
IntoBezPaths/IntoBezPathsToleranceThe
Draw::add_pathsignature now acceptsIntoBezPathsTolerance(plural) instead ofIntoBezPathTolerance. This preserves structural boundaries when converting multi-geometry types (e.g.geo::MultiPolygonyields oneBezPathper polygon), which is critical for correct per-shape hatching. Single-geometry types get a blanket impl wrapping the result in a one-elementVec, so existing code is unaffected.New example
fill_demo— demonstrates stroke/fill layer routing with a grid of shapes (circle, square, L-shape, polygon with holes) across three fill modes (none, horizontal, angled).Default behavior change
Paths now default to
None/Nonemetadata (inheriting color and stroke width from their layer viaresolve()). Previously,Sketch::new()set explicitBLACK/1.0on every path, which silently overrode layer settings.Migration guide
Setting color/pen width for a layer (most common case):
Switching colors mid-drawing (per-path overrides):
Fill (hatching):
This is part 6 of 6 in a stack made with GitButler:
IntoBezPathstrait #191PathandFlattenedPath#186.buffer()toPathandFlattenedPath#184