[librsvg: 5/7] transform.rs - reorder a bit; improve toplevel docs




commit 630f6e1e801860157879a47e941f8034d619369a
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Aug 31 19:10:33 2021 -0500

    transform.rs - reorder a bit; improve toplevel docs
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/582>

 src/transform.rs | 39 +++++++++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 14 deletions(-)
---
diff --git a/src/transform.rs b/src/transform.rs
index 634b8d1a..ed7c3d07 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -1,8 +1,16 @@
-//! Handling of `transform` values.
+//! Handling of transform values.
 //!
-//! This module handles `transform` values [per the SVG specification][spec].
+//! This module contains the following:
 //!
-//! [spec]:  https://www.w3.org/TR/SVG11/coords.html#TransformAttribute and 
https://www.w3.org/TR/css-transforms-1/#transform-property
+//! * [`Transform`] to represent 2D transforms in general; it's just a matrix.
+//!
+//! * [`TransformProperty`] for the [`transform` property][prop] in SVG2/CSS3.
+//!
+//! * [`Transform`] also handles the [`transform` attribute][attr] in SVG1.1, which has a different
+//! grammar than the `transform` property from SVG2.
+//!
+//! [prop]: https://www.w3.org/TR/css-transforms-1/#transform-property
+//! [attr]: https://www.w3.org/TR/SVG11/coords.html#TransformAttribute and 
https://www.w3.org/TR/css-transforms-1/#transform-property
 
 use cssparser::{Parser, Token};
 
@@ -14,7 +22,20 @@ use crate::properties::ComputedValues;
 use crate::property_macros::Property;
 use crate::rect::Rect;
 
-// https://www.w3.org/TR/css-transforms-1/#transform-property
+/// A 2D transformation matrix.
+#[derive(Debug, Copy, Clone, PartialEq)]
+pub struct Transform {
+    pub xx: f64,
+    pub yx: f64,
+    pub xy: f64,
+    pub yy: f64,
+    pub x0: f64,
+    pub y0: f64,
+}
+
+/// The `transform` property from the CSS Transforms Module Level 1.
+///
+/// https://www.w3.org/TR/css-transforms-1/#transform-property
 #[derive(Debug, Clone, PartialEq)]
 pub enum TransformProperty {
     None,
@@ -324,16 +345,6 @@ fn parse_prop_skew_y_args<'i>(
     })
 }
 
-#[derive(Debug, Copy, Clone, PartialEq)]
-pub struct Transform {
-    pub xx: f64,
-    pub yx: f64,
-    pub xy: f64,
-    pub yy: f64,
-    pub x0: f64,
-    pub y0: f64,
-}
-
 impl Transform {
     #[inline]
     pub fn new_unchecked(xx: f64, yx: f64, xy: f64, yy: f64, x0: f64, y0: f64) -> Self {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]