pub struct SvgAsset {
pub view_box: Rect,
pub tree: Arc<VectorTree>,
/* private fields */
}Expand description
Immutable SVG viewport and semantic content. Parser coordinates are f32 (usvg); converted geometry/authoring matrices are retained as f64.
Fields§
§view_box: RectAuthored viewBox, or the intrinsic viewport when omitted.
tree: Arc<VectorTree>Canonical viewport-normalized content with selection IDs.
Implementations§
Source§impl SvgAsset
impl SvgAsset
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Parses without system discovery, files, scripts or external resources.
Sourcepub fn from_bytes_with_fonts(bytes: &[u8], fonts: &FontLibrary) -> Result<Self>
pub fn from_bytes_with_fonts(bytes: &[u8], fonts: &FontLibrary) -> Result<Self>
Parses using the same immutable font database as paragraph text.
Sourcepub fn diagnostics(&self) -> &[SvgDiagnostic]
pub fn diagnostics(&self) -> &[SvgDiagnostic]
Unsupported filter resources skipped as a whole, with retained reasons.
Trait Implementations§
Source§impl Asset for SvgAsset
impl Asset for SvgAsset
Source§const KIND: &'static str = "svg"
const KIND: &'static str = "svg"
Human-readable resource category retained by load diagnostics.
Source§fn decode(bytes: &[u8], context: &LoadContext) -> Result<Self>
fn decode(bytes: &[u8], context: &LoadContext) -> Result<Self>
Decodes bounded input without requiring a rendering device.
Implementations must be deterministic for these bytes/context; recursive
resource dependency graphs are not a supported decoder contract.
Source§fn retained_bytes(&self) -> usize
fn retained_bytes(&self) -> usize
Logical decoded payload charge; custom heap-owning assets should override.
At least the encoded input length is charged regardless of this value.
Auto Trait Implementations§
impl !RefUnwindSafe for SvgAsset
impl !UnwindSafe for SvgAsset
impl Forget for SvgAsset
impl Freeze for SvgAsset
impl Move for SvgAsset
impl Send for SvgAsset
impl Sync for SvgAsset
impl Unpin for SvgAsset
impl UnsafeUnpin for SvgAsset
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more