[librsvg] Docs for push_view_box()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Docs for push_view_box()
- Date: Wed, 12 Sep 2018 11:55:18 +0000 (UTC)
commit e475bb2e202836048e84b3b489f90ca278f90ff6
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Sep 5 11:12:02 2018 -0500
Docs for push_view_box()
rsvg_internals/src/drawing_ctx.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index d5049ca9..60a7ad92 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -43,6 +43,11 @@ use viewbox::ViewBox;
///
/// This struct is created by calling `DrawingCtx::push_view_box()` or
/// `DrawingCtx::get_view_params()`.
+///
+/// This struct holds the size of the current viewport in the user's coordinate system. A
+/// viewport pushed with `DrawingCtx::push_view_box()` will remain in place until the
+/// returned `ViewParams` is dropped; at that point, the `DrawingCtx` will resume using its
+/// previous viewport.
pub struct ViewParams {
dpi_x: f64,
dpi_y: f64,
@@ -221,6 +226,7 @@ impl<'a> DrawingCtx<'a> {
}
}
+ /// Gets the viewport that was last pushed with `push_view_box()`.
pub fn get_view_params(&self) -> ViewParams {
let view_box_stack = self.view_box_stack.borrow();
let last = view_box_stack.len() - 1;
@@ -235,6 +241,13 @@ impl<'a> DrawingCtx<'a> {
}
}
+ /// Pushes a viewport size for normalizing `Length` values.
+ ///
+ /// You should pass the returned `ViewParams` to all subsequent `Length.normalize()`
+ /// calls that correspond to this viewport.
+ ///
+ /// The viewport will stay in place, and will be the one returned by
+ /// `get_view_params()`, until the returned `ViewParams` is dropped.
pub fn push_view_box(&self, width: f64, height: f64) -> ViewParams {
self.view_box_stack
.borrow_mut()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]