diff options
author | Federico Mena Quintero <federico@gnome.org> | 2018-03-15 19:05:45 -0600 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2018-03-16 10:45:30 -0600 |
commit | 3f7fdc48a1a6b6005dfe8ec7935e2a9648260296 (patch) | |
tree | 100172c819b405bbf208d1ae8fa35549d040c535 | |
parent | f7029fc3e5840214365e00262c350c4536bdc03a (diff) | |
download | librsvg-3f7fdc48a1a6b6005dfe8ec7935e2a9648260296.tar.gz |
state::get_fill() / get_fill_opacity() - Bind to Rust
-rw-r--r-- | librsvg/rsvg-styles.c | 12 | ||||
-rw-r--r-- | librsvg/rsvg-styles.h | 6 | ||||
-rw-r--r-- | rsvg_internals/src/state.rs | 18 |
3 files changed, 36 insertions, 0 deletions
diff --git a/librsvg/rsvg-styles.c b/librsvg/rsvg-styles.c index f31dfadf..419d8ae9 100644 --- a/librsvg/rsvg-styles.c +++ b/librsvg/rsvg-styles.c @@ -1967,6 +1967,18 @@ rsvg_state_get_clip_rule (RsvgState *state) return state->clip_rule; } +RsvgPaintServer * +rsvg_state_get_fill (RsvgState *state) +{ + return state->fill; +} + +guint8 +rsvg_state_get_fill_opacity (RsvgState *state) +{ + return state->fill_opacity; +} + cairo_fill_rule_t rsvg_state_get_fill_rule (RsvgState *state) { diff --git a/librsvg/rsvg-styles.h b/librsvg/rsvg-styles.h index 070d1ec5..b7031b31 100644 --- a/librsvg/rsvg-styles.h +++ b/librsvg/rsvg-styles.h @@ -308,6 +308,12 @@ G_GNUC_INTERNAL cairo_fill_rule_t rsvg_state_get_clip_rule (RsvgState *state); G_GNUC_INTERNAL +RsvgPaintServer *rsvg_state_get_fill (RsvgState *state); + +G_GNUC_INTERNAL +guint8 rsvg_state_get_fill_opacity (RsvgState *state); + +G_GNUC_INTERNAL cairo_fill_rule_t rsvg_state_get_fill_rule (RsvgState *state); G_GNUC_INTERNAL diff --git a/rsvg_internals/src/state.rs b/rsvg_internals/src/state.rs index 648ce08b..7ac2578f 100644 --- a/rsvg_internals/src/state.rs +++ b/rsvg_internals/src/state.rs @@ -82,6 +82,8 @@ extern "C" { fn rsvg_state_get_letter_spacing(state: *const RsvgState) -> RsvgLength; fn rsvg_state_get_font_decor(state: *const RsvgState) -> *const TextDecoration; fn rsvg_state_get_clip_rule(state: *const RsvgState) -> cairo::FillRule; + fn rsvg_state_get_fill(state: *const RsvgState) -> *const PaintServer; + fn rsvg_state_get_fill_opacity(state: *const RsvgState) -> u8; fn rsvg_state_get_fill_rule(state: *const RsvgState) -> cairo::FillRule; } @@ -264,6 +266,22 @@ pub fn get_clip_rule(state: *const RsvgState) -> cairo::FillRule { unsafe { rsvg_state_get_clip_rule(state) } } +pub fn get_fill<'a>(state: *const RsvgState) -> Option<&'a PaintServer> { + unsafe { + let ps = rsvg_state_get_fill(state); + + if ps.is_null() { + None + } else { + Some(&*ps) + } + } +} + +pub fn get_fill_opacity(state: *const RsvgState) -> u8 { + unsafe { rsvg_state_get_fill_opacity(state) } +} + pub fn get_fill_rule(state: *const RsvgState) -> cairo::FillRule { unsafe { rsvg_state_get_fill_rule(state) } } |