summaryrefslogtreecommitdiff
path: root/rotord/src/nodes_drawing.h
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-10-22 16:57:05 +0100
committerTim Redfern <tim@eclectronics.org>2013-10-22 16:57:05 +0100
commit5324f84a8465dd46c9690876149c53f1295778b5 (patch)
tree3f2d9ecaa4bcdfb3baf5bbb88ab7676384480432 /rotord/src/nodes_drawing.h
parent1c5a71ecbacdc7bbae608d6d34ca836929d09d4b (diff)
making svg node
Diffstat (limited to 'rotord/src/nodes_drawing.h')
-rw-r--r--rotord/src/nodes_drawing.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h
index 4001514..9a7e30f 100644
--- a/rotord/src/nodes_drawing.h
+++ b/rotord/src/nodes_drawing.h
@@ -3,6 +3,7 @@
#include "rotor.h"
#include <cairo.h>
+#include <rsvg.h>
namespace Rotor {
class Draw_node: public Image_node {
@@ -162,7 +163,7 @@ namespace Rotor {
Waves(){
title="Waves";
description="Draws audio waveforms";
- UID="99a3a226-2d0b-11e3-89ee-53305a094fad";
+ UID="4dd50c56-3b2d-11e3-8691-74d02b29f6a6";
create_attribute("stroke","Colour of line stroke","Stroke","FFFFFF");
create_attribute("fill","Colour of line fill","Fill","11AA11");
create_attribute("mode","Drawing mode","Mode","line",{"line","fill","both"});
@@ -214,6 +215,37 @@ namespace Rotor {
Colour stroke;
Colour fill;
};
+ class Svg: public Draw_node {
+ public:
+ Svg(){
+ title="SVG";
+ description="Draws svg files";
+ create_parameter("x","number","X coordinate","X",0.0f);
+ create_parameter("y","number","Y coordinate","Y",0.0f);
+ create_parameter("scale","number","Scale","Scale",1.0f);
+ create_parameter("rotation","number","Rotation","Rotation",0.0f);
+ create_attribute("filename","SVG file to draw","Filename","");
+ UID="88c30140-2d0b-11e3-8db2-679d596166c1";
+ };
+ Svg(map<string,string> &settings):Svg() {
+ base_settings(settings);
+ };
+ ~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);
+
+
+ cairo_restore (cr); //not really even necessary?
+ cairo_fill(cr);
+ }
+ private:
+ };
}
#endif