Magick++: Montage.cpp Source File

Magick++ 7.1.0

Montage.cpp
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
4 //
5 // Copyright @ 2014 ImageMagick Studio LLC, a non-profit organization
6 // dedicated to making software imaging solutions freely available.
7 //
8 // Implementation of Montage
9 //
10
11 #define MAGICKCORE_IMPLEMENTATION 1
12 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
13
14 #include "Magick++/Include.h"
15 #include <string>
16 #include <string.h>
17
18 #include "Magick++/Montage.h"
19 #include "Magick++/Functions.h"
20
21 Magick::Montage::Montage(void)
22 : _backgroundColor("#ffffff"),
23 _fileName(),
24 _fill("#000000ff"),
25 _font(),
26 _geometry("120x120+4+3>"),
27 _gravity(CenterGravity),
28 _label(),
29 _pointSize(12),
30 _shadow(false),
31 _stroke(),
32 _texture(),
33 _tile("6x4"),
34 _title(),
35 _transparentColor()
36 {
37 }
38
39 Magick::Montage::~Montage(void)
40 {
41 }
42
43 void Magick::Montage::backgroundColor(const Magick::Color &backgroundColor_)
44 {
45 _backgroundColor=backgroundColor_;
46 }
47
48 Magick::Color Magick::Montage::backgroundColor(void) const
49 {
50 return(_backgroundColor);
51 }
52
53 void Magick::Montage::fileName(const std::string &fileName_)
54 {
55 _fileName=fileName_;
56 }
57
58 std::string Magick::Montage::fileName(void) const
59 {
60 return(_fileName);
61 }
62
63 void Magick::Montage::fillColor(const Color &fill_)
64 {
65 _fill=fill_;
66 }
67
68 Magick::Color Magick::Montage::fillColor(void) const
69 {
70 return(_fill);
71 }
72
73 void Magick::Montage::font(const std::string &font_)
74 {
75 _font=font_;
76 }
77
78 std::string Magick::Montage::font(void) const
79 {
80 return(_font);
81 }
82
83 void Magick::Montage::geometry(const Magick::Geometry &geometry_)
84 {
85 _geometry=geometry_;
86 }
87
88 Magick::Geometry Magick::Montage::geometry(void) const
89 {
90 return(_geometry);
91 }
92
93 void Magick::Montage::gravity(Magick::GravityType gravity_)
94 {
95 _gravity=gravity_;
96 }
97
98 Magick::GravityType Magick::Montage::gravity(void) const
99 {
100 return(_gravity);
101 }
102
103 void Magick::Montage::label(const std::string &label_)
104 {
105 _label=label_;
106 }
107
108 std::string Magick::Montage::label(void) const
109 {
110 return(_label);
111 }
112
113 void Magick::Montage::pointSize(size_t pointSize_)
114 {
115 _pointSize=pointSize_;
116 }
117
118 size_t Magick::Montage::pointSize(void) const
119 {
120 return(_pointSize);
121 }
122
123 void Magick::Montage::shadow(bool shadow_)
124 {
125 _shadow=shadow_;
126 }
127
128 bool Magick::Montage::shadow(void) const
129 {
130 return(_shadow);
131 }
132
133 void Magick::Montage::strokeColor(const Color &stroke_)
134 {
135 _stroke=stroke_;
136 }
137
138 Magick::Color Magick::Montage::strokeColor(void) const
139 {
140 return(_stroke);
141 }
142
143 void Magick::Montage::texture(const std::string &texture_)
144 {
145 _texture=texture_;
146 }
147
148 std::string Magick::Montage::texture(void) const
149 {
150 return(_texture);
151 }
152
153 void Magick::Montage::tile(const Geometry &tile_)
154 {
155 _tile=tile_;
156 }
157
158 Magick::Geometry Magick::Montage::tile(void) const
159 {
160 return(_tile);
161 }
162
163 void Magick::Montage::title(const std::string &title_)
164 {
165 _title=title_;
166 }
167
168 std::string Magick::Montage::title(void) const
169 {
170 return(_title);
171 }
172
173 void Magick::Montage::transparentColor(const Magick::Color &transparentColor_)
174 {
175 _transparentColor=transparentColor_;
176 }
177
178 Magick::Color Magick::Montage::transparentColor(void) const
179 {
180 return(_transparentColor);
181 }
182
183 void Magick::Montage::updateMontageInfo(MontageInfo &montageInfo_ ) const
184 {
185 (void) memset(&montageInfo_,0,sizeof(montageInfo_));
186
187 // matte_color
188 montageInfo_.matte_color=Color();
189 // background_color
190 montageInfo_.background_color=_backgroundColor;
191 // border_color
192 montageInfo_.border_color=Color();
193 // border_width
194 montageInfo_.border_width=0;
195 // filename
196 if (_font.length() != 0)
197 {
198 _fileName.copy(montageInfo_.filename,MagickPathExtent-1);
199 montageInfo_.filename[ _fileName.length() ] = 0; // null terminate
200 }
201 // fill
202 montageInfo_.fill=_fill;
203 // font
204 if (_font.length() != 0)
205 Magick::CloneString(&montageInfo_.font,_font);
206 // geometry
207 if (_geometry.isValid())
208 Magick::CloneString(&montageInfo_.geometry,_geometry);
209 // gravity
210 montageInfo_.gravity=_gravity;
211 // pointsize
212 montageInfo_.pointsize=_pointSize;
213 // shadow
214 montageInfo_.shadow=static_cast<MagickBooleanType>
215 (_shadow ? MagickTrue : MagickFalse);
216 // signature (validity stamp)
217 montageInfo_.signature=MagickCoreSignature;
218 // stroke
219 montageInfo_.stroke=_stroke;
220 // texture
221 if (_texture.length() != 0)
222 Magick::CloneString(&montageInfo_.texture,_texture);
223 // tile
224 if (_tile.isValid())
225 Magick::CloneString(&montageInfo_.tile,_tile);
226 // title
227 if (_title.length() != 0)
228 Magick::CloneString(&montageInfo_.title,_title);
229 }
230
231 //
232 // Implementation of MontageFramed
233 //
234
235 Magick::MontageFramed::MontageFramed(void)
236 : _matteColor("#bdbdbd"),
237 _borderColor("#dfdfdf"),
238 _borderWidth(0),
239 _frame()
240 {
241 }
242
243 Magick::MontageFramed::~MontageFramed(void)
244 {
245 }
246
247 void Magick::MontageFramed::matteColor(const Magick::Color &matteColor_)
248 {
249 _matteColor=matteColor_;
250 }
251
252 Magick::Color Magick::MontageFramed::matteColor(void) const
253 {
254 return(_matteColor);
255 }
256
257 void Magick::MontageFramed::borderColor(const Magick::Color &borderColor_)
258 {
259 _borderColor=borderColor_;
260 }
261
262 Magick::Color Magick::MontageFramed::borderColor(void) const
263 {
264 return(_borderColor);
265 }
266
267 void Magick::MontageFramed::borderWidth(size_t borderWidth_)
268 {
269 _borderWidth=borderWidth_;
270 }
271
272 size_t Magick::MontageFramed::borderWidth(void) const
273 {
274 return(_borderWidth);
275 }
276
277 void Magick::MontageFramed::frameGeometry(const Magick::Geometry &frame_)
278 {
279 _frame=frame_;
280 }
281
282 Magick::Geometry Magick::MontageFramed::frameGeometry(void) const
283 {
284 return(_frame);
285 }
286
287 void Magick::MontageFramed::updateMontageInfo(MontageInfo &montageInfo_) const
288 {
289 // Do base updates
290 Montage::updateMontageInfo(montageInfo_);
291
292 // matte_color
293 montageInfo_.matte_color = _matteColor;
294 // border_color
295 montageInfo_.border_color=_borderColor;
296 // border_width
297 montageInfo_.border_width=_borderWidth;
298 // frame
299 if (_frame.isValid())
300 Magick::CloneString(&montageInfo_.frame,_frame);
301 }
Magick::Color
class MagickPPExport Color
Definition: Color.h:18
Functions.h
Magick::Montage::gravity
GravityType gravity(void) const
Definition: Montage.cpp:98
Magick::Montage::texture
std::string texture(void) const
Definition: Montage.cpp:148
Magick::MontageFramed::~MontageFramed
~MontageFramed(void)
Definition: Montage.cpp:243
Magick::MontageFramed::frameGeometry
Geometry frameGeometry(void) const
Definition: Montage.cpp:282
Magick::MontageFramed::borderWidth
size_t borderWidth(void) const
Definition: Montage.cpp:272
Magick::Montage::fillColor
Color fillColor(void) const
Definition: Montage.cpp:68
Magick::MontageFramed::matteColor
Color matteColor(void) const
Definition: Montage.cpp:252
Magick::Montage::pointSize
size_t pointSize(void) const
Definition: Montage.cpp:118
Magick::Montage::~Montage
virtual ~Montage(void)
Definition: Montage.cpp:39
Magick::Montage::backgroundColor
Color backgroundColor(void) const
Definition: Montage.cpp:48
Magick::Montage::Montage
Montage(void)
Definition: Montage.cpp:21
Magick::Montage::font
std::string font(void) const
Definition: Montage.cpp:78
Magick::Montage::fileName
std::string fileName(void) const
Definition: Montage.cpp:58
Montage.h
Magick::MontageFramed::borderColor
Color borderColor(void) const
Definition: Montage.cpp:262
Magick::Montage::transparentColor
Color transparentColor(void) const
Definition: Montage.cpp:178
Magick::Color
Definition: Color.h:36
Magick::Geometry
Definition: Geometry.h:37
Magick::Montage::geometry
Geometry geometry(void) const
Definition: Montage.cpp:88
Include.h
Magick::Montage::title
std::string title(void) const
Definition: Montage.cpp:168
Magick::CloneString
MagickPPExport void CloneString(char **destination_, const std::string &source_)
Definition: Functions.cpp:25
Magick::Montage::tile
Geometry tile(void) const
Definition: Montage.cpp:158
Magick::MontageFramed::updateMontageInfo
void updateMontageInfo(MagickCore::MontageInfo &montageInfo_) const
Definition: Montage.cpp:287
Magick::Montage::updateMontageInfo
virtual void updateMontageInfo(MagickCore::MontageInfo &montageInfo_) const
Definition: Montage.cpp:183
Magick::Montage::strokeColor
Color strokeColor(void) const
Definition: Montage.cpp:138
Magick::MontageFramed::MontageFramed
MontageFramed(void)
Definition: Montage.cpp:235
Magick::Montage::shadow
bool shadow(void) const
Definition: Montage.cpp:128
Magick::Montage::label
std::string label(void) const
Definition: Montage.cpp:108