mirror of
https://github.com/typst/typst
synced 2025-08-02 01:07:55 +08:00
Add support for group clips
This commit is contained in:
parent
ad19f7c584
commit
de889d9c13
@ -235,8 +235,26 @@ pub fn handle_group(
|
||||
fc.push();
|
||||
fc.state_mut().transform(group.transform);
|
||||
|
||||
let clip_path = group
|
||||
.clip_path
|
||||
.as_ref()
|
||||
.and_then(|p| {
|
||||
let mut builder = PathBuilder::new();
|
||||
convert_path(p, &mut builder);
|
||||
builder.finish()
|
||||
})
|
||||
.and_then(|p| p.transform(fc.state().transform.as_krilla()));
|
||||
|
||||
if let Some(clip_path) = &clip_path {
|
||||
surface.push_clip_path(clip_path, &krilla::path::FillRule::NonZero);
|
||||
}
|
||||
|
||||
process_frame(fc, &group.frame, None, surface, context);
|
||||
|
||||
if clip_path.is_some() {
|
||||
surface.pop();
|
||||
}
|
||||
|
||||
fc.pop();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user