Expand description
Main handle to an SVG document.
This is the main object in librsvg. It gets created with the from_stream
method
and then provides access to all the primitives needed to implement the public APIs.
Fields§
§session: Session
§document: Document
Implementations§
source§impl Handle
impl Handle
sourcepub fn from_stream(
session: Session,
load_options: Arc<LoadOptions>,
stream: &InputStream,
cancellable: Option<&Cancellable>
) -> Result<Handle, LoadingError>
pub fn from_stream(
session: Session,
load_options: Arc<LoadOptions>,
stream: &InputStream,
cancellable: Option<&Cancellable>
) -> Result<Handle, LoadingError>
Loads an SVG document into a Handle
.
sourcepub fn has_sub(&self, id: &str) -> Result<bool, RenderingError>
pub fn has_sub(&self, id: &str) -> Result<bool, RenderingError>
Queries whether a document has a certain element #foo
.
The id
must be an URL fragment identifier, i.e. something
like #element_id
.
sourcepub fn width_height_to_user(&self, dpi: Dpi) -> (f64, f64)
pub fn width_height_to_user(&self, dpi: Dpi) -> (f64, f64)
Normalizes the svg’s width/height properties with a 0-sized viewport
This assumes that if one of the properties is in percentage units, then its corresponding value will not be used. E.g. if width=100%, the caller will ignore the resulting width value.
fn get_node_or_root(
&self,
id: Option<&str>
) -> Result<Node<NodeData>, RenderingError>
fn geometry_for_layer(
&self,
node: Node<NodeData>,
viewport: Rect,
user_language: &UserLanguage,
dpi: Dpi,
is_testing: bool
) -> Result<(Rect, Rect), RenderingError>
pub fn get_geometry_for_layer(
&self,
id: Option<&str>,
viewport: &Rectangle,
user_language: &UserLanguage,
dpi: Dpi,
is_testing: bool
) -> Result<(Rectangle, Rectangle), RenderingError>
fn lookup_node(&self, id: &str) -> Result<Node<NodeData>, DefsLookupErrorKind>
pub fn render_document(
&self,
cr: &Context,
viewport: &Rectangle,
user_language: &UserLanguage,
dpi: Dpi,
is_testing: bool
) -> Result<(), RenderingError>
pub fn render_layer(
&self,
cr: &Context,
id: Option<&str>,
viewport: &Rectangle,
user_language: &UserLanguage,
dpi: Dpi,
is_testing: bool
) -> Result<(), RenderingError>
fn get_bbox_for_element(
&self,
node: &Node<NodeData>,
user_language: &UserLanguage,
dpi: Dpi,
is_testing: bool
) -> Result<BoundingBox, RenderingError>
sourcepub fn get_geometry_for_element(
&self,
id: Option<&str>,
user_language: &UserLanguage,
dpi: Dpi,
is_testing: bool
) -> Result<(Rectangle, Rectangle), RenderingError>
pub fn get_geometry_for_element(
&self,
id: Option<&str>,
user_language: &UserLanguage,
dpi: Dpi,
is_testing: bool
) -> Result<(Rectangle, Rectangle), RenderingError>
Returns (ink_rect, logical_rect)
pub fn render_element(
&self,
cr: &Context,
id: Option<&str>,
element_viewport: &Rectangle,
user_language: &UserLanguage,
dpi: Dpi,
is_testing: bool
) -> Result<(), RenderingError>
pub fn get_intrinsic_dimensions(&self) -> IntrinsicDimensions
pub fn set_stylesheet(&mut self, css: &str) -> Result<(), LoadingError>
Auto Trait Implementations§
impl !RefUnwindSafe for Handle
impl !Send for Handle
impl !Sync for Handle
impl Unpin for Handle
impl !UnwindSafe for Handle
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.