summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rotord/cvimage.cpp14
-rw-r--r--rotord/cvimage.h3
-rwxr-xr-xrotord/rotor.h10
3 files changed, 25 insertions, 2 deletions
diff --git a/rotord/cvimage.cpp b/rotord/cvimage.cpp
index 5402a8e..a82c1ec 100644
--- a/rotord/cvimage.cpp
+++ b/rotord/cvimage.cpp
@@ -33,7 +33,19 @@ namespace Rotor {
else {
for (int i=0;i<w*h*3;i++){
//creates rainbow overload, openCV doesn't do this
- RGBdata[i]=(unsigned char)(((int)other.RGBdata[i]+(int)RGBdata[i]));
+ rgb.data[i]=(unsigned char)(((int)other.rgb.data[i]+(int)rgb.data[i]));
+ }
+ }
+ return *this;
+ }
+ Image & Image::divide_wrap(const Image &other) {
+ if (other.w!=w||other.h!=h) {
+ cerr<<"Rotor: cannot add images with different sizes! (wanted "<<w<<"x"<<h<<", got "<<other.w<<"x"<<other.h<<")"<<endl;
+ }
+ else {
+ for (int i=0;i<w*h*3;i++){
+ //creates rainbow overload, openCV doesn't do this
+ rgb/=other.rgb; //does funny glitchy stuff
}
}
return *this;
diff --git a/rotord/cvimage.h b/rotord/cvimage.h
index 0b767d8..a8a7a09 100644
--- a/rotord/cvimage.h
+++ b/rotord/cvimage.h
@@ -160,10 +160,11 @@ namespace Rotor {
//believe these still work, don't know if these optimisations are better than opencvs..
Image & operator+=(const Image &other);
Image & operator*=(const Image &other);
- Image & add_wrap(const Image &other);
Image & alpha_blend(const Image &other);
Image & alpha_blend_cv(const Image &other);
Image & alpha_merge(const Image &other);
+ Image & add_wrap(const Image &other);
+ Image & divide_wrap(const Image &other);
Image & operator*=(const float &amount);
Image * operator*(const float &amount);
Image * operator+(const float &amount);
diff --git a/rotord/rotor.h b/rotord/rotor.h
index 136d812..1b68f2b 100755
--- a/rotord/rotor.h
+++ b/rotord/rotor.h
@@ -1010,6 +1010,8 @@ namespace Rotor {
#define BLEND_multiply 2
#define BLEND_blend 3
#define BLEND_alpha 4
+ #define BLEND_screen_wrap 5
+ #define BLEND_multiply_wrap 6
class Blend: public Image_node {
public:
Blend(){image=nullptr;};
@@ -1022,6 +1024,8 @@ namespace Rotor {
if (_mode=="multiply") mode=BLEND_multiply;
if (_mode=="blend") mode=BLEND_blend;
if (_mode=="alpha") mode=BLEND_alpha;
+ if (_mode=="screen_wrap") mode=BLEND_screen_wrap;
+ if (_mode=="multiply_wrap") mode=BLEND_multiply_wrap;
};
void link_params() {
for (auto p:parameter_inputs){
@@ -1048,6 +1052,12 @@ namespace Rotor {
case BLEND_alpha:
(*image)=(*image).alpha_blend(*(((Image_node*)image_inputs[1]->connection)->get_output(frame)));
break;
+ case BLEND_screen_wrap:
+ (*image)=(*image).add_wrap(*(((Image_node*)image_inputs[1]->connection)->get_output(frame)));
+ break;
+ case BLEND_multiply_wrap:
+ (*image)=(*image).divide_wrap(*(((Image_node*)image_inputs[1]->connection)->get_output(frame)));
+ break;
case BLEND_blend: //has to be last because of initialser of *in? go figure
(*image)*=(1.0f-amount);
Image *in=(*(((Image_node*)image_inputs[1]->connection)->get_output(frame)))*amount;