Expand description
Provides a way to resolve the href
attribute of the <image>
tag in the SVG for usvg
.
§Example
use usvg::Options;
use usvg_remote_resolvers::{HrefStringResolver, reqwest_blocking::BlockingReqwestResolver};
let resolver = BlockingReqwestResolver::default();
let mut options = Options::default();
resolver.set_into_options(&mut options);
let tree = usvg::Tree::from_str(
r#"<svg xmlns="http://www.w3.org/2000/svg">
<image href="https://example.com/sample.png" />
</svg>"#,
&options,
).unwrap();
let mut pixmap = resvg::tiny_skia::Pixmap::new(200, 200).unwrap();
resvg::render(
&tree,
resvg::tiny_skia::Transform::identity(),
&mut pixmap.as_mut(),
);
§Feature Flags
reqwest
: Enable thereqwest
resolver.reqwest_blocking
: Enable thereqwest_blocking
resolver.
Modules§
Structs§
- Default
Resolver - Resolver using
default_string_resolver
- Fallback
Resolver
Traits§
- Href
String Resolver - HrefStringResolver is a trait that is used to resolve the
href
attribute of the<image>
tag. It will be converted toImageHrefResolver
to be set in theOptions
.