summaryrefslogtreecommitdiff
path: root/rotord/src/cvimage.h
diff options
context:
space:
mode:
authorTim Redfern <tim@Adaptics.local>2013-11-05 15:05:23 +0000
committerTim Redfern <tim@Adaptics.local>2013-11-05 15:05:23 +0000
commitb60ef5570f005374e688d62c69017543befca74e (patch)
treeb1af031769b297295fa864a86df0b168a074ed6d /rotord/src/cvimage.h
parent8bba898010f1a8f728a0a7e91be93a0671a4efed (diff)
overlay in blend mode
Diffstat (limited to 'rotord/src/cvimage.h')
-rw-r--r--rotord/src/cvimage.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/rotord/src/cvimage.h b/rotord/src/cvimage.h
index 8a6fdae..a0a2cf4 100644
--- a/rotord/src/cvimage.h
+++ b/rotord/src/cvimage.h
@@ -29,12 +29,15 @@ namespace Rotor {
pixeltables(){
add=new uint8_t*[256];
multiply=new uint8_t*[256];
+ overlay=new uint8_t*[256];
for (int i=0;i<256;i++){
add[i]=new uint8_t[256];
multiply[i]=new uint8_t[256];
+ overlay[i]=new uint8_t[256];
for (int j=0;j<256;j++){
add[i][j]=(uint8_t)std::min(i+j,0xFF);
multiply[i][j]=(uint8_t)(((float)i)*(((float)j)/255.0f));
+ overlay[i][j]=j<128?(uint8_t)((i*j)>>7):255-(((0xFF-i)*(0xFF-j))>>7);
}
}
mono_weights=new uint8_t*[3];
@@ -50,9 +53,11 @@ namespace Rotor {
for (int i=0;i<256;i++){
delete[] add[i];
delete[] multiply[i];
+ delete[] overlay[i];
}
delete[] add;
delete[] multiply;
+ delete[] overlay;
for (int i=0;i<3;i++) {
delete[] mono_weights[i];
}
@@ -60,7 +65,9 @@ namespace Rotor {
}
uint8_t **add;
uint8_t **multiply;
+ uint8_t **overlay;
uint8_t **mono_weights;
+
};
static pixeltables pixels;
class Image{
@@ -200,6 +207,7 @@ namespace Rotor {
Image & alpha_from_cv(cv::Mat &other);
Image & add_wrap(const Image &other);
Image & divide_wrap(const Image &other);
+ Image & overlay(const Image &other);
Image & operator*=(const float &amount);
Image & operator+=(const float &amount);
Image & operator-=(const float &amount);