[librsvg] property_bag.rs: New function transform_or_none() to parse transformation matrixes
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] property_bag.rs: New function transform_or_none() to parse transformation matrixes
- Date: Mon, 22 May 2017 13:04:36 +0000 (UTC)
commit 24d736b58569b4af756f0613c8785e418bc4b65d
Author: Federico Mena Quintero <federico gnome org>
Date: Mon May 22 07:49:55 2017 -0500
property_bag.rs: New function transform_or_none() to parse transformation matrixes
rust/src/property_bag.rs | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/rust/src/property_bag.rs b/rust/src/property_bag.rs
index 87d432c..4fa07a1 100644
--- a/rust/src/property_bag.rs
+++ b/rust/src/property_bag.rs
@@ -4,10 +4,13 @@ extern crate glib;
use std::str::FromStr;
use self::glib::translate::*;
+use ::cairo;
+use ::cairo::MatrixTrait;
use error::*;
use length::*;
use parsers::ParseError;
+use transform::*;
pub enum RsvgPropertyBag {}
@@ -105,3 +108,13 @@ pub fn parse_or_value<T> (pbag: *const RsvgPropertyBag, key: &'static str, value
Err (e) => Err (e)
}
}
+
+pub fn transform_or_none (pbag: *const RsvgPropertyBag, key: &'static str) -> Result <Option<cairo::Matrix>,
NodeError> {
+ if let Some (s) = lookup (pbag, key) {
+ parse_transform (&s)
+ .map (|v| Some (v))
+ .map_err (|e| NodeError::attribute_error (key, e))
+ } else {
+ Ok (None)
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]