skia_safe::svg

Type Alias Dom

Source
pub type Dom = RCHandle<SkSVGDOM>;

Aliased Type§

struct Dom(/* private fields */);

Implementations§

Source§

impl Dom

This type represents an SVG as a node-based data structure.

To convert an SVG to a Dom, a NativeResourceProvider is required.

§Creating a Resource Provider

To create a resource provider, a crate::FontMgr is required at a minimum.

When you pass a crate::FontMgr as the resource provider, a crate::resources::LocalResourceProvider is created behind the scenes. This provider, in addition to supporting typefaces, also adds support for data: URLs.

§Supporting External Resources

To support http:// or https:// external resources, enable the ureq feature and create a crate::resources::UReqResourceProvider.

§Custom Resource Providers

If you need more customization, you can implement the trait crate::resources::ResourceProvider.

Source

pub fn read<R: Read>( reader: R, resource_provider: impl Into<NativeResourceProvider>, ) -> Result<Self, LoadError>

Source

pub fn from_str( svg: impl AsRef<str>, resource_provider: impl Into<NativeResourceProvider>, ) -> Result<Self, LoadError>

Source

pub fn from_bytes( svg: &[u8], resource_provider: impl Into<NativeResourceProvider>, ) -> Result<Self, LoadError>

Source

pub fn root(&self) -> Svg

Source

pub fn render(&self, canvas: &Canvas)

Source

pub fn set_container_size(&mut self, size: impl Into<Size>)

Trait Implementations§

Source§

impl Debug for Dom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more