[librsvg/wip/dimensions-api: 9/11] RsvgUnit/RsvgLength - New public types
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/wip/dimensions-api: 9/11] RsvgUnit/RsvgLength - New public types
- Date: Fri, 8 Feb 2019 01:38:41 +0000 (UTC)
commit 9c4fb9dcf6b2a8dd44a39b3bac54eaa2e3c185cb
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Feb 7 16:44:38 2019 -0600
RsvgUnit/RsvgLength - New public types
We will return these from an API to get an SVG's intrinsic dimensions.
librsvg/rsvg.h | 17 +++++++++++++++++
rsvg_internals/src/length.rs | 5 +++++
2 files changed, 22 insertions(+)
---
diff --git a/librsvg/rsvg.h b/librsvg/rsvg.h
index cfb694a1..4232569d 100644
--- a/librsvg/rsvg.h
+++ b/librsvg/rsvg.h
@@ -204,6 +204,23 @@ gboolean rsvg_handle_get_geometry_sub (RsvgHandle *handle,
gboolean rsvg_handle_has_sub (RsvgHandle *handle, const char *id);
+typedef enum {
+ RSVG_UNIT_PERCENT,
+ RSVG_UNIT_PX,
+ RSVG_UNIT_EM,
+ RSVG_UNIT_EX,
+ RSVG_UNIT_IN,
+ RSVG_UNIT_CM,
+ RSVG_UNIT_MM,
+ RSVG_UNIT_PT,
+ RSVG_UNIT_PC
+} RsvgUnit;
+
+typedef struct {
+ double length;
+ RsvgUnit unit;
+} RsvgLength;
+
/* GIO APIs */
/**
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index 78d75a40..e41f4189 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -7,7 +7,10 @@ use parsers::Parse;
use parsers::ParseError;
use properties::ComputedValues;
+// Keep this in sync with rsvg.h:RsvgUnit
+
/// Units for length values
+#[repr(C)]
#[derive(Debug, PartialEq, Copy, Clone)]
pub enum LengthUnit {
/// `1.0` means 100%
@@ -173,6 +176,8 @@ define_length_type!(LengthVertical, LengthDir::Vertical);
/// against the current viewport's width and height.
define_length_type!(LengthBoth, LengthDir::Both);
+// Keep this in sync with rsvg.h:RsvgLength
+#[repr(C)]
#[derive(Debug, PartialEq, Copy, Clone)]
struct Length {
pub length: f64,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]