summaryrefslogtreecommitdiff
path: root/rotord/src/nodes_drawing.h
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-10-22 18:43:24 -0700
committerComment <tim@gray.(none)>2013-10-22 18:43:24 -0700
commitfd20eb3cf43383b2d2d831915e12804b1a278b18 (patch)
tree70b81c99da682402421f4ad17bb6ae550888df63 /rotord/src/nodes_drawing.h
parent5324f84a8465dd46c9690876149c53f1295778b5 (diff)
svg loader
Diffstat (limited to 'rotord/src/nodes_drawing.h')
-rw-r--r--rotord/src/nodes_drawing.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h
index 9a7e30f..79082cc 100644
--- a/rotord/src/nodes_drawing.h
+++ b/rotord/src/nodes_drawing.h
@@ -226,25 +226,31 @@ namespace Rotor {
create_parameter("rotation","number","Rotation","Rotation",0.0f);
create_attribute("filename","SVG file to draw","Filename","");
UID="88c30140-2d0b-11e3-8db2-679d596166c1";
+ rsvg=nullptr;
+ g_type_init(); //does this have to be done only once?
};
Svg(map<string,string> &settings):Svg() {
base_settings(settings);
+ rsvg=rsvg_handle_new_from_file((settings["media_path"]+attributes["filename"]->value).c_str(),nullptr);
};
~Svg(){};
Svg* clone(map<string,string> &_settings) { return new Svg(_settings);};
void vector_output(cairo_t * cr,const Frame_spec &frame){
- colour=Colour(attributes["colour"]->value);
- cairo_save(cr); //not really even necessary?
- cairo_translate(cr, frame.w/2, frame.h/2);
- cairo_translate(cr, parameters["x"]->value * frame.w, parameters["y"]->value * frame.h);
- cairo_scale(cr, parameters["scale"]->value , parameters["scale"]->value );
- cairo_rotate(cr,(parameters["rotation"]->value/180.0f)*M_PI);
-
+ if (rsvg){
+ cairo_save(cr); //not really even necessary?
+ cairo_translate(cr, frame.w/2, frame.h/2);
+ cairo_translate(cr, parameters["x"]->value * frame.w, parameters["y"]->value * frame.h);
+ cairo_scale(cr, parameters["scale"]->value , parameters["scale"]->value );
+ cairo_rotate(cr,(parameters["rotation"]->value/180.0f)*M_PI);
+
+ rsvg_handle_render_cairo(rsvg,cr);
- cairo_restore (cr); //not really even necessary?
- cairo_fill(cr);
+ cairo_restore (cr); //not really even necessary?
+ cairo_fill(cr);
+ }
}
private:
+ RsvgHandle * rsvg;
};
}