Skip to content

Commit cc8cf42

Browse files
use resvg to display svg.
1 parent 3790463 commit cc8cf42

File tree

3 files changed

+133
-504
lines changed

3 files changed

+133
-504
lines changed

druid/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples=examples"]
2424
default = ["gtk"]
2525
gtk = ["druid-shell/gtk"]
2626
image = ["druid-shell/image"]
27-
svg = ["usvg"]
27+
svg = ["usvg", "resvg", "tiny-skia"]
2828
x11 = ["druid-shell/x11"]
2929
crochet = []
3030
serde = ["im/serde", "druid-shell/serde"]
@@ -70,7 +70,9 @@ instant = { version = "0.1.6", features = ["wasm-bindgen"] }
7070
# Optional dependencies
7171
chrono = { version = "0.4.19", optional = true }
7272
im = { version = "15.0.0", optional = true }
73-
usvg = { version = "0.14.1", optional = true }
73+
resvg = { version = "0.19.0", optional = true }
74+
usvg = { version = "0.19.0", optional = true }
75+
tiny-skia = { version = "0.6.1", optional = true }
7476

7577
[target.'cfg(target_arch="wasm32")'.dependencies]
7678
tracing-wasm = { version = "0.2.0" }

druid/examples/svg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn ui_builder() -> impl Widget<u32> {
4747
let mut col = Flex::column();
4848

4949
col.add_flex_child(Svg::new(tiger_svg.clone()).fix_width(60.0).center(), 1.0);
50-
col.add_flex_child(Svg::new(tiger_svg.clone()).fill_mode(FillStrat::Fill), 1.0);
50+
col.add_flex_child(Svg::new(tiger_svg.clone()), 1.0);
5151
col.add_flex_child(Svg::new(tiger_svg), 1.0);
5252
col.debug_paint_layout()
5353
}

0 commit comments

Comments
 (0)