iipsrv
0.9.9
Main Page
Classes
Files
File List
Watermark.h
1
/*
2
IIPImage Server - Watermark Class
3
4
Enables dynamic watermarking of images with user-defined opacity and
5
random positioning within the image.
6
7
Development supported by Moravian Library in Brno (Moravska zemska
8
knihovna v Brne, http://www.mzk.cz/) R&D grant MK00009494301 & Old
9
Maps Online (http://www.oldmapsonline.org/) from the Ministry of
10
Culture of the Czech Republic.
11
12
13
Copyright (C) 2010 Ruven Pillay.
14
15
This program is free software; you can redistribute it and/or modify
16
it under the terms of the GNU General Public License as published by
17
the Free Software Foundation; either version 2 of the License, or
18
(at your option) any later version.
19
20
This program is distributed in the hope that it will be useful,
21
but WITHOUT ANY WARRANTY; without even the implied warranty of
22
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
GNU General Public License for more details.
24
25
You should have received a copy of the GNU General Public License
26
along with this program; if not, write to the Free Software
27
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
*/
29
30
31
32
#ifndef _WATERMARK_H
33
#define _WATERMARK_H
34
35
#include <string>
36
37
38
40
41
class
Watermark
{
42
43
private
:
44
46
unsigned
int
_width;
47
49
unsigned
int
_height;
50
52
unsigned
int
_channels;
53
55
unsigned
int
_bpc;
56
58
std::string _image;
59
61
float
_opacity;
62
64
float
_probability;
65
67
bool
_isSet;
68
70
unsigned
char
* _watermark;
71
72
73
public
:
74
76
Watermark
(){
77
_isSet=
false
;
78
_watermark = NULL;
79
_opacity = 0;
80
_probability = 0;
81
};
82
84
88
Watermark
(
const
std::string& file,
float
opacity,
float
probability ){
89
_image = file;
90
_width = 0;
91
_height = 0;
92
_channels = 0;
93
_bpc = 0;
94
_opacity = opacity;
95
_probability = probability;
96
_isSet =
false
;
97
_watermark = NULL;
98
};
99
101
~Watermark
(){
102
if
( _watermark )
delete
[] _watermark;
103
};
104
106
112
void
apply
(
void
* data,
unsigned
int
width,
unsigned
int
height,
unsigned
int
channels,
unsigned
int
bpc );
113
115
std::string
getImage
(){
return
_image; };
116
118
float
getOpacity
(){
return
_opacity; };
119
121
float
getProbability
(){
return
_probability; };
122
124
void
init
();
125
127
bool
isSet
(){
128
if
( _isSet )
return
true
;
129
else
return
false
;
130
}
131
132
};
133
134
135
136
#endif
src
Watermark.h
Generated on Wed Jun 13 2012 19:07:47 for iipsrv by
1.8.1