Watermark.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _WATERMARK_H
00033 #define _WATERMARK_H
00034
00035 #include <string>
00036
00037
00038
00040
00041 class Watermark {
00042
00043 private:
00044
00046 unsigned int _width;
00047
00049 unsigned int _height;
00050
00052 unsigned int _channels;
00053
00055 unsigned int _bpc;
00056
00058 std::string _image;
00059
00061 float _opacity;
00062
00064 float _probability;
00065
00067 bool _isSet;
00068
00070 unsigned char* _watermark;
00071
00072
00073 public:
00074
00076 Watermark(){
00077 _isSet=false;
00078 _watermark = NULL;
00079 };
00080
00082
00086 Watermark( const std::string& file, float opacity, float probability ){
00087 _image = file;
00088 _width = 0;
00089 _height = 0;
00090 _channels = 0;
00091 _bpc = 0;
00092 _opacity = opacity;
00093 _probability = probability;
00094 _isSet = false;
00095 _watermark = NULL;
00096 };
00097
00099 ~Watermark(){
00100 if( _watermark ) delete[] _watermark;
00101 };
00102
00104
00110 void apply( void* data, unsigned int width, unsigned int height, unsigned int channels, unsigned int bpc );
00111
00113 std::string getImage(){ return _image; };
00114
00116 float getOpacity(){ return _opacity; };
00117
00119 float getProbability(){ return _probability; };
00120
00122 void init();
00123
00125 bool isSet(){
00126 if( _isSet ) return true;
00127 else return false;
00128 }
00129
00130 };
00131
00132
00133
00134 #endif