[librsvg/wip/rust-api: 5/11] CairoRenderer: add get_dimensions() method
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/wip/rust-api: 5/11] CairoRenderer: add get_dimensions() method
- Date: Sat, 16 Feb 2019 01:34:50 +0000 (UTC)
commit 648fcc8b37b238966a499b7c7f32941f523058c9
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Feb 13 16:38:10 2019 -0600
CairoRenderer: add get_dimensions() method
This will go away eventually with the dimensions-api branch, but for
now this lets us start replacing the high-level tests with Rust.
librsvg_crate/src/lib.rs | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/librsvg_crate/src/lib.rs b/librsvg_crate/src/lib.rs
index f457e221..48f6e8d4 100644
--- a/librsvg_crate/src/lib.rs
+++ b/librsvg_crate/src/lib.rs
@@ -114,6 +114,11 @@ impl<'a> CairoRenderer<'a> {
self.dpi = Dpi::new(dpi_x, dpi_y);
}
+ pub fn get_dimensions(&self) -> Result<(i32, i32), RenderingError> {
+ self.handle.0.get_dimensions()
+ .map(|dimensions| (dimensions.width, dimensions.height))
+ }
+
pub fn render(&self, cr: &cairo::Context) -> Result<(), RenderingError> {
self.handle.0.render_cairo_sub(cr, None)
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]