Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ViewBox transform #8

Merged
merged 5 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ Subheadings to categorize changes are `added, changed, deprecated, removed, fixe

## Unreleased

### changed
simbleau marked this conversation as resolved.
Show resolved Hide resolved

- Updated `usvg` to 0.41

### fixed

- The image viewBox is now properly translated

## 0.1 (2024-03-11)

- Initial release
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ fn render_tree_impl<F: FnMut(&mut Scene, &usvg::Node) -> Result<(), E>, E>(
ts: &usvg::Transform,
error_handler: &mut F,
) -> Result<(), E> {
let ts = &ts.pre_concat(view_box.to_transform(svg.size()));
let transform = to_affine(ts);
scene.push_layer(
BlendMode {
Expand All @@ -101,6 +102,7 @@ fn render_tree_impl<F: FnMut(&mut Scene, &usvg::Node) -> Result<(), E>, E>(
);
let (view_box_transform, clip) =
geom::view_box_to_transform_with_clip(view_box, svg.size().to_int_size());
let view_box_transform = view_box_transform.pre_concat(view_box.to_transform(svg.size()));
if let Some(clip) = clip {
scene.push_layer(
BlendMode {
Expand Down