From 741cba373d7e982026de91ee1ceeb18a8f64b367 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 4 Dec 2013 11:10:55 +0000 Subject: min/max --- rotord/src/nodes_channels.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'rotord/src/nodes_channels.h') diff --git a/rotord/src/nodes_channels.h b/rotord/src/nodes_channels.h index 1cb151e..4fdcd01 100644 --- a/rotord/src/nodes_channels.h +++ b/rotord/src/nodes_channels.h @@ -70,13 +70,15 @@ namespace Rotor { #define BLEND_wrap 5 #define BLEND_xor 6 #define BLEND_overlay 7 +#define BLEND_min 8 +#define BLEND_max 9 class Blend: public Image_node { public: Blend(){ create_image_input("image input 1","Image input 1"); create_image_input("image input 2","Image input 2"); create_parameter("amount","number","amount to blend input 2","Blend amount",0.5f,0.0f,1.0f); - create_attribute("mode","Blend mode","Blend mode","blend",{"blend","screen","multiply","alpha","wrap","xor","overlay"}); + create_attribute("mode","Blend mode","Blend mode","blend",{"blend","screen","multiply","alpha","wrap","xor","overlay","min","max"}); title ="Blend"; description="Blend images in various modes"; NODEID="12ed7af0-2d0a-11e3-ae32-2b44203b93c9"; @@ -111,6 +113,12 @@ namespace Rotor { case BLEND_overlay: image=image.overlay(*in2); break; + case BLEND_min: + image=image.min(*in2); + break; + case BLEND_max: + image=image.max(*in2); + break; case BLEND_blend: //has to be last because of initialser of *in? go figure image*=(1.0f-parameters["amount"]->value); @@ -412,7 +420,7 @@ namespace Rotor { //calls base class constructor first create_parameter("number","number","number of echoes","Number echoes",25.0f); create_parameter("fadeto","number","amount that echoes fade out","Fadout amount",1.0f,0.0f,1.0f); - create_attribute("mode","blend mode for echoes","Blend mode","screen",{"screen","wrap"}); + create_attribute("mode","blend mode for echoes","Blend mode","screen",{"screen","wrap","min","max"}); title="Echo trails"; description="Draw trail frames additively that fade off over time"; NODEID="5b1ab684-2d0b-11e3-8fa2-970be8c360dd"; @@ -476,14 +484,30 @@ namespace Rotor { if (attributes["mode"]->value=="screen") { image+=*temp; } - else { + if (attributes["mode"]->value=="wrap") { image.add_wrap(*temp); } + if (attributes["mode"]->value=="min") { + image.min(*temp); + } + if (attributes["mode"]->value=="max") { + image.max(*temp); + } delete temp; } else { - if (attributes["mode"]->value=="screen") image+=*(images[absframe]); - else image=image.add_wrap(*(images[absframe])); + if (attributes["mode"]->value=="screen") { + image+=*(images[absframe]); + } + if (attributes["mode"]->value=="screen") { + image=image.add_wrap(*(images[absframe])); + } + if (attributes["mode"]->value=="min") { + image=image.min(*(images[absframe])); + } + if (attributes["mode"]->value=="max") { + image=image.max(*(images[absframe])); + } } } } -- cgit v1.2.3