rsvg_state_get_stop_color(): New helper function to expose state->stop_color to Rust

parent 2f469fe4
......@@ -1703,3 +1703,12 @@ gboolean rsvg_state_get_cond_true (RsvgState *state)
{
return state->cond_true;
}
RsvgCssColorSpec *rsvg_state_get_stop_color (RsvgState *state)
{
if (state->has_stop_color) {
return &state->stop_color;
} else {
return NULL;
}
}
......@@ -250,6 +250,9 @@ gboolean rsvg_state_has_overflow (RsvgState *state);
G_GNUC_INTERNAL
gboolean rsvg_state_get_cond_true (RsvgState *state);
G_GNUC_INTERNAL
RsvgCssColorSpec *rsvg_state_get_stop_color (RsvgState *state);
G_END_DECLS
#endif /* RSVG_STYLES_H */
......@@ -6,6 +6,7 @@ extern crate libc;
use self::glib::translate::*;
use color::*;
use node::RsvgNode;
use node::NodeType;
use path_builder::RsvgPathBuilder;
......@@ -62,6 +63,7 @@ extern "C" {
fn rsvg_state_is_overflow (state: *const RsvgState) -> glib_sys::gboolean;
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_push (draw_ctx: *const RsvgDrawingCtx);
fn rsvg_state_pop (draw_ctx: *const RsvgDrawingCtx);
......@@ -232,3 +234,15 @@ pub fn state_pop (draw_ctx: *const RsvgDrawingCtx) {
rsvg_state_pop (draw_ctx);
}
}
pub fn state_get_stop_color (state: *const RsvgState) -> Option<ColorSpec> {
unsafe {
let spec_ptr = rsvg_state_get_stop_color (state);
if spec_ptr.is_null () {
None
} else {
Some (*spec_ptr)
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment