[librsvg/librsvg-2.44] ViewParams: new struct to hold values required for Length normalization
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.44] ViewParams: new struct to hold values required for Length normalization
- Date: Fri, 21 Sep 2018 17:37:50 +0000 (UTC)
commit 25228a7b0a4e356765521b9331500ca8cdaf0dff
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Sep 3 13:38:31 2018 -0500
ViewParams: new struct to hold values required for Length normalization
We'll decouple Length from DrawingCtx with this.
rsvg_internals/src/drawing_ctx.rs | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 2267a7ff..954181b1 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -39,6 +39,14 @@ use tree::{RsvgTree, Tree};
use unitinterval::UnitInterval;
use viewbox::ViewBox;
+/// Holds values that are required to normalize `Length` values to a current viewport.
+pub struct ViewParams {
+ pub dpi_x: f64,
+ pub dpi_y: f64,
+ pub view_box_width: f64,
+ pub view_box_height: f64,
+}
+
pub enum RsvgDrawingCtx {}
pub struct DrawingCtx<'a> {
@@ -171,6 +179,15 @@ impl<'a> DrawingCtx<'a> {
}
}
+ pub fn get_view_params(&self) -> ViewParams {
+ ViewParams {
+ dpi_x: self.dpi_x,
+ dpi_y: self.dpi_y,
+ view_box_width: self.vb.0.width,
+ view_box_height: self.vb.0.height,
+ }
+ }
+
pub fn get_dpi(&self) -> (f64, f64) {
(self.dpi_x, self.dpi_y)
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]