summaryrefslogtreecommitdiff
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
parent1c5a71ecbacdc7bbae608d6d34ca836929d09d4b (diff)
making svg node
-rw-r--r--rotord/Makefile2
-rw-r--r--rotord/src/nodes_drawing.h34
2 files changed, 34 insertions, 2 deletions
diff --git a/rotord/Makefile b/rotord/Makefile
index 1dcbdbe..b5b1a5a 100644
--- a/rotord/Makefile
+++ b/rotord/Makefile
@@ -3,7 +3,7 @@
#http://docs.gstreamer.com/display/GstSDK/Installing+on+Linux
#MY_CFLAGS = -fpermissive -std=c++11 -Wno-error -I /opt/gstreamer-sdk/include/gstreamer-0.10/ -I /opt/gstreamer-sdk/include/glib-2.0 -I /opt/gstreamer-sdk/lib/glib-2.0/include -I /opt/gstreamer-sdk/include/libxml2 $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 --cflags)
-MY_CFLAGS = -Wswitch -fpermissive -std=c++11 -I /usr/include/opencv -I /usr/include/cairo -I /usr/include/jsoncpp
+MY_CFLAGS = -Wswitch -fpermissive -std=c++11 -I /usr/include/librsvg-2.0/librsvg -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/opencv -I /usr/include/cairo -I /usr/include/jsoncpp
#-Wno-error $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 --cflags)
# -I ../ffmpeg
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