summaryrefslogtreecommitdiff
path: root/rotord/cvimage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/cvimage.cpp')
-rw-r--r--rotord/cvimage.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/rotord/cvimage.cpp b/rotord/cvimage.cpp
index ca094d3..cb10fdd 100644
--- a/rotord/cvimage.cpp
+++ b/rotord/cvimage.cpp
@@ -33,8 +33,8 @@ namespace Rotor {
}
return *this;
}
- //THESE CAN BE OPTIMISED - LOOK INTO USING OPENCV HERE
- Image & Image::alpha_blend(const Image &other) {
+ //THIS OPENCV VERSION IS SLOWER THAN THE OLDSKOOL VERSION BELOW
+ Image & Image::alpha_blend_cv(const Image &other) {
if (other.w!=w||other.h!=h) {
cerr<<"Rotor: cannot blend images with different sizes! (wanted "<<w<<"x"<<h<<", got "<<other.w<<"x"<<other.h<<")"<<endl;
//why not??
@@ -67,7 +67,7 @@ namespace Rotor {
return *this;
}
- Image & Image::alpha_blend_old(const Image &other) {
+ Image & Image::alpha_blend(const Image &other) {
if (other.w!=w||other.h!=h) {
cerr<<"Rotor: cannot blend images with different sizes! (wanted "<<w<<"x"<<h<<", got "<<other.w<<"x"<<other.h<<")"<<endl;
//why not??
@@ -77,7 +77,6 @@ namespace Rotor {
rgb=other.rgb.clone();
}
else {
- rgb+=other.rgb;
for (int i=0;i<w*h*3;i++) {
rgb.data[i]=(uint8_t)(((((int)rgb.data[i])*(0xFF-other.alpha.data[i/3]))>>8)+((((int)other.rgb.data[i])*((int)other.alpha.data[i/3]))>>8));
}