diff options
| author | Comment <tim@gray.(none)> | 2013-12-08 10:55:03 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-12-08 10:55:03 +0000 |
| commit | 1d05d2380bb4f1fd265aef55744f432af38b08aa (patch) | |
| tree | 89c1c15497149951d4b99938ad932abde42eae14 /rotord/src/nodes_drawing.h | |
| parent | e04516069c71a5a1e32e6a5fbf0eb5b86dcfc5a2 (diff) | |
switched signals to double and random to uint16
Diffstat (limited to 'rotord/src/nodes_drawing.h')
| -rw-r--r-- | rotord/src/nodes_drawing.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index 8fe5d71..f2ed0ae 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -10,10 +10,10 @@ namespace Rotor { public: Draw_node(){ create_image_input("image input","Image input"); - 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_parameter("x","number","X coordinate","X",0.0); + create_parameter("y","number","Y coordinate","Y",0.0); + create_parameter("scale","number","Scale","Scale",1.0); + create_parameter("rotation","number","Rotation","Rotation",0.0); //no title or description as it isn't intended for the user }; Draw_node(map<string,string> &settings):Draw_node() { @@ -51,7 +51,7 @@ namespace Rotor { 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_rotate(cr,(parameters["rotation"]->value/180.0)*M_PI); } protected: Colour colour; @@ -63,8 +63,8 @@ namespace Rotor { Text_base(){ create_attribute("colour","Colour to fill","Colour","FFFFFF"); create_attribute("font","font to use","Font","Akzidenz",{"Sans","Sans Mono","Serif","Akzidenz"}); - create_parameter("size","number","Point size of font","size",50.0f); - NODEID="7da93b94-2d0b-11e3-8940-77bce0f9d3e8"; + create_parameter("size","number","Point size of font","size",50.0); + NODEID="7da93b94-2d0b-11e3-8940-77bc.09d3e8"; }; Text_base(map<string,string> &settings):Text_base() { base_settings(settings); @@ -75,7 +75,7 @@ namespace Rotor { colour=Colour(attributes["colour"]->value); string text=select_text(frame); cairo_text_extents_t te; - cairo_set_source_rgb(cr, colour.Rfloat(),colour.Gfloat(),colour.Bfloat()); + cairo_set_source_rgb(cr, colour.Rdouble(),colour.Gdouble(),colour.Bdouble()); string fontname; switch (attributes["font"]->intVal){ case 1: @@ -89,7 +89,7 @@ namespace Rotor { } cairo_select_font_face (cr,fontname.c_str(), CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_set_font_size (cr, parameters["size"]->value*(((float)frame.w)/360.0f)); + cairo_set_font_size (cr, parameters["size"]->value*(((double)frame.w)/360.0)); cairo_text_extents(cr, text.c_str(), &te); cairo_move_to (cr,-te.width/2,te.height/2); cairo_show_text (cr, text.c_str()); @@ -106,7 +106,7 @@ namespace Rotor { title="Text"; description="Draws text"; create_attribute("text","Text to draw","Text","hello, world!"); - create_parameter("number","number","Number to draw","Number",-99999999.0f); + create_parameter("number","number","Number to draw","Number",-99999999.0); NODEID="fdea0b88-4de7-11e3-9235-74d02b29f6a6"; }; Text(map<string,string> &settings):Text() { @@ -115,7 +115,7 @@ namespace Rotor { ~Text(){}; Text* clone(map<string,string> &_settings) { return new Text(_settings);}; string select_text(const Frame_spec &frame){ - if (parameters["number"]->value>-99999998.0f){ + if (parameters["number"]->value>-99999998.0){ return toString(parameters["number"]->value,4); } else return attributes["text"]->value; @@ -178,7 +178,7 @@ namespace Rotor { Shape* clone(map<string,string> &_settings) { return new Shape(_settings);}; void vector_output(cairo_t * cr,const Frame_spec &frame){ colour=Colour(attributes["colour"]->value); - cairo_set_source_rgb(cr, colour.Rfloat(),colour.Gfloat(),colour.Bfloat()); + cairo_set_source_rgb(cr, colour.Rdouble(),colour.Gdouble(),colour.Bdouble()); switch(attributes["shape"]->intVal) { case SHAPE_square: cairo_rectangle(cr,-frame.w/2,-frame.w/2,frame.w,frame.w); @@ -239,9 +239,9 @@ namespace Rotor { create_attribute("fill","Colour of line fill","Fill","11AA11"); create_attribute("mode","Drawing mode","Mode","line",{"line","fill","both"}); create_attribute("channel","Channel to draw","Channel","left",{"left","right"}); - create_parameter("width","number","Line width","Width",1.0f,0.0f,25.0f); - create_parameter("height","number","Height","Height",1.0f); - create_parameter("alpha","number","Alpha blend","Alpha",1.0f,0.0f,1.0f); + create_parameter("width","number","Line width","Width",1.0,0.0,25.0); + create_parameter("height","number","Height","Height",1.0); + create_parameter("alpha","number","Alpha blend","Alpha",1.0,0.0,1.0); } Waves(map<string,string> &settings):Waves() { base_settings(settings); @@ -253,11 +253,11 @@ namespace Rotor { fill=Colour(attributes["fill"]->value); int channel=attributes["channel"]->intVal-1; if (attributes["mode"]->value=="fill"||attributes["mode"]->value=="both") { - cairo_set_source_rgba(cr, fill.Rfloat(),fill.Gfloat(),fill.Bfloat(),parameters["alpha"]->value); + cairo_set_source_rgba(cr, fill.Rdouble(),fill.Gdouble(),fill.Bdouble(),parameters["alpha"]->value); cairo_save(cr); //cairo_translate(cr, 0, frame.h/2); cairo_translate(cr,-frame.w/2,0); - cairo_scale(cr,1.0f,parameters["height"]->value); + cairo_scale(cr,1.0,parameters["height"]->value); //cairo_line_to(cr, 0, 0); for (int i=0;i<frame.w;i++){ cairo_line_to(cr,i,(((int16_t)frame.audio->samples[i*frame.audio->channels]+channel)*frame.h)>>16); @@ -269,10 +269,10 @@ namespace Rotor { cairo_fill(cr); } if (attributes["mode"]->value=="line"||attributes["mode"]->value=="both") { - cairo_set_source_rgba(cr, stroke.Rfloat(),stroke.Gfloat(),stroke.Bfloat(),parameters["alpha"]->value); + cairo_set_source_rgba(cr, stroke.Rdouble(),stroke.Gdouble(),stroke.Bdouble(),parameters["alpha"]->value); cairo_save(cr); cairo_translate(cr,-frame.w/2,0); - cairo_scale(cr,1.0f,parameters["height"]->value); + cairo_scale(cr,1.0,parameters["height"]->value); cairo_set_line_width (cr, parameters["width"]->value); cairo_line_to(cr, 0, 0); for (int i=0;i<frame.w;i++){ @@ -322,11 +322,11 @@ namespace Rotor { if (rsvg) { //to make it resolution independent //translate the difference between screen and drawing - float scale=frame.w/dims.width; + double scale=frame.w/dims.width; 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*scale, parameters["scale"]->value*scale); - cairo_rotate(cr,(parameters["rotation"]->value/180.0f)*M_PI); + cairo_rotate(cr,(parameters["rotation"]->value/180.0)*M_PI); cairo_translate(cr, -frame.w/2, -frame.h/2); cairo_translate(cr, frame.w/2-(dims.width/2), frame.h/2-(dims.height/2)); } |
