[librsvg] rsvg_state_get_current_color(): Expose to Rust



commit 37479d8adfee8675a0c308af6bf54260418b21b2
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon May 29 19:17:38 2017 -0500

    rsvg_state_get_current_color(): Expose to Rust

 rsvg-styles.c           |   18 ++++++++++++++----
 rsvg-styles.h           |    3 +++
 rust/src/drawing_ctx.rs |    7 +++++++
 3 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/rsvg-styles.c b/rsvg-styles.c
index e4bbf8c..dfe4b0d 100644
--- a/rsvg-styles.c
+++ b/rsvg-styles.c
@@ -1689,22 +1689,26 @@ rsvg_state_reconstruct (RsvgState *state, RsvgNode *current)
     rsvg_state_inherit (state, rsvg_node_get_state (current));
 }
 
-gboolean rsvg_state_is_overflow (RsvgState *state)
+gboolean
+rsvg_state_is_overflow (RsvgState *state)
 {
     return state->overflow;
 }
 
-gboolean rsvg_state_has_overflow (RsvgState *state)
+gboolean
+rsvg_state_has_overflow (RsvgState *state)
 {
     return state->has_overflow;
 }
 
-gboolean rsvg_state_get_cond_true (RsvgState *state)
+gboolean
+rsvg_state_get_cond_true (RsvgState *state)
 {
     return state->cond_true;
 }
 
-RsvgCssColorSpec *rsvg_state_get_stop_color (RsvgState *state)
+RsvgCssColorSpec *
+rsvg_state_get_stop_color (RsvgState *state)
 {
     if (state->has_stop_color) {
         return &state->stop_color;
@@ -1712,3 +1716,9 @@ RsvgCssColorSpec *rsvg_state_get_stop_color (RsvgState *state)
         return NULL;
     }
 }
+
+guint32
+rsvg_state_get_current_color (RsvgState *state)
+{
+    return state->current_color;
+}
diff --git a/rsvg-styles.h b/rsvg-styles.h
index 6dfab49..320d383 100644
--- a/rsvg-styles.h
+++ b/rsvg-styles.h
@@ -253,6 +253,9 @@ gboolean rsvg_state_get_cond_true (RsvgState *state);
 G_GNUC_INTERNAL
 RsvgCssColorSpec *rsvg_state_get_stop_color (RsvgState *state);
 
+G_GNUC_INTERNAL
+guint32 rsvg_state_get_current_color (RsvgState *state);
+
 G_END_DECLS
 
 #endif                          /* RSVG_STYLES_H */
diff --git a/rust/src/drawing_ctx.rs b/rust/src/drawing_ctx.rs
index 5c6d40a..f07d436 100644
--- a/rust/src/drawing_ctx.rs
+++ b/rust/src/drawing_ctx.rs
@@ -64,6 +64,7 @@ extern "C" {
     fn rsvg_state_has_overflow (state: *const RsvgState) -> glib_sys::gboolean;
     fn rsvg_state_get_cond_true (state: *const RsvgState) -> glib_sys::gboolean;
     fn rsvg_state_get_stop_color (state: *const RsvgState) -> *const ColorSpec;
+    fn rsvg_state_get_current_color (state: *const RsvgState) -> u32;
 
     fn rsvg_state_push (draw_ctx: *const RsvgDrawingCtx);
     fn rsvg_state_pop (draw_ctx: *const RsvgDrawingCtx);
@@ -246,3 +247,9 @@ pub fn state_get_stop_color (state: *const RsvgState) -> Option<ColorSpec> {
         }
     }
 }
+
+pub fn state_get_current_color (state: *const RsvgState) -> u32 {
+    unsafe {
+        rsvg_state_get_current_color (state)
+    }
+}


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