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