/src/imagemagick/Magick++/lib/Image.cpp
Line | Count | Source |
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 @ 1999 ImageMagick Studio LLC, a non-profit organization |
6 | | // dedicated to making software imaging solutions freely available. |
7 | | // |
8 | | // Implementation of Image |
9 | | // |
10 | | |
11 | | #define MAGICKCORE_IMPLEMENTATION 1 |
12 | | #define MAGICK_PLUSPLUS_IMPLEMENTATION 1 |
13 | | |
14 | | #include "Magick++/Include.h" |
15 | | #include <cstdlib> |
16 | | #include <string> |
17 | | #include <string.h> |
18 | | #include <errno.h> |
19 | | #include <math.h> |
20 | | |
21 | | #include "Magick++/Image.h" |
22 | | #include "Magick++/Functions.h" |
23 | | #include "Magick++/Pixels.h" |
24 | | #include "Magick++/Options.h" |
25 | | #include "Magick++/ImageRef.h" |
26 | | |
27 | | using namespace std; |
28 | | |
29 | | #define AbsoluteValue(x) ((x) < 0 ? -(x) : (x)) |
30 | 0 | #define MagickPI 3.14159265358979323846264338327950288419716939937510 |
31 | 0 | #define DegreesToRadians(x) (MagickPI*(x)/180.0) |
32 | 1.02M | #define ThrowImageException ThrowPPException(quiet()) |
33 | | |
34 | | MagickPPExport const char *Magick::borderGeometryDefault="6x6+0+0"; |
35 | | MagickPPExport const char *Magick::frameGeometryDefault="25x25+6+6"; |
36 | | MagickPPExport const char *Magick::raiseGeometryDefault="6x6+0+0"; |
37 | | |
38 | | MagickPPExport int Magick::operator == (const Magick::Image &left_, |
39 | | const Magick::Image &right_) |
40 | 0 | { |
41 | | // If image pixels and signature are the same, then the image is identical |
42 | 0 | return((left_.rows() == right_.rows()) && |
43 | 0 | (left_.columns() == right_.columns()) && |
44 | 0 | (left_.signature() == right_.signature())); |
45 | 0 | } |
46 | | |
47 | | MagickPPExport int Magick::operator != (const Magick::Image &left_, |
48 | | const Magick::Image &right_) |
49 | 0 | { |
50 | 0 | return(!(left_ == right_)); |
51 | 0 | } |
52 | | |
53 | | MagickPPExport int Magick::operator > (const Magick::Image &left_, |
54 | | const Magick::Image &right_) |
55 | 0 | { |
56 | 0 | return(!(left_ < right_) && (left_ != right_)); |
57 | 0 | } |
58 | | |
59 | | MagickPPExport int Magick::operator < (const Magick::Image &left_, |
60 | | const Magick::Image &right_) |
61 | 0 | { |
62 | | // If image pixels are less, then image is smaller |
63 | 0 | return((left_.rows() * left_.columns()) < |
64 | 0 | (right_.rows() * right_.columns())); |
65 | 0 | } |
66 | | |
67 | | MagickPPExport int Magick::operator >= (const Magick::Image &left_, |
68 | | const Magick::Image &right_) |
69 | 0 | { |
70 | 0 | return((left_ > right_) || (left_ == right_)); |
71 | 0 | } |
72 | | |
73 | | MagickPPExport int Magick::operator <= (const Magick::Image &left_, |
74 | | const Magick::Image &right_) |
75 | 0 | { |
76 | 0 | return((left_ < right_) || ( left_ == right_)); |
77 | 0 | } |
78 | | |
79 | | Magick::Image::Image(void) |
80 | 607k | : _imgRef(new ImageRef) |
81 | 607k | { |
82 | 607k | } |
83 | | |
84 | | Magick::Image::Image(const Blob &blob_) |
85 | 0 | : _imgRef(new ImageRef) |
86 | 0 | { |
87 | 0 | try |
88 | 0 | { |
89 | | // Initialize, Allocate and Read images |
90 | 0 | quiet(true); |
91 | 0 | read(blob_); |
92 | 0 | quiet(false); |
93 | 0 | } |
94 | 0 | catch (const Error&) |
95 | 0 | { |
96 | | // Release resources |
97 | 0 | delete _imgRef; |
98 | 0 | throw; |
99 | 0 | } |
100 | 0 | } |
101 | | |
102 | | Magick::Image::Image(const Blob &blob_,const Geometry &size_) |
103 | 0 | : _imgRef(new ImageRef) |
104 | 0 | { |
105 | 0 | try |
106 | 0 | { |
107 | | // Read from Blob |
108 | 0 | quiet(true); |
109 | 0 | read(blob_, size_); |
110 | 0 | quiet(false); |
111 | 0 | } |
112 | 0 | catch(const Error&) |
113 | 0 | { |
114 | | // Release resources |
115 | 0 | delete _imgRef; |
116 | 0 | throw; |
117 | 0 | } |
118 | 0 | } |
119 | | |
120 | | Magick::Image::Image(const Blob &blob_,const Geometry &size_, |
121 | | const size_t depth_) |
122 | 0 | : _imgRef(new ImageRef) |
123 | 0 | { |
124 | 0 | try |
125 | 0 | { |
126 | | // Read from Blob |
127 | 0 | quiet(true); |
128 | 0 | read(blob_,size_,depth_); |
129 | 0 | quiet(false); |
130 | 0 | } |
131 | 0 | catch(const Error&) |
132 | 0 | { |
133 | | // Release resources |
134 | 0 | delete _imgRef; |
135 | 0 | throw; |
136 | 0 | } |
137 | 0 | } |
138 | | |
139 | | Magick::Image::Image(const Blob &blob_,const Geometry &size_, |
140 | | const size_t depth_,const std::string &magick_) |
141 | 0 | : _imgRef(new ImageRef) |
142 | 0 | { |
143 | 0 | try |
144 | 0 | { |
145 | | // Read from Blob |
146 | 0 | quiet(true); |
147 | 0 | read(blob_,size_,depth_,magick_); |
148 | 0 | quiet(false); |
149 | 0 | } |
150 | 0 | catch(const Error&) |
151 | 0 | { |
152 | | // Release resources |
153 | 0 | delete _imgRef; |
154 | 0 | throw; |
155 | 0 | } |
156 | 0 | } |
157 | | |
158 | | Magick::Image::Image(const Blob &blob_,const Geometry &size_, |
159 | | const std::string &magick_) |
160 | 0 | : _imgRef(new ImageRef) |
161 | 0 | { |
162 | 0 | try |
163 | 0 | { |
164 | | // Read from Blob |
165 | 0 | quiet(true); |
166 | 0 | read(blob_,size_,magick_); |
167 | 0 | quiet(false); |
168 | 0 | } |
169 | 0 | catch(const Error&) |
170 | 0 | { |
171 | | // Release resources |
172 | 0 | delete _imgRef; |
173 | 0 | throw; |
174 | 0 | } |
175 | 0 | } |
176 | | |
177 | | Magick::Image::Image(const Geometry &size_,const Color &color_) |
178 | 0 | : _imgRef(new ImageRef) |
179 | 0 | { |
180 | | // xc: prefix specifies an X11 color string |
181 | 0 | std::string imageSpec("xc:"); |
182 | 0 | imageSpec+=color_; |
183 | |
|
184 | 0 | try |
185 | 0 | { |
186 | 0 | quiet(true); |
187 | | // Set image size |
188 | 0 | size(size_); |
189 | | |
190 | | // Initialize, Allocate and Read images |
191 | 0 | read(imageSpec); |
192 | 0 | quiet(false); |
193 | 0 | } |
194 | 0 | catch(const Error&) |
195 | 0 | { |
196 | | // Release resources |
197 | 0 | delete _imgRef; |
198 | 0 | throw; |
199 | 0 | } |
200 | 0 | } |
201 | | |
202 | | Magick::Image::Image(const Image &image_) |
203 | 0 | : _imgRef(image_._imgRef) |
204 | 0 | { |
205 | 0 | _imgRef->increase(); |
206 | 0 | } |
207 | | |
208 | | Magick::Image::Image(const Image &image_,const Geometry &geometry_) |
209 | 0 | : _imgRef(new ImageRef) |
210 | 0 | { |
211 | 0 | const RectangleInfo |
212 | 0 | geometry=geometry_; |
213 | |
|
214 | 0 | OffsetInfo |
215 | 0 | offset; |
216 | |
|
217 | 0 | MagickCore::Image |
218 | 0 | *image; |
219 | |
|
220 | 0 | GetPPException; |
221 | 0 | image=CloneImage(image_.constImage(),geometry_.width(),geometry_.height(), |
222 | 0 | MagickTrue,exceptionInfo); |
223 | 0 | replaceImage(image); |
224 | 0 | _imgRef->options(new Options(*image_.constOptions())); |
225 | 0 | offset.x=0; |
226 | 0 | offset.y=0; |
227 | 0 | (void) CopyImagePixels(image,image_.constImage(),&geometry,&offset, |
228 | 0 | exceptionInfo); |
229 | 0 | ThrowImageException; |
230 | 0 | } |
231 | | |
232 | | Magick::Image::Image(const size_t width_,const size_t height_, |
233 | | const std::string &map_,const StorageType type_,const void *pixels_) |
234 | 0 | : _imgRef(new ImageRef) |
235 | 0 | { |
236 | 0 | try |
237 | 0 | { |
238 | 0 | quiet(true); |
239 | 0 | read(width_,height_,map_.c_str(),type_,pixels_); |
240 | 0 | quiet(false); |
241 | 0 | } |
242 | 0 | catch(const Error&) |
243 | 0 | { |
244 | | // Release resources |
245 | 0 | delete _imgRef; |
246 | 0 | throw; |
247 | 0 | } |
248 | 0 | } |
249 | | |
250 | | Magick::Image::Image(const std::string &imageSpec_) |
251 | 0 | : _imgRef(new ImageRef) |
252 | 0 | { |
253 | 0 | try |
254 | 0 | { |
255 | | // Initialize, Allocate and Read images |
256 | 0 | quiet(true); |
257 | 0 | read(imageSpec_); |
258 | 0 | quiet(false); |
259 | 0 | } |
260 | 0 | catch(const Error&) |
261 | 0 | { |
262 | | // Release resources |
263 | 0 | delete _imgRef; |
264 | 0 | throw; |
265 | 0 | } |
266 | 0 | } |
267 | | |
268 | | Magick::Image::~Image() |
269 | 607k | { |
270 | 607k | try |
271 | 607k | { |
272 | 607k | if (_imgRef->decrease() == 0) |
273 | 607k | delete _imgRef; |
274 | 607k | } |
275 | 607k | catch(Magick::Exception&) |
276 | 607k | { |
277 | 0 | } |
278 | | |
279 | 607k | _imgRef=(Magick::ImageRef *) NULL; |
280 | 607k | } |
281 | | |
282 | | Magick::Image& Magick::Image::operator=(const Magick::Image &image_) |
283 | 0 | { |
284 | 0 | if (this != &image_) |
285 | 0 | { |
286 | 0 | image_._imgRef->increase(); |
287 | 0 | if (_imgRef->decrease() == 0) |
288 | 0 | delete _imgRef; |
289 | | |
290 | | // Use new image reference |
291 | 0 | _imgRef=image_._imgRef; |
292 | 0 | } |
293 | 0 | return(*this); |
294 | 0 | } |
295 | | |
296 | | void Magick::Image::adjoin(const bool flag_) |
297 | 0 | { |
298 | 0 | modifyImage(); |
299 | 0 | options()->adjoin(flag_); |
300 | 0 | } |
301 | | |
302 | | bool Magick::Image::adjoin(void) const |
303 | 0 | { |
304 | 0 | return(constOptions()->adjoin()); |
305 | 0 | } |
306 | | |
307 | | void Magick::Image::alpha(const bool alphaFlag_) |
308 | 0 | { |
309 | 0 | modifyImage(); |
310 | | |
311 | | // If matte channel is requested, but image doesn't already have a |
312 | | // matte channel, then create an opaque matte channel. Likewise, if |
313 | | // the image already has a matte channel but a matte channel is not |
314 | | // desired, then set the matte channel to opaque. |
315 | 0 | GetPPException; |
316 | 0 | if (bool(alphaFlag_) != bool(constImage()->alpha_trait)) |
317 | 0 | SetImageAlpha(image(),OpaqueAlpha,exceptionInfo); |
318 | 0 | ThrowImageException; |
319 | |
|
320 | 0 | image()->alpha_trait=alphaFlag_ ? BlendPixelTrait : UndefinedPixelTrait; |
321 | 0 | } |
322 | | |
323 | | bool Magick::Image::alpha(void) const |
324 | 0 | { |
325 | 0 | if (constImage()->alpha_trait == BlendPixelTrait) |
326 | 0 | return(true); |
327 | 0 | else |
328 | 0 | return(false); |
329 | 0 | } |
330 | | |
331 | | void Magick::Image::matteColor(const Color &matteColor_) |
332 | 0 | { |
333 | 0 | modifyImage(); |
334 | |
|
335 | 0 | if (matteColor_.isValid()) |
336 | 0 | { |
337 | 0 | image()->matte_color=matteColor_; |
338 | 0 | options()->matteColor(matteColor_); |
339 | 0 | } |
340 | 0 | else |
341 | 0 | { |
342 | | // Set to default matte color |
343 | 0 | Color tmpColor("#BDBDBD"); |
344 | 0 | image()->matte_color=tmpColor; |
345 | 0 | options()->matteColor(tmpColor); |
346 | 0 | } |
347 | 0 | } |
348 | | |
349 | | Magick::Color Magick::Image::matteColor(void) const |
350 | 0 | { |
351 | 0 | return(Color(constImage()->matte_color)); |
352 | 0 | } |
353 | | |
354 | | void Magick::Image::animationDelay(const size_t delay_) |
355 | 0 | { |
356 | 0 | modifyImage(); |
357 | 0 | image()->delay=delay_; |
358 | 0 | } |
359 | | |
360 | | size_t Magick::Image::animationDelay(void) const |
361 | 0 | { |
362 | 0 | return(constImage()->delay); |
363 | 0 | } |
364 | | |
365 | | void Magick::Image::animationIterations(const size_t iterations_) |
366 | 0 | { |
367 | 0 | modifyImage(); |
368 | 0 | image()->iterations=iterations_; |
369 | 0 | } |
370 | | |
371 | | size_t Magick::Image::animationIterations(void) const |
372 | 0 | { |
373 | 0 | return(constImage()->iterations); |
374 | 0 | } |
375 | | |
376 | | void Magick::Image::backgroundColor(const Color &backgroundColor_) |
377 | 0 | { |
378 | 0 | modifyImage(); |
379 | |
|
380 | 0 | if (backgroundColor_.isValid()) |
381 | 0 | image()->background_color=backgroundColor_; |
382 | 0 | else |
383 | 0 | image()->background_color=Color(); |
384 | |
|
385 | 0 | options()->backgroundColor(backgroundColor_); |
386 | 0 | } |
387 | | |
388 | | Magick::Color Magick::Image::backgroundColor(void) const |
389 | 0 | { |
390 | 0 | return(constOptions()->backgroundColor()); |
391 | 0 | } |
392 | | |
393 | | void Magick::Image::backgroundTexture(const std::string &backgroundTexture_) |
394 | 0 | { |
395 | 0 | modifyImage(); |
396 | 0 | options()->backgroundTexture(backgroundTexture_); |
397 | 0 | } |
398 | | |
399 | | std::string Magick::Image::backgroundTexture(void) const |
400 | 0 | { |
401 | 0 | return(constOptions()->backgroundTexture()); |
402 | 0 | } |
403 | | |
404 | | size_t Magick::Image::baseColumns(void) const |
405 | 0 | { |
406 | 0 | return(constImage()->magick_columns); |
407 | 0 | } |
408 | | |
409 | | std::string Magick::Image::baseFilename(void) const |
410 | 0 | { |
411 | 0 | return(std::string(constImage()->magick_filename)); |
412 | 0 | } |
413 | | |
414 | | size_t Magick::Image::baseRows(void) const |
415 | 0 | { |
416 | 0 | return(constImage()->magick_rows); |
417 | 0 | } |
418 | | |
419 | | void Magick::Image::blackPointCompensation(const bool flag_) |
420 | 0 | { |
421 | 0 | image()->black_point_compensation=(MagickBooleanType) flag_; |
422 | 0 | } |
423 | | |
424 | | bool Magick::Image::blackPointCompensation(void) const |
425 | 0 | { |
426 | 0 | return(static_cast<bool>(constImage()->black_point_compensation)); |
427 | 0 | } |
428 | | |
429 | | void Magick::Image::borderColor(const Color &borderColor_) |
430 | 0 | { |
431 | 0 | modifyImage(); |
432 | |
|
433 | 0 | if (borderColor_.isValid()) |
434 | 0 | image()->border_color=borderColor_; |
435 | 0 | else |
436 | 0 | image()->border_color=Color(); |
437 | |
|
438 | 0 | options()->borderColor(borderColor_); |
439 | 0 | } |
440 | | |
441 | | Magick::Color Magick::Image::borderColor(void) const |
442 | 0 | { |
443 | 0 | return(constOptions()->borderColor()); |
444 | 0 | } |
445 | | |
446 | | Magick::Geometry Magick::Image::boundingBox(void) const |
447 | 0 | { |
448 | 0 | RectangleInfo |
449 | 0 | bbox; |
450 | |
|
451 | 0 | GetPPException; |
452 | 0 | bbox=GetImageBoundingBox(constImage(),exceptionInfo); |
453 | 0 | ThrowImageException; |
454 | 0 | return(Geometry(bbox)); |
455 | 0 | } |
456 | | |
457 | | void Magick::Image::boxColor(const Color &boxColor_) |
458 | 0 | { |
459 | 0 | modifyImage(); |
460 | 0 | options()->boxColor(boxColor_); |
461 | 0 | } |
462 | | |
463 | | Magick::Color Magick::Image::boxColor(void) const |
464 | 0 | { |
465 | 0 | return(constOptions()->boxColor()); |
466 | 0 | } |
467 | | |
468 | | void Magick::Image::channelDepth(const ChannelType channel_, |
469 | | const size_t depth_) |
470 | 0 | { |
471 | 0 | modifyImage(); |
472 | 0 | GetPPException; |
473 | 0 | GetAndSetPPChannelMask(channel_); |
474 | 0 | SetImageDepth(image(),depth_,exceptionInfo); |
475 | 0 | RestorePPChannelMask; |
476 | 0 | ThrowImageException; |
477 | 0 | } |
478 | | |
479 | | size_t Magick::Image::channelDepth(const ChannelType channel_) |
480 | 0 | { |
481 | 0 | size_t |
482 | 0 | channel_depth; |
483 | |
|
484 | 0 | GetPPException; |
485 | 0 | GetAndSetPPChannelMask(channel_); |
486 | 0 | channel_depth=GetImageDepth(constImage(),exceptionInfo); |
487 | 0 | RestorePPChannelMask; |
488 | 0 | ThrowImageException; |
489 | 0 | return(channel_depth); |
490 | 0 | } |
491 | | |
492 | | size_t Magick::Image::channels() const |
493 | 0 | { |
494 | 0 | return(constImage()->number_channels); |
495 | 0 | } |
496 | | |
497 | | void Magick::Image::classType(const ClassType class_) |
498 | 0 | { |
499 | 0 | if (classType() == PseudoClass && class_ == DirectClass) |
500 | 0 | { |
501 | | // Use SyncImage to synchronize the DirectClass pixels with the |
502 | | // color map and then set to DirectClass type. |
503 | 0 | modifyImage(); |
504 | 0 | GetPPException; |
505 | 0 | SyncImage(image(),exceptionInfo); |
506 | 0 | ThrowImageException; |
507 | 0 | image()->colormap=(PixelInfo *)RelinquishMagickMemory(image()->colormap); |
508 | 0 | image()->storage_class=static_cast<MagickCore::ClassType>(DirectClass); |
509 | 0 | return; |
510 | 0 | } |
511 | | |
512 | 0 | if (classType() == DirectClass && class_ == PseudoClass) |
513 | 0 | { |
514 | | // Quantize to create PseudoClass color map |
515 | 0 | modifyImage(); |
516 | 0 | quantizeColors(MaxColormapSize); |
517 | 0 | quantize(); |
518 | 0 | image()->storage_class=static_cast<MagickCore::ClassType>(PseudoClass); |
519 | 0 | } |
520 | 0 | } |
521 | | |
522 | | Magick::ClassType Magick::Image::classType(void) const |
523 | 0 | { |
524 | 0 | return static_cast<Magick::ClassType>(constImage()->storage_class); |
525 | 0 | } |
526 | | |
527 | | void Magick::Image::colorFuzz(const double fuzz_) |
528 | 0 | { |
529 | 0 | modifyImage(); |
530 | 0 | image()->fuzz=fuzz_; |
531 | 0 | options()->colorFuzz(fuzz_); |
532 | 0 | } |
533 | | |
534 | | double Magick::Image::colorFuzz(void) const |
535 | 0 | { |
536 | 0 | return(constOptions()->colorFuzz()); |
537 | 0 | } |
538 | | |
539 | | void Magick::Image::colorMapSize(const size_t entries_) |
540 | 0 | { |
541 | 0 | if (entries_ >MaxColormapSize) |
542 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
543 | 0 | "Colormap entries must not exceed MaxColormapSize"); |
544 | |
|
545 | 0 | modifyImage(); |
546 | 0 | GetPPException; |
547 | 0 | (void) AcquireImageColormap(image(),entries_,exceptionInfo); |
548 | 0 | ThrowImageException; |
549 | 0 | } |
550 | | |
551 | | size_t Magick::Image::colorMapSize(void) const |
552 | 0 | { |
553 | 0 | if (!constImage()->colormap) |
554 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
555 | 0 | "Image does not contain a colormap"); |
556 | |
|
557 | 0 | return(constImage()->colors); |
558 | 0 | } |
559 | | |
560 | | void Magick::Image::colorSpace(const ColorspaceType colorSpace_) |
561 | 0 | { |
562 | 0 | if (image()->colorspace == colorSpace_) |
563 | 0 | return; |
564 | | |
565 | 0 | modifyImage(); |
566 | 0 | GetPPException; |
567 | 0 | TransformImageColorspace(image(),colorSpace_,exceptionInfo); |
568 | 0 | ThrowImageException; |
569 | 0 | } |
570 | | |
571 | | Magick::ColorspaceType Magick::Image::colorSpace(void) const |
572 | 0 | { |
573 | 0 | return (constImage()->colorspace); |
574 | 0 | } |
575 | | |
576 | | void Magick::Image::colorSpaceType(const ColorspaceType colorSpace_) |
577 | 0 | { |
578 | 0 | modifyImage(); |
579 | 0 | GetPPException; |
580 | 0 | SetImageColorspace(image(),colorSpace_,exceptionInfo); |
581 | 0 | ThrowImageException; |
582 | 0 | options()->colorspaceType(colorSpace_); |
583 | 0 | } |
584 | | |
585 | | Magick::ColorspaceType Magick::Image::colorSpaceType(void) const |
586 | 0 | { |
587 | 0 | return(constOptions()->colorspaceType()); |
588 | 0 | } |
589 | | |
590 | | size_t Magick::Image::columns(void) const |
591 | 0 | { |
592 | 0 | return(constImage()->columns); |
593 | 0 | } |
594 | | |
595 | | void Magick::Image::comment(const std::string &comment_) |
596 | 0 | { |
597 | 0 | modifyImage(); |
598 | 0 | GetPPException; |
599 | 0 | SetImageProperty(image(),"Comment",NULL,exceptionInfo); |
600 | 0 | if (comment_.length() > 0) |
601 | 0 | SetImageProperty(image(),"Comment",comment_.c_str(),exceptionInfo); |
602 | 0 | ThrowImageException; |
603 | 0 | } |
604 | | |
605 | | std::string Magick::Image::comment(void) const |
606 | 0 | { |
607 | 0 | const char |
608 | 0 | *value; |
609 | |
|
610 | 0 | GetPPException; |
611 | 0 | value=GetImageProperty(constImage(),"Comment",exceptionInfo); |
612 | 0 | ThrowImageException; |
613 | |
|
614 | 0 | if (value) |
615 | 0 | return(std::string(value)); |
616 | | |
617 | 0 | return(std::string()); // Intentionally no exception |
618 | 0 | } |
619 | | |
620 | | void Magick::Image::compose(const CompositeOperator compose_) |
621 | 0 | { |
622 | 0 | image()->compose=compose_; |
623 | 0 | } |
624 | | |
625 | | Magick::CompositeOperator Magick::Image::compose(void) const |
626 | 0 | { |
627 | 0 | return(constImage()->compose); |
628 | 0 | } |
629 | | |
630 | | void Magick::Image::compressType(const CompressionType compressType_) |
631 | 0 | { |
632 | 0 | modifyImage(); |
633 | 0 | image()->compression=compressType_; |
634 | 0 | options()->compressType(compressType_); |
635 | 0 | } |
636 | | |
637 | | Magick::CompressionType Magick::Image::compressType(void) const |
638 | 0 | { |
639 | 0 | return(constImage()->compression); |
640 | 0 | } |
641 | | |
642 | | void Magick::Image::debug(const bool flag_) |
643 | 0 | { |
644 | 0 | modifyImage(); |
645 | 0 | options()->debug(flag_); |
646 | 0 | } |
647 | | |
648 | | bool Magick::Image::debug(void) const |
649 | 0 | { |
650 | 0 | return(constOptions()->debug()); |
651 | 0 | } |
652 | | |
653 | | void Magick::Image::density(const Point &density_) |
654 | 0 | { |
655 | 0 | modifyImage(); |
656 | 0 | options()->density(density_); |
657 | 0 | if (density_.isValid()) |
658 | 0 | { |
659 | 0 | image()->resolution.x=density_.x(); |
660 | 0 | if (density_.y() != 0.0) |
661 | 0 | image()->resolution.y=density_.y(); |
662 | 0 | else |
663 | 0 | image()->resolution.y=density_.x(); |
664 | 0 | } |
665 | 0 | else |
666 | 0 | { |
667 | | // Reset to default |
668 | 0 | image()->resolution.x=0.0; |
669 | 0 | image()->resolution.y=0.0; |
670 | 0 | } |
671 | 0 | } |
672 | | |
673 | | Magick::Point Magick::Image::density(void) const |
674 | 0 | { |
675 | 0 | if (isValid()) |
676 | 0 | { |
677 | 0 | double |
678 | 0 | x_resolution=72, |
679 | 0 | y_resolution=72; |
680 | |
|
681 | 0 | if (constImage()->resolution.x > 0.0) |
682 | 0 | x_resolution=constImage()->resolution.x; |
683 | |
|
684 | 0 | if (constImage()->resolution.y > 0.0) |
685 | 0 | y_resolution=constImage()->resolution.y; |
686 | |
|
687 | 0 | return(Point(x_resolution, y_resolution)); |
688 | 0 | } |
689 | | |
690 | 0 | return(constOptions()->density()); |
691 | 0 | } |
692 | | |
693 | | void Magick::Image::depth(const size_t depth_) |
694 | 0 | { |
695 | 0 | modifyImage(); |
696 | 0 | image()->depth=depth_; |
697 | 0 | options()->depth(depth_); |
698 | 0 | } |
699 | | |
700 | | size_t Magick::Image::depth(void) const |
701 | 0 | { |
702 | 0 | return(constImage()->depth); |
703 | 0 | } |
704 | | |
705 | | std::string Magick::Image::directory(void) const |
706 | 0 | { |
707 | 0 | if (constImage()->directory) |
708 | 0 | return(std::string(constImage()->directory)); |
709 | | |
710 | 0 | if (!quiet()) |
711 | 0 | throwExceptionExplicit(MagickCore::CorruptImageWarning, |
712 | 0 | "Image does not contain a directory"); |
713 | |
|
714 | 0 | return(std::string()); |
715 | 0 | } |
716 | | |
717 | | void Magick::Image::endian(const Magick::EndianType endian_) |
718 | 0 | { |
719 | 0 | modifyImage(); |
720 | 0 | options()->endian(endian_); |
721 | 0 | image()->endian=endian_; |
722 | 0 | } |
723 | | |
724 | | Magick::EndianType Magick::Image::endian(void) const |
725 | 0 | { |
726 | 0 | return(constImage()->endian); |
727 | 0 | } |
728 | | |
729 | | void Magick::Image::exifProfile(const Magick::Blob &exifProfile_) |
730 | 0 | { |
731 | 0 | modifyImage(); |
732 | |
|
733 | 0 | if (exifProfile_.data() != 0) |
734 | 0 | { |
735 | 0 | StringInfo |
736 | 0 | *exif_profile; |
737 | |
|
738 | 0 | exif_profile=AcquireStringInfo(exifProfile_.length()); |
739 | 0 | SetStringInfoDatum(exif_profile,(unsigned char *) exifProfile_.data()); |
740 | 0 | GetPPException; |
741 | 0 | (void) SetImageProfile(image(),"exif",exif_profile,exceptionInfo); |
742 | 0 | exif_profile=DestroyStringInfo(exif_profile); |
743 | 0 | ThrowImageException; |
744 | 0 | } |
745 | 0 | } |
746 | | |
747 | | Magick::Blob Magick::Image::exifProfile(void) const |
748 | 0 | { |
749 | 0 | const StringInfo |
750 | 0 | *exif_profile; |
751 | |
|
752 | 0 | exif_profile=GetImageProfile(constImage(),"exif"); |
753 | 0 | if (exif_profile == (StringInfo *) NULL) |
754 | 0 | return(Blob()); |
755 | 0 | return(Blob(GetStringInfoDatum(exif_profile), |
756 | 0 | GetStringInfoLength(exif_profile))); |
757 | 0 | } |
758 | | |
759 | | void Magick::Image::fileName(const std::string &fileName_) |
760 | 547k | { |
761 | 547k | ssize_t |
762 | 547k | max_length; |
763 | | |
764 | 547k | modifyImage(); |
765 | | |
766 | 547k | max_length=sizeof(image()->filename)-1; |
767 | 547k | fileName_.copy(image()->filename,(size_t) max_length); |
768 | 547k | if ((ssize_t) fileName_.length() > max_length) |
769 | 0 | image()->filename[max_length]=0; |
770 | 547k | else |
771 | 547k | image()->filename[fileName_.length()]=0; |
772 | | |
773 | 547k | options()->fileName(fileName_); |
774 | 547k | } |
775 | | |
776 | | std::string Magick::Image::fileName(void) const |
777 | 0 | { |
778 | 0 | return(constOptions()->fileName()); |
779 | 0 | } |
780 | | |
781 | | MagickCore::MagickSizeType Magick::Image::fileSize(void) const |
782 | 0 | { |
783 | 0 | return(GetBlobSize(constImage())); |
784 | 0 | } |
785 | | |
786 | | void Magick::Image::fillColor(const Magick::Color &fillColor_) |
787 | 0 | { |
788 | 0 | modifyImage(); |
789 | 0 | options()->fillColor(fillColor_); |
790 | 0 | } |
791 | | |
792 | | Magick::Color Magick::Image::fillColor(void) const |
793 | 0 | { |
794 | 0 | return(constOptions()->fillColor()); |
795 | 0 | } |
796 | | |
797 | | void Magick::Image::fillRule(const Magick::FillRule &fillRule_) |
798 | 0 | { |
799 | 0 | modifyImage(); |
800 | 0 | options()->fillRule(fillRule_); |
801 | 0 | } |
802 | | |
803 | | Magick::FillRule Magick::Image::fillRule(void) const |
804 | 0 | { |
805 | 0 | return constOptions()->fillRule(); |
806 | 0 | } |
807 | | |
808 | | void Magick::Image::fillPattern(const Image &fillPattern_) |
809 | 0 | { |
810 | 0 | modifyImage(); |
811 | 0 | if (fillPattern_.isValid()) |
812 | 0 | options()->fillPattern(fillPattern_.constImage()); |
813 | 0 | else |
814 | 0 | options()->fillPattern(static_cast<MagickCore::Image*>(NULL)); |
815 | 0 | } |
816 | | |
817 | | Magick::Image Magick::Image::fillPattern(void) const |
818 | 0 | { |
819 | | // FIXME: This is inordinately inefficient |
820 | 0 | const MagickCore::Image |
821 | 0 | *tmpTexture; |
822 | |
|
823 | 0 | Image |
824 | 0 | texture; |
825 | |
|
826 | 0 | tmpTexture=constOptions()->fillPattern(); |
827 | |
|
828 | 0 | if (tmpTexture) |
829 | 0 | { |
830 | 0 | MagickCore::Image |
831 | 0 | *image; |
832 | |
|
833 | 0 | GetPPException; |
834 | 0 | image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo); |
835 | 0 | texture.replaceImage(image); |
836 | 0 | ThrowImageException; |
837 | 0 | } |
838 | 0 | return(texture); |
839 | 0 | } |
840 | | |
841 | | void Magick::Image::filterType(const Magick::FilterType filterType_) |
842 | 0 | { |
843 | 0 | modifyImage(); |
844 | 0 | image()->filter=filterType_; |
845 | 0 | } |
846 | | |
847 | | Magick::FilterType Magick::Image::filterType(void) const |
848 | 0 | { |
849 | 0 | return(constImage()->filter); |
850 | 0 | } |
851 | | |
852 | | void Magick::Image::font(const std::string &font_) |
853 | 0 | { |
854 | 0 | modifyImage(); |
855 | 0 | options()->font(font_); |
856 | 0 | } |
857 | | |
858 | | std::string Magick::Image::font(void) const |
859 | 0 | { |
860 | 0 | return(constOptions()->font()); |
861 | 0 | } |
862 | | |
863 | | void Magick::Image::fontFamily(const std::string &family_) |
864 | 0 | { |
865 | 0 | modifyImage(); |
866 | 0 | options()->fontFamily(family_); |
867 | 0 | } |
868 | | |
869 | | std::string Magick::Image::fontFamily(void) const |
870 | 0 | { |
871 | 0 | return(constOptions()->fontFamily()); |
872 | 0 | } |
873 | | |
874 | | void Magick::Image::fontPointsize(const double pointSize_) |
875 | 0 | { |
876 | 0 | modifyImage(); |
877 | 0 | options()->fontPointsize(pointSize_); |
878 | 0 | } |
879 | | |
880 | | double Magick::Image::fontPointsize(void) const |
881 | 0 | { |
882 | 0 | return(constOptions()->fontPointsize()); |
883 | 0 | } |
884 | | |
885 | | void Magick::Image::fontStyle(const StyleType pointSize_) |
886 | 0 | { |
887 | 0 | modifyImage(); |
888 | 0 | options()->fontStyle(pointSize_); |
889 | 0 | } |
890 | | |
891 | | Magick::StyleType Magick::Image::fontStyle(void) const |
892 | 0 | { |
893 | 0 | return(constOptions()->fontStyle()); |
894 | 0 | } |
895 | | |
896 | | void Magick::Image::fontWeight(const size_t weight_) |
897 | 0 | { |
898 | 0 | modifyImage(); |
899 | 0 | options()->fontWeight(weight_); |
900 | 0 | } |
901 | | |
902 | | size_t Magick::Image::fontWeight(void) const |
903 | 0 | { |
904 | 0 | return(constOptions()->fontWeight()); |
905 | 0 | } |
906 | | |
907 | | std::string Magick::Image::format(void) const |
908 | 0 | { |
909 | 0 | const MagickInfo |
910 | 0 | *magick_info; |
911 | |
|
912 | 0 | GetPPException; |
913 | 0 | magick_info=GetMagickInfo(constImage()->magick,exceptionInfo); |
914 | 0 | ThrowImageException; |
915 | |
|
916 | 0 | if ((magick_info != 0) && (*magick_info->description != '\0')) |
917 | 0 | return(std::string(magick_info->description)); |
918 | | |
919 | 0 | if (!quiet()) |
920 | 0 | throwExceptionExplicit(MagickCore::CorruptImageWarning, |
921 | 0 | "Unrecognized image magick type"); |
922 | |
|
923 | 0 | return(std::string()); |
924 | 0 | } |
925 | | |
926 | | std::string Magick::Image::formatExpression(const std::string expression) |
927 | 0 | { |
928 | 0 | char |
929 | 0 | *text; |
930 | |
|
931 | 0 | std::string |
932 | 0 | text_string; |
933 | |
|
934 | 0 | GetPPException; |
935 | 0 | modifyImage(); |
936 | 0 | text=InterpretImageProperties(imageInfo(),image(),expression.c_str(), |
937 | 0 | exceptionInfo); |
938 | 0 | if (text != (char *) NULL) |
939 | 0 | { |
940 | 0 | text_string=std::string(text); |
941 | 0 | text=DestroyString(text); |
942 | 0 | } |
943 | 0 | ThrowImageException; |
944 | 0 | return(text_string); |
945 | 0 | } |
946 | | |
947 | | double Magick::Image::gamma(void) const |
948 | 0 | { |
949 | 0 | return(constImage()->gamma); |
950 | 0 | } |
951 | | |
952 | | Magick::Geometry Magick::Image::geometry(void) const |
953 | 0 | { |
954 | 0 | if (constImage()->geometry) |
955 | 0 | return Geometry(constImage()->geometry); |
956 | | |
957 | 0 | if (!quiet()) |
958 | 0 | throwExceptionExplicit(MagickCore::OptionWarning, |
959 | 0 | "Image does not contain a geometry"); |
960 | |
|
961 | 0 | return(Geometry()); |
962 | 0 | } |
963 | | |
964 | | void Magick::Image::gifDisposeMethod( |
965 | | const MagickCore::DisposeType disposeMethod_) |
966 | 0 | { |
967 | 0 | modifyImage(); |
968 | 0 | image()->dispose=disposeMethod_; |
969 | 0 | } |
970 | | |
971 | | MagickCore::DisposeType Magick::Image::gifDisposeMethod(void) const |
972 | 0 | { |
973 | 0 | return(constImage()->dispose); |
974 | 0 | } |
975 | | |
976 | | bool Magick::Image::hasChannel(const PixelChannel channel) const |
977 | 0 | { |
978 | 0 | if (GetPixelChannelTraits(constImage(),channel) == UndefinedPixelTrait) |
979 | 0 | return(false); |
980 | | |
981 | 0 | if (channel == GreenPixelChannel || channel == BluePixelChannel) |
982 | 0 | return (GetPixelChannelOffset(constImage(),channel) == (ssize_t)channel); |
983 | | |
984 | 0 | return(true); |
985 | 0 | } |
986 | | |
987 | | void Magick::Image::highlightColor(const Color color_) |
988 | 0 | { |
989 | 0 | std::string |
990 | 0 | value; |
991 | |
|
992 | 0 | value=color_; |
993 | 0 | artifact("compare:highlight-color",value); |
994 | 0 | } |
995 | | |
996 | | void Magick::Image::iccColorProfile(const Magick::Blob &colorProfile_) |
997 | 0 | { |
998 | 0 | profile("icc",colorProfile_); |
999 | 0 | } |
1000 | | |
1001 | | Magick::Blob Magick::Image::iccColorProfile(void) const |
1002 | 0 | { |
1003 | 0 | const StringInfo |
1004 | 0 | *color_profile; |
1005 | |
|
1006 | 0 | color_profile=GetImageProfile(constImage(),"icc"); |
1007 | 0 | if (color_profile == (StringInfo *) NULL) |
1008 | 0 | return(Blob()); |
1009 | 0 | return(Blob(GetStringInfoDatum(color_profile),GetStringInfoLength( |
1010 | 0 | color_profile))); |
1011 | 0 | } |
1012 | | |
1013 | | void Magick::Image::interlaceType(const Magick::InterlaceType interlace_) |
1014 | 0 | { |
1015 | 0 | modifyImage(); |
1016 | 0 | image()->interlace=interlace_; |
1017 | 0 | options()->interlaceType(interlace_); |
1018 | 0 | } |
1019 | | |
1020 | | Magick::InterlaceType Magick::Image::interlaceType(void) const |
1021 | 0 | { |
1022 | 0 | return(constImage()->interlace); |
1023 | 0 | } |
1024 | | |
1025 | | void Magick::Image::interpolate(const PixelInterpolateMethod interpolate_) |
1026 | 0 | { |
1027 | 0 | modifyImage(); |
1028 | 0 | image()->interpolate=interpolate_; |
1029 | 0 | } |
1030 | | |
1031 | | Magick::PixelInterpolateMethod Magick::Image::interpolate(void) const |
1032 | 0 | { |
1033 | 0 | return constImage()->interpolate; |
1034 | 0 | } |
1035 | | |
1036 | | void Magick::Image::iptcProfile(const Magick::Blob &iptcProfile_) |
1037 | 0 | { |
1038 | 0 | modifyImage(); |
1039 | 0 | if (iptcProfile_.data() != 0) |
1040 | 0 | { |
1041 | 0 | StringInfo |
1042 | 0 | *iptc_profile; |
1043 | |
|
1044 | 0 | iptc_profile=AcquireStringInfo(iptcProfile_.length()); |
1045 | 0 | SetStringInfoDatum(iptc_profile,(unsigned char *) iptcProfile_.data()); |
1046 | 0 | GetPPException; |
1047 | 0 | (void) SetImageProfile(image(),"iptc",iptc_profile,exceptionInfo); |
1048 | 0 | iptc_profile=DestroyStringInfo(iptc_profile); |
1049 | 0 | ThrowImageException; |
1050 | 0 | } |
1051 | 0 | } |
1052 | | |
1053 | | Magick::Blob Magick::Image::iptcProfile(void) const |
1054 | 0 | { |
1055 | 0 | const StringInfo |
1056 | 0 | *iptc_profile; |
1057 | |
|
1058 | 0 | iptc_profile=GetImageProfile(constImage(),"iptc"); |
1059 | 0 | if (iptc_profile == (StringInfo *) NULL) |
1060 | 0 | return(Blob()); |
1061 | 0 | return(Blob(GetStringInfoDatum(iptc_profile),GetStringInfoLength( |
1062 | 0 | iptc_profile))); |
1063 | 0 | } |
1064 | | |
1065 | | bool Magick::Image::isOpaque(void) const |
1066 | 0 | { |
1067 | 0 | MagickBooleanType |
1068 | 0 | result; |
1069 | |
|
1070 | 0 | GetPPException; |
1071 | 0 | result=IsImageOpaque(constImage(),exceptionInfo); |
1072 | 0 | ThrowImageException; |
1073 | 0 | return(result != MagickFalse ? true : false); |
1074 | 0 | } |
1075 | | |
1076 | | void Magick::Image::isValid(const bool isValid_) |
1077 | 0 | { |
1078 | 0 | if (!isValid_) |
1079 | 0 | { |
1080 | 0 | delete _imgRef; |
1081 | 0 | _imgRef=new ImageRef; |
1082 | 0 | } |
1083 | 0 | else if (!isValid()) |
1084 | 0 | { |
1085 | | // Construct with single-pixel black image to make |
1086 | | // image valid. This is an obvious hack. |
1087 | 0 | size(Geometry(1,1)); |
1088 | 0 | read("xc:black"); |
1089 | 0 | } |
1090 | 0 | } |
1091 | | |
1092 | | bool Magick::Image::isValid(void) const |
1093 | 0 | { |
1094 | 0 | return rows() && columns(); |
1095 | 0 | } |
1096 | | |
1097 | | void Magick::Image::label(const std::string &label_) |
1098 | 0 | { |
1099 | 0 | modifyImage(); |
1100 | 0 | GetPPException; |
1101 | 0 | (void) SetImageProperty(image(),"Label",NULL,exceptionInfo); |
1102 | 0 | if (label_.length() > 0) |
1103 | 0 | (void) SetImageProperty(image(),"Label",label_.c_str(),exceptionInfo); |
1104 | 0 | ThrowImageException; |
1105 | 0 | } |
1106 | | |
1107 | | std::string Magick::Image::label(void) const |
1108 | 0 | { |
1109 | 0 | const char |
1110 | 0 | *value; |
1111 | |
|
1112 | 0 | GetPPException; |
1113 | 0 | value=GetImageProperty(constImage(),"Label",exceptionInfo); |
1114 | 0 | ThrowImageException; |
1115 | |
|
1116 | 0 | if (value) |
1117 | 0 | return(std::string(value)); |
1118 | | |
1119 | 0 | return(std::string()); |
1120 | 0 | } |
1121 | | |
1122 | | void Magick::Image::lowlightColor(const Color color_) |
1123 | 0 | { |
1124 | 0 | std::string |
1125 | 0 | value; |
1126 | |
|
1127 | 0 | value=color_; |
1128 | 0 | artifact("compare:lowlight-color",value); |
1129 | 0 | } |
1130 | | |
1131 | | void Magick::Image::magick(const std::string &magick_) |
1132 | 615k | { |
1133 | 615k | size_t |
1134 | 615k | length; |
1135 | | |
1136 | 615k | modifyImage(); |
1137 | | |
1138 | 615k | length=sizeof(image()->magick)-1; |
1139 | 615k | if (magick_.length() < length) |
1140 | 615k | length=magick_.length(); |
1141 | | |
1142 | 615k | if (!magick_.empty()) |
1143 | 615k | magick_.copy(image()->magick,length); |
1144 | 615k | image()->magick[length]=0; |
1145 | | |
1146 | 615k | options()->magick(magick_); |
1147 | 615k | } |
1148 | | |
1149 | | std::string Magick::Image::magick(void) const |
1150 | 0 | { |
1151 | 0 | if (*(constImage()->magick) != '\0') |
1152 | 0 | return(std::string(constImage()->magick)); |
1153 | | |
1154 | 0 | return(constOptions()->magick()); |
1155 | 0 | } |
1156 | | |
1157 | | void Magick::Image::masklightColor(const Color color_) |
1158 | 0 | { |
1159 | 0 | std::string |
1160 | 0 | value; |
1161 | |
|
1162 | 0 | value=color_; |
1163 | 0 | artifact("compare:masklight-color",value); |
1164 | 0 | } |
1165 | | |
1166 | | double Magick::Image::meanErrorPerPixel(void) const |
1167 | 0 | { |
1168 | 0 | return(constImage()->error.mean_error_per_pixel); |
1169 | 0 | } |
1170 | | |
1171 | | void Magick::Image::modulusDepth(const size_t depth_) |
1172 | 0 | { |
1173 | 0 | modifyImage(); |
1174 | 0 | GetPPException; |
1175 | 0 | SetImageDepth(image(),depth_,exceptionInfo); |
1176 | 0 | ThrowImageException; |
1177 | 0 | options()->depth(depth_); |
1178 | 0 | } |
1179 | | |
1180 | | size_t Magick::Image::modulusDepth(void) const |
1181 | 0 | { |
1182 | 0 | size_t |
1183 | 0 | depth; |
1184 | |
|
1185 | 0 | GetPPException; |
1186 | 0 | depth=GetImageDepth(constImage(),exceptionInfo); |
1187 | 0 | ThrowImageException; |
1188 | 0 | return(depth); |
1189 | 0 | } |
1190 | | |
1191 | | void Magick::Image::monochrome(const bool monochromeFlag_) |
1192 | 0 | { |
1193 | 0 | modifyImage(); |
1194 | 0 | options()->monochrome(monochromeFlag_); |
1195 | 0 | } |
1196 | | |
1197 | | bool Magick::Image::monochrome(void) const |
1198 | 0 | { |
1199 | 0 | return(constOptions()->monochrome()); |
1200 | 0 | } |
1201 | | |
1202 | | Magick::Geometry Magick::Image::montageGeometry(void) const |
1203 | 0 | { |
1204 | 0 | if (constImage()->montage) |
1205 | 0 | return Magick::Geometry(constImage()->montage); |
1206 | | |
1207 | 0 | if (!quiet()) |
1208 | 0 | throwExceptionExplicit(MagickCore::CorruptImageWarning, |
1209 | 0 | "Image does not contain a montage"); |
1210 | |
|
1211 | 0 | return(Magick::Geometry()); |
1212 | 0 | } |
1213 | | |
1214 | | double Magick::Image::normalizedMaxError(void) const |
1215 | 0 | { |
1216 | 0 | return(constImage()->error.normalized_maximum_error); |
1217 | 0 | } |
1218 | | |
1219 | | double Magick::Image::normalizedMeanError(void) const |
1220 | 0 | { |
1221 | 0 | return(constImage()->error.normalized_mean_error); |
1222 | 0 | } |
1223 | | |
1224 | | void Magick::Image::orientation(const Magick::OrientationType orientation_) |
1225 | 0 | { |
1226 | 0 | modifyImage(); |
1227 | 0 | image()->orientation=orientation_; |
1228 | 0 | } |
1229 | | |
1230 | | Magick::OrientationType Magick::Image::orientation(void) const |
1231 | 0 | { |
1232 | 0 | return(constImage()->orientation); |
1233 | 0 | } |
1234 | | |
1235 | | void Magick::Image::page(const Magick::Geometry &pageSize_) |
1236 | 0 | { |
1237 | 0 | modifyImage(); |
1238 | 0 | options()->page(pageSize_); |
1239 | 0 | image()->page=pageSize_; |
1240 | 0 | } |
1241 | | |
1242 | | Magick::Geometry Magick::Image::page(void) const |
1243 | 0 | { |
1244 | 0 | return(Geometry(constImage()->page.width,constImage()->page.height, |
1245 | 0 | constImage()->page.x,constImage()->page.y)); |
1246 | 0 | } |
1247 | | |
1248 | | void Magick::Image::quality(const size_t quality_) |
1249 | 0 | { |
1250 | 0 | modifyImage(); |
1251 | 0 | image()->quality=quality_; |
1252 | 0 | options()->quality(quality_); |
1253 | 0 | } |
1254 | | |
1255 | | size_t Magick::Image::quality(void) const |
1256 | 0 | { |
1257 | 0 | return(constImage()->quality); |
1258 | 0 | } |
1259 | | |
1260 | | void Magick::Image::quantizeColors(const size_t colors_) |
1261 | 0 | { |
1262 | 0 | modifyImage(); |
1263 | 0 | options()->quantizeColors(colors_); |
1264 | 0 | } |
1265 | | |
1266 | | size_t Magick::Image::quantizeColors(void) const |
1267 | 0 | { |
1268 | 0 | return(constOptions()->quantizeColors()); |
1269 | 0 | } |
1270 | | |
1271 | | void Magick::Image::quantizeColorSpace( |
1272 | | const Magick::ColorspaceType colorSpace_) |
1273 | 0 | { |
1274 | 0 | modifyImage(); |
1275 | 0 | options()->quantizeColorSpace(colorSpace_); |
1276 | 0 | } |
1277 | | |
1278 | | Magick::ColorspaceType Magick::Image::quantizeColorSpace(void) const |
1279 | 0 | { |
1280 | 0 | return(constOptions()->quantizeColorSpace()); |
1281 | 0 | } |
1282 | | |
1283 | | void Magick::Image::quantizeDither(const bool ditherFlag_) |
1284 | 0 | { |
1285 | 0 | modifyImage(); |
1286 | 0 | options()->quantizeDither(ditherFlag_); |
1287 | 0 | } |
1288 | | |
1289 | | bool Magick::Image::quantizeDither(void) const |
1290 | 0 | { |
1291 | 0 | return(constOptions()->quantizeDither()); |
1292 | 0 | } |
1293 | | |
1294 | | void Magick::Image::quantizeDitherMethod(const DitherMethod ditherMethod_) |
1295 | 0 | { |
1296 | 0 | modifyImage(); |
1297 | 0 | options()->quantizeDitherMethod(ditherMethod_); |
1298 | 0 | } |
1299 | | |
1300 | | MagickCore::DitherMethod Magick::Image::quantizeDitherMethod(void) const |
1301 | 0 | { |
1302 | 0 | return(constOptions()->quantizeDitherMethod()); |
1303 | 0 | } |
1304 | | |
1305 | | void Magick::Image::quantizeTreeDepth(const size_t treeDepth_) |
1306 | 0 | { |
1307 | 0 | modifyImage(); |
1308 | 0 | options()->quantizeTreeDepth(treeDepth_); |
1309 | 0 | } |
1310 | | |
1311 | | size_t Magick::Image::quantizeTreeDepth() const |
1312 | 0 | { |
1313 | 0 | return(constOptions()->quantizeTreeDepth()); |
1314 | 0 | } |
1315 | | |
1316 | | void Magick::Image::quiet(const bool quiet_) |
1317 | 0 | { |
1318 | 0 | modifyImage(); |
1319 | 0 | options()->quiet(quiet_); |
1320 | 0 | } |
1321 | | |
1322 | | bool Magick::Image::quiet(void) const |
1323 | 1.03M | { |
1324 | 1.03M | return(constOptions()->quiet()); |
1325 | 1.03M | } |
1326 | | |
1327 | | void Magick::Image::renderingIntent( |
1328 | | const Magick::RenderingIntent renderingIntent_) |
1329 | 0 | { |
1330 | 0 | modifyImage(); |
1331 | 0 | image()->rendering_intent=renderingIntent_; |
1332 | 0 | } |
1333 | | |
1334 | | Magick::RenderingIntent Magick::Image::renderingIntent(void) const |
1335 | 0 | { |
1336 | 0 | return(static_cast<Magick::RenderingIntent>(constImage()->rendering_intent)); |
1337 | 0 | } |
1338 | | |
1339 | | void Magick::Image::resolutionUnits( |
1340 | | const Magick::ResolutionType resolutionUnits_) |
1341 | 0 | { |
1342 | 0 | modifyImage(); |
1343 | 0 | image()->units=resolutionUnits_; |
1344 | 0 | options()->resolutionUnits(resolutionUnits_); |
1345 | 0 | } |
1346 | | |
1347 | | Magick::ResolutionType Magick::Image::resolutionUnits(void) const |
1348 | 0 | { |
1349 | 0 | return(static_cast<Magick::ResolutionType>(constImage()->units)); |
1350 | 0 | } |
1351 | | |
1352 | | size_t Magick::Image::rows(void) const |
1353 | 0 | { |
1354 | 0 | return(constImage()->rows); |
1355 | 0 | } |
1356 | | |
1357 | | void Magick::Image::samplingFactor(const std::string &samplingFactor_) |
1358 | 0 | { |
1359 | 0 | modifyImage(); |
1360 | 0 | options()->samplingFactor(samplingFactor_); |
1361 | 0 | } |
1362 | | |
1363 | | std::string Magick::Image::samplingFactor(void) const |
1364 | 0 | { |
1365 | 0 | return(constOptions()->samplingFactor()); |
1366 | 0 | } |
1367 | | |
1368 | | void Magick::Image::scene(const size_t scene_) |
1369 | 0 | { |
1370 | 0 | modifyImage(); |
1371 | 0 | image()->scene=scene_; |
1372 | 0 | } |
1373 | | |
1374 | | size_t Magick::Image::scene(void) const |
1375 | 0 | { |
1376 | 0 | return(constImage()->scene); |
1377 | 0 | } |
1378 | | |
1379 | | void Magick::Image::size(const Geometry &geometry_) |
1380 | 0 | { |
1381 | 0 | modifyImage(); |
1382 | 0 | options()->size(geometry_); |
1383 | 0 | image()->rows=geometry_.height(); |
1384 | 0 | image()->columns=geometry_.width(); |
1385 | 0 | } |
1386 | | |
1387 | | Magick::Geometry Magick::Image::size(void) const |
1388 | 0 | { |
1389 | 0 | return(Magick::Geometry(constImage()->columns,constImage()->rows)); |
1390 | 0 | } |
1391 | | |
1392 | | void Magick::Image::strokeAntiAlias(const bool flag_) |
1393 | 0 | { |
1394 | 0 | modifyImage(); |
1395 | 0 | options()->strokeAntiAlias(flag_); |
1396 | 0 | } |
1397 | | |
1398 | | bool Magick::Image::strokeAntiAlias(void) const |
1399 | 0 | { |
1400 | 0 | return(constOptions()->strokeAntiAlias()); |
1401 | 0 | } |
1402 | | |
1403 | | void Magick::Image::strokeColor(const Magick::Color &strokeColor_) |
1404 | 0 | { |
1405 | 0 | std::string |
1406 | 0 | value; |
1407 | |
|
1408 | 0 | modifyImage(); |
1409 | 0 | options()->strokeColor(strokeColor_); |
1410 | 0 | value=strokeColor_; |
1411 | 0 | artifact("stroke",value); |
1412 | 0 | } |
1413 | | |
1414 | | Magick::Color Magick::Image::strokeColor(void) const |
1415 | 0 | { |
1416 | 0 | return(constOptions()->strokeColor()); |
1417 | 0 | } |
1418 | | |
1419 | | void Magick::Image::strokeDashArray(const double *strokeDashArray_) |
1420 | 0 | { |
1421 | 0 | modifyImage(); |
1422 | 0 | options()->strokeDashArray(strokeDashArray_); |
1423 | 0 | } |
1424 | | |
1425 | | const double* Magick::Image::strokeDashArray(void) const |
1426 | 0 | { |
1427 | 0 | return(constOptions()->strokeDashArray()); |
1428 | 0 | } |
1429 | | |
1430 | | void Magick::Image::strokeDashOffset(const double strokeDashOffset_) |
1431 | 0 | { |
1432 | 0 | modifyImage(); |
1433 | 0 | options()->strokeDashOffset(strokeDashOffset_); |
1434 | 0 | } |
1435 | | |
1436 | | double Magick::Image::strokeDashOffset(void) const |
1437 | 0 | { |
1438 | 0 | return(constOptions()->strokeDashOffset()); |
1439 | 0 | } |
1440 | | |
1441 | | void Magick::Image::strokeLineCap(const Magick::LineCap lineCap_) |
1442 | 0 | { |
1443 | 0 | modifyImage(); |
1444 | 0 | options()->strokeLineCap(lineCap_); |
1445 | 0 | } |
1446 | | |
1447 | | Magick::LineCap Magick::Image::strokeLineCap(void) const |
1448 | 0 | { |
1449 | 0 | return(constOptions()->strokeLineCap()); |
1450 | 0 | } |
1451 | | |
1452 | | void Magick::Image::strokeLineJoin(const Magick::LineJoin lineJoin_) |
1453 | 0 | { |
1454 | 0 | modifyImage(); |
1455 | 0 | options()->strokeLineJoin(lineJoin_); |
1456 | 0 | } |
1457 | | |
1458 | | Magick::LineJoin Magick::Image::strokeLineJoin(void) const |
1459 | 0 | { |
1460 | 0 | return(constOptions()->strokeLineJoin()); |
1461 | 0 | } |
1462 | | |
1463 | | void Magick::Image::strokeMiterLimit(const size_t strokeMiterLimit_) |
1464 | 0 | { |
1465 | 0 | modifyImage(); |
1466 | 0 | options()->strokeMiterLimit(strokeMiterLimit_); |
1467 | 0 | } |
1468 | | |
1469 | | size_t Magick::Image::strokeMiterLimit(void) const |
1470 | 0 | { |
1471 | 0 | return(constOptions()->strokeMiterLimit()); |
1472 | 0 | } |
1473 | | |
1474 | | void Magick::Image::strokePattern(const Image &strokePattern_) |
1475 | 0 | { |
1476 | 0 | modifyImage(); |
1477 | 0 | if(strokePattern_.isValid()) |
1478 | 0 | options()->strokePattern(strokePattern_.constImage()); |
1479 | 0 | else |
1480 | 0 | options()->strokePattern(static_cast<MagickCore::Image*>(NULL)); |
1481 | 0 | } |
1482 | | |
1483 | | Magick::Image Magick::Image::strokePattern(void) const |
1484 | 0 | { |
1485 | | // FIXME: This is inordinately inefficient |
1486 | 0 | const MagickCore::Image |
1487 | 0 | *tmpTexture; |
1488 | |
|
1489 | 0 | Image |
1490 | 0 | texture; |
1491 | |
|
1492 | 0 | tmpTexture=constOptions()->strokePattern(); |
1493 | |
|
1494 | 0 | if (tmpTexture) |
1495 | 0 | { |
1496 | 0 | MagickCore::Image |
1497 | 0 | *image; |
1498 | |
|
1499 | 0 | GetPPException; |
1500 | 0 | image=CloneImage(tmpTexture,0,0,MagickTrue,exceptionInfo); |
1501 | 0 | texture.replaceImage(image); |
1502 | 0 | ThrowImageException; |
1503 | 0 | } |
1504 | 0 | return(texture); |
1505 | 0 | } |
1506 | | |
1507 | | void Magick::Image::strokeWidth(const double strokeWidth_) |
1508 | 0 | { |
1509 | 0 | char |
1510 | 0 | value[MagickPathExtent]; |
1511 | |
|
1512 | 0 | modifyImage(); |
1513 | 0 | options()->strokeWidth(strokeWidth_); |
1514 | 0 | FormatLocaleString(value,MagickPathExtent,"%.20g",strokeWidth_); |
1515 | 0 | (void) SetImageArtifact(image(),"strokewidth",value); |
1516 | 0 | } |
1517 | | |
1518 | | double Magick::Image::strokeWidth(void) const |
1519 | 0 | { |
1520 | 0 | return(constOptions()->strokeWidth()); |
1521 | 0 | } |
1522 | | |
1523 | | void Magick::Image::subImage(const size_t subImage_) |
1524 | 0 | { |
1525 | 0 | modifyImage(); |
1526 | 0 | options()->subImage(subImage_); |
1527 | 0 | } |
1528 | | |
1529 | | size_t Magick::Image::subImage(void) const |
1530 | 0 | { |
1531 | 0 | return(constOptions()->subImage()); |
1532 | 0 | } |
1533 | | |
1534 | | void Magick::Image::subRange(const size_t subRange_) |
1535 | 0 | { |
1536 | 0 | modifyImage(); |
1537 | 0 | options()->subRange(subRange_); |
1538 | 0 | } |
1539 | | |
1540 | | size_t Magick::Image::subRange(void) const |
1541 | 0 | { |
1542 | 0 | return(constOptions()->subRange()); |
1543 | 0 | } |
1544 | | |
1545 | | void Magick::Image::textAntiAlias(const bool flag_) |
1546 | 0 | { |
1547 | 0 | modifyImage(); |
1548 | 0 | options()->textAntiAlias(flag_); |
1549 | 0 | } |
1550 | | |
1551 | | bool Magick::Image::textAntiAlias(void) const |
1552 | 0 | { |
1553 | 0 | return(constOptions()->textAntiAlias()); |
1554 | 0 | } |
1555 | | |
1556 | | void Magick::Image::textDirection(DirectionType direction_) |
1557 | 0 | { |
1558 | 0 | modifyImage(); |
1559 | 0 | options()->textDirection(direction_); |
1560 | 0 | } |
1561 | | |
1562 | | Magick::DirectionType Magick::Image::textDirection(void) const |
1563 | 0 | { |
1564 | 0 | return(constOptions()->textDirection()); |
1565 | 0 | } |
1566 | | |
1567 | | void Magick::Image::textEncoding(const std::string &encoding_) |
1568 | 0 | { |
1569 | 0 | modifyImage(); |
1570 | 0 | options()->textEncoding(encoding_); |
1571 | 0 | } |
1572 | | |
1573 | | std::string Magick::Image::textEncoding(void) const |
1574 | 0 | { |
1575 | 0 | return(constOptions()->textEncoding()); |
1576 | 0 | } |
1577 | | |
1578 | | void Magick::Image::textGravity(GravityType gravity_) |
1579 | 0 | { |
1580 | 0 | modifyImage(); |
1581 | 0 | options()->textGravity(gravity_); |
1582 | 0 | } |
1583 | | |
1584 | | Magick::GravityType Magick::Image::textGravity(void) const |
1585 | 0 | { |
1586 | 0 | return(constOptions()->textGravity()); |
1587 | 0 | } |
1588 | | |
1589 | | void Magick::Image::textInterlineSpacing(double spacing_) |
1590 | 0 | { |
1591 | 0 | modifyImage(); |
1592 | 0 | options()->textInterlineSpacing(spacing_); |
1593 | 0 | } |
1594 | | |
1595 | | double Magick::Image::textInterlineSpacing(void) const |
1596 | 0 | { |
1597 | 0 | return(constOptions()->textInterlineSpacing()); |
1598 | 0 | } |
1599 | | |
1600 | | void Magick::Image::textInterwordSpacing(double spacing_) |
1601 | 0 | { |
1602 | 0 | modifyImage(); |
1603 | 0 | options()->textInterwordSpacing(spacing_); |
1604 | 0 | } |
1605 | | |
1606 | | double Magick::Image::textInterwordSpacing(void) const |
1607 | 0 | { |
1608 | 0 | return(constOptions()->textInterwordSpacing()); |
1609 | 0 | } |
1610 | | |
1611 | | void Magick::Image::textKerning(double kerning_) |
1612 | 0 | { |
1613 | 0 | modifyImage(); |
1614 | 0 | options()->textKerning(kerning_); |
1615 | 0 | } |
1616 | | |
1617 | | double Magick::Image::textKerning(void) const |
1618 | 0 | { |
1619 | 0 | return(constOptions()->textKerning()); |
1620 | 0 | } |
1621 | | |
1622 | | void Magick::Image::textUnderColor(const Color &underColor_) |
1623 | 0 | { |
1624 | 0 | modifyImage(); |
1625 | 0 | options()->textUnderColor(underColor_); |
1626 | 0 | } |
1627 | | |
1628 | | Magick::Color Magick::Image::textUnderColor(void) const |
1629 | 0 | { |
1630 | 0 | return(constOptions()->textUnderColor()); |
1631 | 0 | } |
1632 | | |
1633 | | size_t Magick::Image::totalColors(void) const |
1634 | 0 | { |
1635 | 0 | size_t |
1636 | 0 | colors; |
1637 | |
|
1638 | 0 | GetPPException; |
1639 | 0 | colors=GetNumberColors(constImage(),(FILE *) NULL,exceptionInfo); |
1640 | 0 | ThrowImageException; |
1641 | 0 | return colors; |
1642 | 0 | } |
1643 | | |
1644 | | void Magick::Image::transformRotation(const double angle_) |
1645 | 0 | { |
1646 | 0 | modifyImage(); |
1647 | 0 | options()->transformRotation(angle_); |
1648 | 0 | } |
1649 | | |
1650 | | void Magick::Image::transformSkewX(const double skewx_) |
1651 | 0 | { |
1652 | 0 | modifyImage(); |
1653 | 0 | options()->transformSkewX(skewx_); |
1654 | 0 | } |
1655 | | |
1656 | | void Magick::Image::transformSkewY(const double skewy_) |
1657 | 0 | { |
1658 | 0 | modifyImage(); |
1659 | 0 | options()->transformSkewY(skewy_); |
1660 | 0 | } |
1661 | | |
1662 | | Magick::ImageType Magick::Image::type(void) const |
1663 | 0 | { |
1664 | 0 | if (constOptions()->type() != UndefinedType) |
1665 | 0 | return(constOptions()->type()); |
1666 | 0 | return(GetImageType(constImage())); |
1667 | 0 | } |
1668 | | |
1669 | | void Magick::Image::type(const Magick::ImageType type_) |
1670 | 0 | { |
1671 | 0 | modifyImage(); |
1672 | 0 | options()->type(type_); |
1673 | 0 | GetPPException; |
1674 | 0 | SetImageType(image(),type_,exceptionInfo); |
1675 | 0 | ThrowImageException; |
1676 | 0 | } |
1677 | | |
1678 | | void Magick::Image::verbose(const bool verboseFlag_) |
1679 | 0 | { |
1680 | 0 | modifyImage(); |
1681 | 0 | options()->verbose(verboseFlag_); |
1682 | 0 | } |
1683 | | |
1684 | | bool Magick::Image::verbose(void) const |
1685 | 0 | { |
1686 | 0 | return(constOptions()->verbose()); |
1687 | 0 | } |
1688 | | |
1689 | | void Magick::Image::virtualPixelMethod( |
1690 | | const VirtualPixelMethod virtualPixelMethod_) |
1691 | 0 | { |
1692 | 0 | modifyImage(); |
1693 | 0 | GetPPException; |
1694 | 0 | SetImageVirtualPixelMethod(image(),virtualPixelMethod_,exceptionInfo); |
1695 | 0 | ThrowImageException; |
1696 | 0 | } |
1697 | | |
1698 | | Magick::VirtualPixelMethod Magick::Image::virtualPixelMethod(void) const |
1699 | 0 | { |
1700 | 0 | return(GetImageVirtualPixelMethod(constImage())); |
1701 | 0 | } |
1702 | | |
1703 | | void Magick::Image::x11Display(const std::string &display_) |
1704 | 0 | { |
1705 | 0 | modifyImage(); |
1706 | 0 | options()->x11Display(display_); |
1707 | 0 | } |
1708 | | |
1709 | | std::string Magick::Image::x11Display(void) const |
1710 | 0 | { |
1711 | 0 | return(constOptions()->x11Display()); |
1712 | 0 | } |
1713 | | |
1714 | | double Magick::Image::xResolution(void) const |
1715 | 0 | { |
1716 | 0 | return(constImage()->resolution.x); |
1717 | 0 | } |
1718 | | |
1719 | | double Magick::Image::yResolution(void) const |
1720 | 0 | { |
1721 | 0 | return(constImage()->resolution.y); |
1722 | 0 | } |
1723 | | |
1724 | | void Magick::Image::adaptiveBlur(const double radius_,const double sigma_) |
1725 | 0 | { |
1726 | 0 | MagickCore::Image |
1727 | 0 | *newImage; |
1728 | |
|
1729 | 0 | GetPPException; |
1730 | 0 | newImage=AdaptiveBlurImage(constImage(),radius_,sigma_,exceptionInfo); |
1731 | 0 | replaceImage(newImage); |
1732 | 0 | ThrowImageException; |
1733 | 0 | } |
1734 | | |
1735 | | void Magick::Image::adaptiveResize(const Geometry &geometry_) |
1736 | 0 | { |
1737 | 0 | MagickCore::Image |
1738 | 0 | *newImage; |
1739 | |
|
1740 | 0 | size_t |
1741 | 0 | height=rows(), |
1742 | 0 | width=columns(); |
1743 | |
|
1744 | 0 | ssize_t |
1745 | 0 | x=0, |
1746 | 0 | y=0; |
1747 | |
|
1748 | 0 | ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width, |
1749 | 0 | &height); |
1750 | |
|
1751 | 0 | GetPPException; |
1752 | 0 | newImage=AdaptiveResizeImage(constImage(),width,height,exceptionInfo); |
1753 | 0 | replaceImage(newImage); |
1754 | 0 | ThrowImageException; |
1755 | 0 | } |
1756 | | |
1757 | | void Magick::Image::adaptiveSharpen(const double radius_,const double sigma_) |
1758 | 0 | { |
1759 | 0 | MagickCore::Image |
1760 | 0 | *newImage; |
1761 | |
|
1762 | 0 | GetPPException; |
1763 | 0 | newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo); |
1764 | 0 | replaceImage(newImage); |
1765 | 0 | ThrowImageException; |
1766 | 0 | } |
1767 | | |
1768 | | void Magick::Image::adaptiveSharpenChannel(const ChannelType channel_, |
1769 | | const double radius_,const double sigma_ ) |
1770 | 0 | { |
1771 | 0 | MagickCore::Image |
1772 | 0 | *newImage; |
1773 | |
|
1774 | 0 | GetPPException; |
1775 | 0 | GetAndSetPPChannelMask(channel_); |
1776 | 0 | newImage=AdaptiveSharpenImage(constImage(),radius_,sigma_,exceptionInfo); |
1777 | 0 | RestorePPChannelMask; |
1778 | 0 | replaceImage(newImage); |
1779 | 0 | ThrowImageException; |
1780 | 0 | } |
1781 | | |
1782 | | void Magick::Image::adaptiveThreshold(const size_t width_,const size_t height_, |
1783 | | const double bias_) |
1784 | 0 | { |
1785 | |
|
1786 | 0 | MagickCore::Image |
1787 | 0 | *newImage; |
1788 | |
|
1789 | 0 | GetPPException; |
1790 | 0 | newImage=AdaptiveThresholdImage(constImage(),width_,height_,bias_, |
1791 | 0 | exceptionInfo); |
1792 | 0 | replaceImage(newImage); |
1793 | 0 | ThrowImageException; |
1794 | 0 | } |
1795 | | |
1796 | | void Magick::Image::addNoise(const NoiseType noiseType_,const double attenuate_) |
1797 | 0 | { |
1798 | 0 | MagickCore::Image |
1799 | 0 | *newImage; |
1800 | |
|
1801 | 0 | GetPPException; |
1802 | 0 | newImage=AddNoiseImage(constImage(),noiseType_,attenuate_,exceptionInfo); |
1803 | 0 | replaceImage(newImage); |
1804 | 0 | ThrowImageException; |
1805 | 0 | } |
1806 | | |
1807 | | void Magick::Image::addNoiseChannel(const ChannelType channel_, |
1808 | | const NoiseType noiseType_,const double attenuate_) |
1809 | 0 | { |
1810 | 0 | MagickCore::Image |
1811 | 0 | *newImage; |
1812 | |
|
1813 | 0 | GetPPException; |
1814 | 0 | GetAndSetPPChannelMask(channel_); |
1815 | 0 | newImage=AddNoiseImage(constImage(),noiseType_,attenuate_,exceptionInfo); |
1816 | 0 | RestorePPChannelMask; |
1817 | 0 | replaceImage(newImage); |
1818 | 0 | ThrowImageException; |
1819 | 0 | } |
1820 | | |
1821 | | void Magick::Image::affineTransform(const DrawableAffine &affine_) |
1822 | 0 | { |
1823 | 0 | AffineMatrix |
1824 | 0 | _affine; |
1825 | |
|
1826 | 0 | MagickCore::Image |
1827 | 0 | *newImage; |
1828 | |
|
1829 | 0 | _affine.sx=affine_.sx(); |
1830 | 0 | _affine.sy=affine_.sy(); |
1831 | 0 | _affine.rx=affine_.rx(); |
1832 | 0 | _affine.ry=affine_.ry(); |
1833 | 0 | _affine.tx=affine_.tx(); |
1834 | 0 | _affine.ty=affine_.ty(); |
1835 | |
|
1836 | 0 | GetPPException; |
1837 | 0 | newImage=AffineTransformImage(constImage(),&_affine,exceptionInfo); |
1838 | 0 | replaceImage(newImage); |
1839 | 0 | ThrowImageException; |
1840 | 0 | } |
1841 | | |
1842 | | void Magick::Image::alpha(const unsigned int alpha_) |
1843 | 0 | { |
1844 | 0 | modifyImage(); |
1845 | 0 | GetPPException; |
1846 | 0 | SetImageAlpha(image(),(Quantum) alpha_,exceptionInfo); |
1847 | 0 | ThrowImageException; |
1848 | 0 | } |
1849 | | |
1850 | | void Magick::Image::alphaChannel(AlphaChannelOption alphaOption_) |
1851 | 0 | { |
1852 | 0 | modifyImage(); |
1853 | 0 | GetPPException; |
1854 | 0 | SetImageAlphaChannel(image(),alphaOption_,exceptionInfo); |
1855 | 0 | ThrowImageException; |
1856 | 0 | } |
1857 | | |
1858 | | void Magick::Image::annotate(const std::string &text_, |
1859 | | const Geometry &location_) |
1860 | 0 | { |
1861 | 0 | annotate(text_,location_,NorthWestGravity,0.0); |
1862 | 0 | } |
1863 | | |
1864 | | void Magick::Image::annotate(const std::string &text_, |
1865 | | const Geometry &boundingArea_,const GravityType gravity_) |
1866 | 0 | { |
1867 | 0 | annotate(text_,boundingArea_,gravity_,0.0); |
1868 | 0 | } |
1869 | | |
1870 | | void Magick::Image::annotate(const std::string &text_, |
1871 | | const Geometry &boundingArea_,const GravityType gravity_, |
1872 | | const double degrees_) |
1873 | 0 | { |
1874 | 0 | AffineMatrix |
1875 | 0 | oaffine; |
1876 | |
|
1877 | 0 | char |
1878 | 0 | boundingArea[MagickPathExtent]; |
1879 | |
|
1880 | 0 | DrawInfo |
1881 | 0 | *drawInfo; |
1882 | |
|
1883 | 0 | modifyImage(); |
1884 | |
|
1885 | 0 | drawInfo=options()->drawInfo(); |
1886 | 0 | drawInfo->text=DestroyString(drawInfo->text); |
1887 | 0 | drawInfo->text=const_cast<char *>(text_.c_str()); |
1888 | 0 | drawInfo->geometry=DestroyString(drawInfo->geometry); |
1889 | |
|
1890 | 0 | if (boundingArea_.isValid()) |
1891 | 0 | { |
1892 | 0 | if (boundingArea_.width() == 0 || boundingArea_.height() == 0) |
1893 | 0 | { |
1894 | 0 | FormatLocaleString(boundingArea,MagickPathExtent,"%+.20g%+.20g", |
1895 | 0 | (double) boundingArea_.xOff(),(double) boundingArea_.yOff()); |
1896 | 0 | } |
1897 | 0 | else |
1898 | 0 | { |
1899 | 0 | (void) CopyMagickString(boundingArea, |
1900 | 0 | std::string(boundingArea_).c_str(), MagickPathExtent); |
1901 | 0 | } |
1902 | 0 | drawInfo->geometry=boundingArea; |
1903 | 0 | } |
1904 | |
|
1905 | 0 | drawInfo->gravity=gravity_; |
1906 | |
|
1907 | 0 | oaffine=drawInfo->affine; |
1908 | 0 | if (degrees_ != 0.0) |
1909 | 0 | { |
1910 | 0 | AffineMatrix |
1911 | 0 | affine, |
1912 | 0 | current; |
1913 | |
|
1914 | 0 | affine.sx=1.0; |
1915 | 0 | affine.rx=0.0; |
1916 | 0 | affine.ry=0.0; |
1917 | 0 | affine.sy=1.0; |
1918 | 0 | affine.tx=0.0; |
1919 | 0 | affine.ty=0.0; |
1920 | |
|
1921 | 0 | current=drawInfo->affine; |
1922 | 0 | affine.sx=cos(DegreesToRadians(fmod(degrees_,360.0))); |
1923 | 0 | affine.rx=sin(DegreesToRadians(fmod(degrees_,360.0))); |
1924 | 0 | affine.ry=(-sin(DegreesToRadians(fmod(degrees_,360.0)))); |
1925 | 0 | affine.sy=cos(DegreesToRadians(fmod(degrees_,360.0))); |
1926 | |
|
1927 | 0 | drawInfo->affine.sx=current.sx*affine.sx+current.ry*affine.rx; |
1928 | 0 | drawInfo->affine.rx=current.rx*affine.sx+current.sy*affine.rx; |
1929 | 0 | drawInfo->affine.ry=current.sx*affine.ry+current.ry*affine.sy; |
1930 | 0 | drawInfo->affine.sy=current.rx*affine.ry+current.sy*affine.sy; |
1931 | 0 | drawInfo->affine.tx=current.sx*affine.tx+current.ry*affine.ty |
1932 | 0 | +current.tx; |
1933 | 0 | } |
1934 | |
|
1935 | 0 | GetPPException; |
1936 | 0 | AnnotateImage(image(),drawInfo,exceptionInfo); |
1937 | | |
1938 | | // Restore original values |
1939 | 0 | drawInfo->affine=oaffine; |
1940 | 0 | drawInfo->text=(char *) NULL; |
1941 | 0 | drawInfo->geometry=(char *) NULL; |
1942 | |
|
1943 | 0 | ThrowImageException; |
1944 | 0 | } |
1945 | | |
1946 | | void Magick::Image::annotate(const std::string &text_, |
1947 | | const GravityType gravity_) |
1948 | 0 | { |
1949 | 0 | DrawInfo |
1950 | 0 | *drawInfo; |
1951 | |
|
1952 | 0 | modifyImage(); |
1953 | |
|
1954 | 0 | drawInfo=options()->drawInfo(); |
1955 | 0 | drawInfo->text=DestroyString(drawInfo->text); |
1956 | 0 | drawInfo->text=const_cast<char *>(text_.c_str()); |
1957 | 0 | drawInfo->gravity=gravity_; |
1958 | |
|
1959 | 0 | GetPPException; |
1960 | 0 | AnnotateImage(image(),drawInfo,exceptionInfo); |
1961 | |
|
1962 | 0 | drawInfo->gravity=NorthWestGravity; |
1963 | 0 | drawInfo->text=(char *) NULL; |
1964 | |
|
1965 | 0 | ThrowImageException; |
1966 | 0 | } |
1967 | | |
1968 | | void Magick::Image::artifact(const std::string &name_,const std::string &value_) |
1969 | 0 | { |
1970 | 0 | modifyImage(); |
1971 | 0 | (void) SetImageArtifact(image(),name_.c_str(),value_.c_str()); |
1972 | 0 | } |
1973 | | |
1974 | | std::string Magick::Image::artifact(const std::string &name_) const |
1975 | 0 | { |
1976 | 0 | const char |
1977 | 0 | *value; |
1978 | |
|
1979 | 0 | value=GetImageArtifact(constImage(),name_.c_str()); |
1980 | 0 | if (value) |
1981 | 0 | return(std::string(value)); |
1982 | 0 | return(std::string()); |
1983 | 0 | } |
1984 | | |
1985 | | void Magick::Image::attribute(const std::string name_,const char *value_) |
1986 | 0 | { |
1987 | 0 | modifyImage(); |
1988 | 0 | GetPPException; |
1989 | 0 | SetImageProperty(image(),name_.c_str(),value_,exceptionInfo); |
1990 | 0 | ThrowImageException; |
1991 | 0 | } |
1992 | | |
1993 | | void Magick::Image::attribute(const std::string name_,const std::string value_) |
1994 | 0 | { |
1995 | 0 | modifyImage(); |
1996 | 0 | GetPPException; |
1997 | 0 | SetImageProperty(image(),name_.c_str(),value_.c_str(),exceptionInfo); |
1998 | 0 | ThrowImageException; |
1999 | 0 | } |
2000 | | |
2001 | | std::string Magick::Image::attribute(const std::string name_) const |
2002 | 0 | { |
2003 | 0 | const char |
2004 | 0 | *value; |
2005 | |
|
2006 | 0 | GetPPException; |
2007 | 0 | value=GetImageProperty(constImage(),name_.c_str(),exceptionInfo); |
2008 | 0 | ThrowImageException; |
2009 | |
|
2010 | 0 | if (value) |
2011 | 0 | return(std::string(value)); |
2012 | | |
2013 | 0 | return(std::string()); // Intentionally no exception |
2014 | 0 | } |
2015 | | |
2016 | | void Magick::Image::autoGamma(void) |
2017 | 0 | { |
2018 | 0 | modifyImage(); |
2019 | 0 | GetPPException; |
2020 | 0 | (void) SyncImageSettings(imageInfo(),image(),exceptionInfo); |
2021 | 0 | (void) AutoGammaImage(image(),exceptionInfo); |
2022 | 0 | ThrowImageException; |
2023 | 0 | } |
2024 | | |
2025 | | void Magick::Image::autoGammaChannel(const ChannelType channel_) |
2026 | 0 | { |
2027 | 0 | modifyImage(); |
2028 | 0 | GetPPException; |
2029 | 0 | GetAndSetPPChannelMask(channel_); |
2030 | 0 | (void) SyncImageSettings(imageInfo(),image(),exceptionInfo); |
2031 | 0 | (void) AutoGammaImage(image(),exceptionInfo); |
2032 | 0 | RestorePPChannelMask; |
2033 | 0 | ThrowImageException; |
2034 | 0 | } |
2035 | | |
2036 | | void Magick::Image::autoLevel(void) |
2037 | 0 | { |
2038 | 0 | modifyImage(); |
2039 | 0 | GetPPException; |
2040 | 0 | (void) AutoLevelImage(image(),exceptionInfo); |
2041 | 0 | ThrowImageException; |
2042 | 0 | } |
2043 | | |
2044 | | void Magick::Image::autoLevelChannel(const ChannelType channel_) |
2045 | 0 | { |
2046 | 0 | modifyImage(); |
2047 | 0 | GetPPException; |
2048 | 0 | GetAndSetPPChannelMask(channel_); |
2049 | 0 | (void) AutoLevelImage(image(),exceptionInfo); |
2050 | 0 | RestorePPChannelMask; |
2051 | 0 | ThrowImageException; |
2052 | 0 | } |
2053 | | |
2054 | | void Magick::Image::autoOrient(void) |
2055 | 0 | { |
2056 | 0 | MagickCore::Image |
2057 | 0 | *newImage; |
2058 | |
|
2059 | 0 | if (image()->orientation == UndefinedOrientation || |
2060 | 0 | image()->orientation == TopLeftOrientation) |
2061 | 0 | return; |
2062 | | |
2063 | 0 | GetPPException; |
2064 | 0 | newImage=AutoOrientImage(constImage(),image()->orientation,exceptionInfo); |
2065 | 0 | replaceImage(newImage); |
2066 | 0 | ThrowImageException; |
2067 | 0 | } |
2068 | | |
2069 | | void Magick::Image::autoThreshold(const AutoThresholdMethod method_) |
2070 | 0 | { |
2071 | 0 | modifyImage(); |
2072 | 0 | GetPPException; |
2073 | 0 | AutoThresholdImage(image(),method_, exceptionInfo); |
2074 | 0 | ThrowImageException; |
2075 | 0 | } |
2076 | | |
2077 | | void Magick::Image::blackThreshold(const std::string &threshold_) |
2078 | 0 | { |
2079 | 0 | modifyImage(); |
2080 | 0 | GetPPException; |
2081 | 0 | BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo); |
2082 | 0 | ThrowImageException; |
2083 | 0 | } |
2084 | | |
2085 | | void Magick::Image::blackThresholdChannel(const ChannelType channel_, |
2086 | | const std::string &threshold_) |
2087 | 0 | { |
2088 | 0 | modifyImage(); |
2089 | 0 | GetPPException; |
2090 | 0 | GetAndSetPPChannelMask(channel_); |
2091 | 0 | BlackThresholdImage(image(),threshold_.c_str(),exceptionInfo); |
2092 | 0 | RestorePPChannelMask; |
2093 | 0 | ThrowImageException; |
2094 | 0 | } |
2095 | | |
2096 | | void Magick::Image::blueShift(const double factor_) |
2097 | 0 | { |
2098 | 0 | MagickCore::Image |
2099 | 0 | *newImage; |
2100 | |
|
2101 | 0 | GetPPException; |
2102 | 0 | newImage=BlueShiftImage(constImage(),factor_,exceptionInfo); |
2103 | 0 | replaceImage(newImage); |
2104 | 0 | ThrowImageException; |
2105 | 0 | } |
2106 | | |
2107 | | void Magick::Image::blur(const double radius_,const double sigma_) |
2108 | 0 | { |
2109 | 0 | MagickCore::Image |
2110 | 0 | *newImage; |
2111 | |
|
2112 | 0 | GetPPException; |
2113 | 0 | newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo); |
2114 | 0 | replaceImage(newImage); |
2115 | 0 | ThrowImageException; |
2116 | 0 | } |
2117 | | |
2118 | | void Magick::Image::blurChannel(const ChannelType channel_, |
2119 | | const double radius_,const double sigma_) |
2120 | 0 | { |
2121 | 0 | MagickCore::Image |
2122 | 0 | *newImage; |
2123 | |
|
2124 | 0 | GetPPException; |
2125 | 0 | GetAndSetPPChannelMask(channel_); |
2126 | 0 | newImage=BlurImage(constImage(),radius_,sigma_,exceptionInfo); |
2127 | 0 | RestorePPChannelMask; |
2128 | 0 | replaceImage(newImage); |
2129 | 0 | ThrowImageException; |
2130 | 0 | } |
2131 | | |
2132 | | void Magick::Image::border(const Geometry &geometry_) |
2133 | 0 | { |
2134 | 0 | MagickCore::Image |
2135 | 0 | *newImage; |
2136 | |
|
2137 | 0 | RectangleInfo |
2138 | 0 | borderInfo=geometry_; |
2139 | |
|
2140 | 0 | GetPPException; |
2141 | 0 | newImage=BorderImage(constImage(),&borderInfo,image()->compose, |
2142 | 0 | exceptionInfo); |
2143 | 0 | replaceImage(newImage); |
2144 | 0 | ThrowImageException; |
2145 | 0 | } |
2146 | | |
2147 | | void Magick::Image::brightnessContrast(const double brightness_, |
2148 | | const double contrast_) |
2149 | 0 | { |
2150 | 0 | modifyImage(); |
2151 | 0 | GetPPException; |
2152 | 0 | BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo); |
2153 | 0 | ThrowImageException; |
2154 | 0 | } |
2155 | | |
2156 | | void Magick::Image::brightnessContrastChannel(const ChannelType channel_, |
2157 | | const double brightness_,const double contrast_) |
2158 | 0 | { |
2159 | 0 | modifyImage(); |
2160 | 0 | GetPPException; |
2161 | 0 | GetAndSetPPChannelMask(channel_); |
2162 | 0 | BrightnessContrastImage(image(),brightness_,contrast_,exceptionInfo); |
2163 | 0 | RestorePPChannelMask; |
2164 | 0 | ThrowImageException; |
2165 | 0 | } |
2166 | | |
2167 | | void Magick::Image::cannyEdge(const double radius_,const double sigma_, |
2168 | | const double lowerPercent_,const double upperPercent_) |
2169 | 0 | { |
2170 | 0 | MagickCore::Image |
2171 | 0 | *newImage; |
2172 | |
|
2173 | 0 | modifyImage(); |
2174 | 0 | GetPPException; |
2175 | 0 | newImage=CannyEdgeImage(constImage(),radius_,sigma_,lowerPercent_, |
2176 | 0 | upperPercent_,exceptionInfo); |
2177 | 0 | replaceImage(newImage); |
2178 | 0 | ThrowImageException; |
2179 | 0 | } |
2180 | | |
2181 | | void Magick::Image::cdl(const std::string &cdl_) |
2182 | 0 | { |
2183 | 0 | modifyImage(); |
2184 | 0 | GetPPException; |
2185 | 0 | (void) ColorDecisionListImage(image(),cdl_.c_str(),exceptionInfo); |
2186 | 0 | ThrowImageException; |
2187 | 0 | } |
2188 | | |
2189 | | void Magick::Image::channel(const ChannelType channel_) |
2190 | 0 | { |
2191 | 0 | MagickCore::Image |
2192 | 0 | *newImage; |
2193 | |
|
2194 | 0 | GetPPException; |
2195 | 0 | newImage=SeparateImage(constImage(),channel_,exceptionInfo); |
2196 | 0 | replaceImage(newImage); |
2197 | 0 | ThrowImageException; |
2198 | 0 | } |
2199 | | |
2200 | | void Magick::Image::charcoal(const double radius_,const double sigma_) |
2201 | 0 | { |
2202 | 0 | MagickCore::Image |
2203 | 0 | *newImage; |
2204 | |
|
2205 | 0 | GetPPException; |
2206 | 0 | newImage=CharcoalImage(image(),radius_,sigma_,exceptionInfo); |
2207 | 0 | replaceImage(newImage); |
2208 | 0 | ThrowImageException; |
2209 | 0 | } |
2210 | | |
2211 | | void Magick::Image::charcoalChannel(const ChannelType channel_, |
2212 | | const double radius_,const double sigma_) |
2213 | 0 | { |
2214 | 0 | MagickCore::Image |
2215 | 0 | *newImage; |
2216 | |
|
2217 | 0 | GetPPException; |
2218 | 0 | GetAndSetPPChannelMask(channel_); |
2219 | 0 | newImage=CharcoalImage(image(),radius_,sigma_,exceptionInfo); |
2220 | 0 | RestorePPChannelMask; |
2221 | 0 | replaceImage(newImage); |
2222 | 0 | ThrowImageException; |
2223 | 0 | } |
2224 | | |
2225 | | void Magick::Image::chop(const Geometry &geometry_) |
2226 | 0 | { |
2227 | 0 | MagickCore::Image |
2228 | 0 | *newImage; |
2229 | |
|
2230 | 0 | RectangleInfo |
2231 | 0 | chopInfo=geometry_; |
2232 | |
|
2233 | 0 | GetPPException; |
2234 | 0 | newImage=ChopImage(image(),&chopInfo,exceptionInfo); |
2235 | 0 | replaceImage(newImage); |
2236 | 0 | ThrowImageException; |
2237 | 0 | } |
2238 | | |
2239 | | void Magick::Image::chromaBluePrimary(const double x_,const double y_, |
2240 | | const double z_) |
2241 | 0 | { |
2242 | 0 | modifyImage(); |
2243 | 0 | image()->chromaticity.blue_primary.x=x_; |
2244 | 0 | image()->chromaticity.blue_primary.y=y_; |
2245 | 0 | image()->chromaticity.blue_primary.z=z_; |
2246 | 0 | } |
2247 | | |
2248 | | void Magick::Image::chromaBluePrimary(double *x_,double *y_,double *z_) const |
2249 | 0 | { |
2250 | 0 | *x_=constImage()->chromaticity.blue_primary.x; |
2251 | 0 | *y_=constImage()->chromaticity.blue_primary.y; |
2252 | 0 | *z_=constImage()->chromaticity.blue_primary.z; |
2253 | 0 | } |
2254 | | |
2255 | | void Magick::Image::chromaGreenPrimary(const double x_,const double y_, |
2256 | | const double z_) |
2257 | 0 | { |
2258 | 0 | modifyImage(); |
2259 | 0 | image()->chromaticity.green_primary.x=x_; |
2260 | 0 | image()->chromaticity.green_primary.y=y_; |
2261 | 0 | image()->chromaticity.green_primary.z=z_; |
2262 | 0 | } |
2263 | | |
2264 | | void Magick::Image::chromaGreenPrimary(double *x_,double *y_,double *z_) const |
2265 | 0 | { |
2266 | 0 | *x_=constImage()->chromaticity.green_primary.x; |
2267 | 0 | *y_=constImage()->chromaticity.green_primary.y; |
2268 | 0 | *z_=constImage()->chromaticity.green_primary.z; |
2269 | 0 | } |
2270 | | |
2271 | | void Magick::Image::chromaRedPrimary(const double x_,const double y_, |
2272 | | const double z_) |
2273 | 0 | { |
2274 | 0 | modifyImage(); |
2275 | 0 | image()->chromaticity.red_primary.x=x_; |
2276 | 0 | image()->chromaticity.red_primary.y=y_; |
2277 | 0 | image()->chromaticity.red_primary.z=z_; |
2278 | 0 | } |
2279 | | |
2280 | | void Magick::Image::chromaRedPrimary(double *x_,double *y_,double *z_) const |
2281 | 0 | { |
2282 | 0 | *x_=constImage()->chromaticity.red_primary.x; |
2283 | 0 | *y_=constImage()->chromaticity.red_primary.y; |
2284 | 0 | *z_=constImage()->chromaticity.red_primary.z; |
2285 | 0 | } |
2286 | | |
2287 | | void Magick::Image::chromaWhitePoint(const double x_,const double y_, |
2288 | | const double z_) |
2289 | 0 | { |
2290 | 0 | modifyImage(); |
2291 | 0 | image()->chromaticity.white_point.x=x_; |
2292 | 0 | image()->chromaticity.white_point.y=y_; |
2293 | 0 | image()->chromaticity.white_point.z=z_; |
2294 | 0 | } |
2295 | | |
2296 | | void Magick::Image::chromaWhitePoint(double *x_,double *y_,double *z_) const |
2297 | 0 | { |
2298 | 0 | *x_=constImage()->chromaticity.white_point.x; |
2299 | 0 | *y_=constImage()->chromaticity.white_point.y; |
2300 | 0 | *z_=constImage()->chromaticity.white_point.z; |
2301 | 0 | } |
2302 | | |
2303 | | void Magick::Image::clamp(void) |
2304 | 0 | { |
2305 | 0 | modifyImage(); |
2306 | 0 | GetPPException; |
2307 | 0 | ClampImage(image(),exceptionInfo); |
2308 | 0 | ThrowImageException; |
2309 | 0 | } |
2310 | | |
2311 | | void Magick::Image::clampChannel(const ChannelType channel_) |
2312 | 0 | { |
2313 | 0 | modifyImage(); |
2314 | 0 | GetPPException; |
2315 | 0 | GetAndSetPPChannelMask(channel_); |
2316 | 0 | ClampImage(image(),exceptionInfo); |
2317 | 0 | RestorePPChannelMask; |
2318 | 0 | ThrowImageException; |
2319 | 0 | } |
2320 | | |
2321 | | void Magick::Image::clip(void) |
2322 | 0 | { |
2323 | 0 | modifyImage(); |
2324 | 0 | GetPPException; |
2325 | 0 | ClipImage(image(),exceptionInfo); |
2326 | 0 | ThrowImageException; |
2327 | 0 | } |
2328 | | |
2329 | | void Magick::Image::clipPath(const std::string pathname_,const bool inside_) |
2330 | 0 | { |
2331 | 0 | modifyImage(); |
2332 | 0 | GetPPException; |
2333 | 0 | ClipImagePath(image(),pathname_.c_str(),(MagickBooleanType) inside_, |
2334 | 0 | exceptionInfo); |
2335 | 0 | ThrowImageException; |
2336 | 0 | } |
2337 | | |
2338 | | void Magick::Image::clut(const Image &clutImage_, |
2339 | | const PixelInterpolateMethod method) |
2340 | 0 | { |
2341 | 0 | modifyImage(); |
2342 | 0 | GetPPException; |
2343 | 0 | ClutImage(image(),clutImage_.constImage(),method,exceptionInfo); |
2344 | 0 | ThrowImageException; |
2345 | 0 | } |
2346 | | |
2347 | | void Magick::Image::clutChannel(const ChannelType channel_, |
2348 | | const Image &clutImage_,const PixelInterpolateMethod method) |
2349 | 0 | { |
2350 | 0 | modifyImage(); |
2351 | 0 | GetPPException; |
2352 | 0 | GetAndSetPPChannelMask(channel_); |
2353 | 0 | ClutImage(image(),clutImage_.constImage(),method,exceptionInfo); |
2354 | 0 | RestorePPChannelMask; |
2355 | 0 | ThrowImageException; |
2356 | 0 | } |
2357 | | |
2358 | | void Magick::Image::colorize(const unsigned int alpha_,const Color &penColor_) |
2359 | 0 | { |
2360 | 0 | colorize(alpha_,alpha_,alpha_,penColor_); |
2361 | 0 | } |
2362 | | |
2363 | | void Magick::Image::colorize(const unsigned int alphaRed_, |
2364 | | const unsigned int alphaGreen_,const unsigned int alphaBlue_, |
2365 | | const Color &penColor_) |
2366 | 0 | { |
2367 | 0 | char |
2368 | 0 | blend[MagickPathExtent]; |
2369 | |
|
2370 | 0 | MagickCore::Image |
2371 | 0 | *newImage; |
2372 | |
|
2373 | 0 | PixelInfo |
2374 | 0 | target; |
2375 | |
|
2376 | 0 | if (!penColor_.isValid()) |
2377 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
2378 | 0 | "Pen color argument is invalid"); |
2379 | |
|
2380 | 0 | FormatLocaleString(blend,MagickPathExtent,"%u/%u/%u",alphaRed_,alphaGreen_, |
2381 | 0 | alphaBlue_); |
2382 | |
|
2383 | 0 | target=static_cast<PixelInfo>(penColor_); |
2384 | 0 | GetPPException; |
2385 | 0 | newImage=ColorizeImage(image(),blend,&target,exceptionInfo); |
2386 | 0 | replaceImage(newImage); |
2387 | 0 | ThrowImageException; |
2388 | 0 | } |
2389 | | |
2390 | | void Magick::Image::colorMap(const size_t index_,const Color &color_) |
2391 | 0 | { |
2392 | 0 | MagickCore::Image |
2393 | 0 | *imageptr; |
2394 | |
|
2395 | 0 | imageptr=image(); |
2396 | |
|
2397 | 0 | if (index_ > (MaxColormapSize-1)) |
2398 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
2399 | 0 | "Colormap index must be less than MaxColormapSize"); |
2400 | |
|
2401 | 0 | if (!color_.isValid()) |
2402 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
2403 | 0 | "Color argument is invalid"); |
2404 | |
|
2405 | 0 | modifyImage(); |
2406 | | |
2407 | | // Ensure that colormap size is large enough |
2408 | 0 | if (colorMapSize() < (index_+1)) |
2409 | 0 | colorMapSize(index_+1); |
2410 | | |
2411 | | // Set color at index in colormap |
2412 | 0 | (imageptr->colormap)[index_]=color_; |
2413 | 0 | } |
2414 | | |
2415 | | Magick::Color Magick::Image::colorMap(const size_t index_) const |
2416 | 0 | { |
2417 | 0 | if (!constImage()->colormap) |
2418 | 0 | { |
2419 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
2420 | 0 | "Image does not contain a colormap"); |
2421 | 0 | return(Color()); |
2422 | 0 | } |
2423 | | |
2424 | 0 | if (index_ > constImage()->colors-1) |
2425 | 0 | throwExceptionExplicit(MagickCore::OptionError,"Index out of range"); |
2426 | |
|
2427 | 0 | return(Magick::Color((constImage()->colormap)[index_])); |
2428 | 0 | } |
2429 | | |
2430 | | void Magick::Image::colorMatrix(const size_t order_, |
2431 | | const double *color_matrix_) |
2432 | 0 | { |
2433 | 0 | KernelInfo |
2434 | 0 | *kernel_info; |
2435 | |
|
2436 | 0 | GetPPException; |
2437 | 0 | kernel_info=AcquireKernelInfo((const char *) NULL,exceptionInfo); |
2438 | 0 | if (kernel_info != (KernelInfo *) NULL) |
2439 | 0 | { |
2440 | 0 | kernel_info->width=order_; |
2441 | 0 | kernel_info->height=order_; |
2442 | 0 | kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_, |
2443 | 0 | order_*sizeof(*kernel_info->values)); |
2444 | 0 | if (kernel_info->values != (MagickRealType *) NULL) |
2445 | 0 | { |
2446 | 0 | MagickCore::Image |
2447 | 0 | *newImage; |
2448 | |
|
2449 | 0 | for (ssize_t i=0; i < (ssize_t) (order_*order_); i++) |
2450 | 0 | kernel_info->values[i]=color_matrix_[i]; |
2451 | 0 | newImage=ColorMatrixImage(image(),kernel_info,exceptionInfo); |
2452 | 0 | replaceImage(newImage); |
2453 | 0 | } |
2454 | 0 | kernel_info=DestroyKernelInfo(kernel_info); |
2455 | 0 | } |
2456 | 0 | ThrowImageException; |
2457 | 0 | } |
2458 | | |
2459 | | bool Magick::Image::compare(const Image &reference_) const |
2460 | 0 | { |
2461 | 0 | bool |
2462 | 0 | status; |
2463 | |
|
2464 | 0 | Image |
2465 | 0 | ref=reference_; |
2466 | |
|
2467 | 0 | GetPPException; |
2468 | 0 | status=static_cast<bool>(IsImagesEqual(constImage(),ref.constImage(), |
2469 | 0 | exceptionInfo)); |
2470 | 0 | ThrowImageException; |
2471 | 0 | return(status); |
2472 | 0 | } |
2473 | | |
2474 | | double Magick::Image::compare(const Image &reference_,const MetricType metric_) |
2475 | 0 | { |
2476 | 0 | double |
2477 | 0 | distortion=0.0; |
2478 | |
|
2479 | 0 | GetPPException; |
2480 | 0 | GetImageDistortion(image(),reference_.constImage(),metric_,&distortion, |
2481 | 0 | exceptionInfo); |
2482 | 0 | ThrowImageException; |
2483 | 0 | return(distortion); |
2484 | 0 | } |
2485 | | |
2486 | | double Magick::Image::compareChannel(const ChannelType channel_, |
2487 | | const Image &reference_,const MetricType metric_) |
2488 | 0 | { |
2489 | 0 | double |
2490 | 0 | distortion=0.0; |
2491 | |
|
2492 | 0 | GetPPException; |
2493 | 0 | GetAndSetPPChannelMask(channel_); |
2494 | 0 | GetImageDistortion(image(),reference_.constImage(),metric_,&distortion, |
2495 | 0 | exceptionInfo); |
2496 | 0 | RestorePPChannelMask; |
2497 | 0 | ThrowImageException; |
2498 | 0 | return(distortion); |
2499 | 0 | } |
2500 | | |
2501 | | Magick::Image Magick::Image::compare(const Image &reference_, |
2502 | | const MetricType metric_,double *distortion) |
2503 | 0 | { |
2504 | 0 | MagickCore::Image |
2505 | 0 | *newImage; |
2506 | |
|
2507 | 0 | GetPPException; |
2508 | 0 | newImage=CompareImages(image(),reference_.constImage(),metric_,distortion, |
2509 | 0 | exceptionInfo); |
2510 | 0 | ThrowImageException; |
2511 | 0 | if (newImage == (MagickCore::Image *) NULL) |
2512 | 0 | return(Magick::Image()); |
2513 | 0 | else |
2514 | 0 | return(Magick::Image(newImage)); |
2515 | 0 | } |
2516 | | |
2517 | | Magick::Image Magick::Image::compareChannel(const ChannelType channel_, |
2518 | | const Image &reference_,const MetricType metric_,double *distortion) |
2519 | 0 | { |
2520 | 0 | MagickCore::Image |
2521 | 0 | *newImage; |
2522 | |
|
2523 | 0 | GetPPException; |
2524 | 0 | GetAndSetPPChannelMask(channel_); |
2525 | 0 | newImage=CompareImages(image(),reference_.constImage(),metric_,distortion, |
2526 | 0 | exceptionInfo); |
2527 | 0 | RestorePPChannelMask; |
2528 | 0 | ThrowImageException; |
2529 | 0 | if (newImage == (MagickCore::Image *) NULL) |
2530 | 0 | return(Magick::Image()); |
2531 | 0 | else |
2532 | 0 | return(Magick::Image(newImage)); |
2533 | 0 | } |
2534 | | |
2535 | | void Magick::Image::composite(const Image &compositeImage_, |
2536 | | const Geometry &offset_,const CompositeOperator compose_) |
2537 | 0 | { |
2538 | 0 | size_t |
2539 | 0 | height=rows(), |
2540 | 0 | width=columns(); |
2541 | |
|
2542 | 0 | ssize_t |
2543 | 0 | x=offset_.xOff(), |
2544 | 0 | y=offset_.yOff(); |
2545 | |
|
2546 | 0 | ParseMetaGeometry(static_cast<std::string>(offset_).c_str(),&x,&y,&width, |
2547 | 0 | &height); |
2548 | |
|
2549 | 0 | modifyImage(); |
2550 | 0 | GetPPException; |
2551 | 0 | CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue, |
2552 | 0 | x,y,exceptionInfo); |
2553 | 0 | ThrowImageException; |
2554 | 0 | } |
2555 | | |
2556 | | void Magick::Image::composite(const Image &compositeImage_, |
2557 | | const GravityType gravity_,const CompositeOperator compose_) |
2558 | 0 | { |
2559 | 0 | RectangleInfo |
2560 | 0 | geometry; |
2561 | |
|
2562 | 0 | modifyImage(); |
2563 | 0 | SetGeometry(compositeImage_.constImage(),&geometry); |
2564 | 0 | GravityAdjustGeometry(columns(),rows(),gravity_,&geometry); |
2565 | |
|
2566 | 0 | GetPPException; |
2567 | 0 | CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue, |
2568 | 0 | geometry.x,geometry.y,exceptionInfo); |
2569 | 0 | ThrowImageException; |
2570 | 0 | } |
2571 | | |
2572 | | void Magick::Image::composite(const Image &compositeImage_, |
2573 | | const ssize_t xOffset_,const ssize_t yOffset_, |
2574 | | const CompositeOperator compose_) |
2575 | 0 | { |
2576 | | // Image supplied as compositeImage is composited with current image and |
2577 | | // results in updating current image. |
2578 | 0 | modifyImage(); |
2579 | 0 | GetPPException; |
2580 | 0 | CompositeImage(image(),compositeImage_.constImage(),compose_,MagickTrue, |
2581 | 0 | xOffset_,yOffset_,exceptionInfo); |
2582 | 0 | ThrowImageException; |
2583 | 0 | } |
2584 | | |
2585 | | void Magick::Image::connectedComponents(const size_t connectivity_) |
2586 | 0 | { |
2587 | 0 | MagickCore::Image |
2588 | 0 | *newImage; |
2589 | |
|
2590 | 0 | GetPPException; |
2591 | 0 | newImage=ConnectedComponentsImage(constImage(),connectivity_, |
2592 | 0 | (CCObjectInfo **) NULL,exceptionInfo); |
2593 | 0 | replaceImage(newImage); |
2594 | 0 | ThrowImageException; |
2595 | 0 | } |
2596 | | |
2597 | | void Magick::Image::contrast(const bool sharpen_) |
2598 | 0 | { |
2599 | 0 | modifyImage(); |
2600 | 0 | GetPPException; |
2601 | 0 | ContrastImage(image(),(MagickBooleanType) sharpen_,exceptionInfo); |
2602 | 0 | ThrowImageException; |
2603 | 0 | } |
2604 | | |
2605 | | void Magick::Image::contrastStretch(const double blackPoint_, |
2606 | | const double whitePoint_) |
2607 | 0 | { |
2608 | 0 | modifyImage(); |
2609 | 0 | GetPPException; |
2610 | 0 | ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo); |
2611 | 0 | ThrowImageException; |
2612 | 0 | } |
2613 | | |
2614 | | void Magick::Image::contrastStretchChannel(const ChannelType channel_, |
2615 | | const double blackPoint_,const double whitePoint_) |
2616 | 0 | { |
2617 | 0 | modifyImage(); |
2618 | 0 | GetPPException; |
2619 | 0 | GetAndSetPPChannelMask(channel_); |
2620 | 0 | ContrastStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo); |
2621 | 0 | RestorePPChannelMask; |
2622 | 0 | ThrowImageException; |
2623 | 0 | } |
2624 | | |
2625 | | void Magick::Image::convolve(const size_t order_,const double *kernel_) |
2626 | 0 | { |
2627 | 0 | KernelInfo |
2628 | 0 | *kernel_info; |
2629 | |
|
2630 | 0 | GetPPException; |
2631 | 0 | kernel_info=AcquireKernelInfo((const char *) NULL,exceptionInfo); |
2632 | 0 | kernel_info->width=order_; |
2633 | 0 | kernel_info->height=order_; |
2634 | 0 | kernel_info->x=(ssize_t) (order_-1)/2; |
2635 | 0 | kernel_info->y=(ssize_t) (order_-1)/2; |
2636 | 0 | kernel_info->values=(MagickRealType *) AcquireAlignedMemory(order_, |
2637 | 0 | order_*sizeof(*kernel_info->values)); |
2638 | 0 | if (kernel_info->values != (MagickRealType *) NULL) |
2639 | 0 | { |
2640 | 0 | MagickCore::Image |
2641 | 0 | *newImage; |
2642 | |
|
2643 | 0 | for (ssize_t i=0; i < (ssize_t) (order_*order_); i++) |
2644 | 0 | kernel_info->values[i]=kernel_[i]; |
2645 | 0 | newImage=ConvolveImage(image(),kernel_info,exceptionInfo); |
2646 | 0 | replaceImage(newImage); |
2647 | 0 | } |
2648 | 0 | kernel_info=DestroyKernelInfo(kernel_info); |
2649 | 0 | ThrowImageException; |
2650 | 0 | } |
2651 | | |
2652 | | void Magick::Image::copyPixels(const Image &source_,const Geometry &geometry_, |
2653 | | const Offset &offset_) |
2654 | 0 | { |
2655 | 0 | const OffsetInfo |
2656 | 0 | offset=offset_; |
2657 | |
|
2658 | 0 | const RectangleInfo |
2659 | 0 | geometry=geometry_; |
2660 | |
|
2661 | 0 | GetPPException; |
2662 | 0 | (void) CopyImagePixels(image(),source_.constImage(),&geometry,&offset, |
2663 | 0 | exceptionInfo); |
2664 | 0 | ThrowImageException; |
2665 | 0 | } |
2666 | | |
2667 | | void Magick::Image::crop(const Geometry &geometry_) |
2668 | 0 | { |
2669 | 0 | MagickCore::Image |
2670 | 0 | *newImage; |
2671 | |
|
2672 | 0 | RectangleInfo |
2673 | 0 | cropInfo=geometry_; |
2674 | |
|
2675 | 0 | GetPPException; |
2676 | 0 | newImage=CropImage(constImage(),&cropInfo,exceptionInfo); |
2677 | 0 | replaceImage(newImage); |
2678 | 0 | ThrowImageException; |
2679 | 0 | } |
2680 | | |
2681 | | void Magick::Image::cycleColormap(const ssize_t amount_) |
2682 | 0 | { |
2683 | 0 | modifyImage(); |
2684 | 0 | GetPPException; |
2685 | 0 | CycleColormapImage(image(),amount_,exceptionInfo); |
2686 | 0 | ThrowImageException; |
2687 | 0 | } |
2688 | | |
2689 | | void Magick::Image::decipher(const std::string &passphrase_) |
2690 | 0 | { |
2691 | 0 | modifyImage(); |
2692 | 0 | GetPPException; |
2693 | 0 | DecipherImage(image(),passphrase_.c_str(),exceptionInfo); |
2694 | 0 | ThrowImageException; |
2695 | 0 | } |
2696 | | |
2697 | | void Magick::Image::defineSet(const std::string &magick_, |
2698 | | const std::string &key_,bool flag_) |
2699 | 0 | { |
2700 | 0 | std::string |
2701 | 0 | definition; |
2702 | |
|
2703 | 0 | modifyImage(); |
2704 | 0 | definition=magick_ + ":" + key_; |
2705 | 0 | if (flag_) |
2706 | 0 | (void) SetImageOption(imageInfo(),definition.c_str(),""); |
2707 | 0 | else |
2708 | 0 | DeleteImageOption(imageInfo(),definition.c_str()); |
2709 | 0 | } |
2710 | | |
2711 | | bool Magick::Image::defineSet(const std::string &magick_, |
2712 | | const std::string &key_ ) const |
2713 | 0 | { |
2714 | 0 | const char |
2715 | 0 | *option; |
2716 | |
|
2717 | 0 | std::string |
2718 | 0 | key; |
2719 | |
|
2720 | 0 | key=magick_ + ":" + key_; |
2721 | 0 | option=GetImageOption(constImageInfo(),key.c_str()); |
2722 | 0 | if (option) |
2723 | 0 | return(true); |
2724 | 0 | return(false); |
2725 | 0 | } |
2726 | | |
2727 | | void Magick::Image::defineValue(const std::string &magick_, |
2728 | | const std::string &key_,const std::string &value_) |
2729 | 0 | { |
2730 | 0 | std::string |
2731 | 0 | format, |
2732 | 0 | option; |
2733 | |
|
2734 | 0 | modifyImage(); |
2735 | 0 | format=magick_ + ":" + key_; |
2736 | 0 | option=value_; |
2737 | 0 | (void) SetImageOption(imageInfo(),format.c_str(),option.c_str()); |
2738 | 0 | } |
2739 | | |
2740 | | std::string Magick::Image::defineValue(const std::string &magick_, |
2741 | | const std::string &key_) const |
2742 | 0 | { |
2743 | 0 | const char |
2744 | 0 | *option; |
2745 | |
|
2746 | 0 | std::string |
2747 | 0 | definition; |
2748 | |
|
2749 | 0 | definition=magick_ + ":" + key_; |
2750 | 0 | option=GetImageOption(constImageInfo(),definition.c_str()); |
2751 | 0 | if (option) |
2752 | 0 | return(std::string(option)); |
2753 | 0 | return(std::string()); |
2754 | 0 | } |
2755 | | |
2756 | | void Magick::Image::deskew(const double threshold_) |
2757 | 0 | { |
2758 | 0 | MagickCore::Image |
2759 | 0 | *newImage; |
2760 | |
|
2761 | 0 | GetPPException; |
2762 | 0 | newImage=DeskewImage(constImage(),threshold_,exceptionInfo); |
2763 | 0 | replaceImage(newImage); |
2764 | 0 | ThrowImageException; |
2765 | 0 | } |
2766 | | |
2767 | | void Magick::Image::despeckle(void) |
2768 | 0 | { |
2769 | 0 | MagickCore::Image |
2770 | 0 | *newImage; |
2771 | |
|
2772 | 0 | GetPPException; |
2773 | 0 | newImage=DespeckleImage(constImage(),exceptionInfo); |
2774 | 0 | replaceImage(newImage); |
2775 | 0 | ThrowImageException; |
2776 | 0 | } |
2777 | | |
2778 | | void Magick::Image::display(void) |
2779 | 0 | { |
2780 | 0 | GetPPException; |
2781 | 0 | DisplayImages(imageInfo(),image(),exceptionInfo); |
2782 | 0 | ThrowImageException; |
2783 | 0 | } |
2784 | | |
2785 | | void Magick::Image::distort(const DistortMethod method_, |
2786 | | const size_t numberArguments_,const double *arguments_,const bool bestfit_) |
2787 | 0 | { |
2788 | 0 | MagickCore::Image |
2789 | 0 | *newImage; |
2790 | |
|
2791 | 0 | GetPPException; |
2792 | 0 | newImage=DistortImage(constImage(), method_,numberArguments_,arguments_, |
2793 | 0 | bestfit_ == true ? MagickTrue : MagickFalse,exceptionInfo); |
2794 | 0 | replaceImage(newImage); |
2795 | 0 | ThrowImageException; |
2796 | 0 | } |
2797 | | |
2798 | | void Magick::Image::draw(const Magick::Drawable &drawable_) |
2799 | 0 | { |
2800 | 0 | DrawingWand |
2801 | 0 | *wand; |
2802 | |
|
2803 | 0 | modifyImage(); |
2804 | |
|
2805 | 0 | wand=AcquireDrawingWand(options()->drawInfo(),image()); |
2806 | |
|
2807 | 0 | if(wand) |
2808 | 0 | { |
2809 | 0 | drawable_.operator()(wand); |
2810 | |
|
2811 | 0 | DrawRender(wand); |
2812 | |
|
2813 | 0 | ClonePPDrawException(wand); |
2814 | 0 | wand=DestroyDrawingWand(wand); |
2815 | 0 | ThrowPPDrawException(quiet()); |
2816 | 0 | } |
2817 | 0 | } |
2818 | | |
2819 | | void Magick::Image::draw(const std::vector<Magick::Drawable> &drawable_) |
2820 | 0 | { |
2821 | 0 | DrawingWand |
2822 | 0 | *wand; |
2823 | |
|
2824 | 0 | modifyImage(); |
2825 | |
|
2826 | 0 | wand= AcquireDrawingWand(options()->drawInfo(),image()); |
2827 | |
|
2828 | 0 | if(wand) |
2829 | 0 | { |
2830 | 0 | for (std::vector<Magick::Drawable>::const_iterator p = drawable_.begin(); |
2831 | 0 | p != drawable_.end(); p++ ) |
2832 | 0 | { |
2833 | 0 | p->operator()(wand); |
2834 | 0 | if (DrawGetExceptionType(wand) != MagickCore::UndefinedException) |
2835 | 0 | break; |
2836 | 0 | } |
2837 | |
|
2838 | 0 | if (DrawGetExceptionType(wand) == MagickCore::UndefinedException) |
2839 | 0 | DrawRender(wand); |
2840 | |
|
2841 | 0 | ClonePPDrawException(wand); |
2842 | 0 | wand=DestroyDrawingWand(wand); |
2843 | 0 | ThrowPPDrawException(quiet()); |
2844 | 0 | } |
2845 | 0 | } |
2846 | | |
2847 | | void Magick::Image::edge(const double radius_) |
2848 | 0 | { |
2849 | 0 | MagickCore::Image |
2850 | 0 | *newImage; |
2851 | |
|
2852 | 0 | GetPPException; |
2853 | 0 | newImage=EdgeImage(constImage(),radius_,exceptionInfo); |
2854 | 0 | replaceImage(newImage); |
2855 | 0 | ThrowImageException; |
2856 | 0 | } |
2857 | | |
2858 | | void Magick::Image::emboss(const double radius_,const double sigma_) |
2859 | 0 | { |
2860 | 0 | MagickCore::Image |
2861 | 0 | *newImage; |
2862 | |
|
2863 | 0 | GetPPException; |
2864 | 0 | newImage=EmbossImage(constImage(),radius_,sigma_,exceptionInfo); |
2865 | 0 | replaceImage(newImage); |
2866 | 0 | ThrowImageException; |
2867 | 0 | } |
2868 | | |
2869 | | void Magick::Image::encipher(const std::string &passphrase_) |
2870 | 0 | { |
2871 | 0 | modifyImage(); |
2872 | 0 | GetPPException; |
2873 | 0 | EncipherImage(image(),passphrase_.c_str(),exceptionInfo); |
2874 | 0 | ThrowImageException; |
2875 | 0 | } |
2876 | | |
2877 | | void Magick::Image::enhance(void) |
2878 | 0 | { |
2879 | 0 | MagickCore::Image |
2880 | 0 | *newImage; |
2881 | |
|
2882 | 0 | GetPPException; |
2883 | 0 | newImage=EnhanceImage(constImage(),exceptionInfo); |
2884 | 0 | replaceImage(newImage); |
2885 | 0 | ThrowImageException; |
2886 | 0 | } |
2887 | | |
2888 | | void Magick::Image::equalize(void) |
2889 | 0 | { |
2890 | 0 | modifyImage(); |
2891 | 0 | GetPPException; |
2892 | 0 | EqualizeImage(image(),exceptionInfo); |
2893 | 0 | ThrowImageException; |
2894 | 0 | } |
2895 | | |
2896 | | void Magick::Image::erase(void) |
2897 | 0 | { |
2898 | 0 | modifyImage(); |
2899 | 0 | GetPPException; |
2900 | 0 | (void) SetImageBackgroundColor(image(),exceptionInfo); |
2901 | 0 | ThrowImageException; |
2902 | 0 | } |
2903 | | |
2904 | | void Magick::Image::evaluate(const ChannelType channel_, |
2905 | | const MagickEvaluateOperator operator_,double rvalue_) |
2906 | 0 | { |
2907 | 0 | GetPPException; |
2908 | 0 | GetAndSetPPChannelMask(channel_); |
2909 | 0 | EvaluateImage(image(),operator_,rvalue_,exceptionInfo); |
2910 | 0 | RestorePPChannelMask; |
2911 | 0 | ThrowImageException; |
2912 | 0 | } |
2913 | | |
2914 | | void Magick::Image::evaluate(const ChannelType channel_, |
2915 | | const MagickFunction function_,const size_t number_parameters_, |
2916 | | const double *parameters_) |
2917 | 0 | { |
2918 | 0 | GetPPException; |
2919 | 0 | GetAndSetPPChannelMask(channel_); |
2920 | 0 | FunctionImage(image(),function_,number_parameters_,parameters_, |
2921 | 0 | exceptionInfo); |
2922 | 0 | RestorePPChannelMask; |
2923 | 0 | ThrowImageException; |
2924 | 0 | } |
2925 | | |
2926 | | void Magick::Image::evaluate(const ChannelType channel_,const ssize_t x_, |
2927 | | const ssize_t y_,const size_t columns_,const size_t rows_, |
2928 | | const MagickEvaluateOperator operator_,const double rvalue_) |
2929 | 0 | { |
2930 | 0 | RectangleInfo |
2931 | 0 | geometry; |
2932 | |
|
2933 | 0 | MagickCore::Image |
2934 | 0 | *cropImage; |
2935 | |
|
2936 | 0 | geometry.width = columns_; |
2937 | 0 | geometry.height = rows_; |
2938 | 0 | geometry.x = x_; |
2939 | 0 | geometry.y = y_; |
2940 | |
|
2941 | 0 | GetPPException; |
2942 | 0 | cropImage=CropImage(image(),&geometry,exceptionInfo); |
2943 | 0 | GetAndSetPPChannelMask(channel_); |
2944 | 0 | EvaluateImage(cropImage,operator_,rvalue_,exceptionInfo); |
2945 | 0 | RestorePPChannelMask; |
2946 | 0 | (void) CompositeImage(image(),cropImage,image()->alpha_trait == |
2947 | 0 | BlendPixelTrait ? OverCompositeOp : CopyCompositeOp,MagickFalse, |
2948 | 0 | geometry.x,geometry.y,exceptionInfo ); |
2949 | 0 | cropImage=DestroyImageList(cropImage); |
2950 | 0 | ThrowImageException; |
2951 | 0 | } |
2952 | | |
2953 | | void Magick::Image::extent(const Geometry &geometry_ ) |
2954 | 0 | { |
2955 | 0 | MagickCore::Image |
2956 | 0 | *newImage; |
2957 | |
|
2958 | 0 | RectangleInfo |
2959 | 0 | extentInfo=geometry_; |
2960 | |
|
2961 | 0 | modifyImage(); |
2962 | 0 | extentInfo.x=geometry_.xOff(); |
2963 | 0 | extentInfo.y=geometry_.yOff(); |
2964 | 0 | GetPPException; |
2965 | 0 | newImage=ExtentImage(image(),&extentInfo,exceptionInfo); |
2966 | 0 | replaceImage(newImage); |
2967 | 0 | ThrowImageException; |
2968 | 0 | } |
2969 | | |
2970 | | void Magick::Image::extent(const Geometry &geometry_, |
2971 | | const Color &backgroundColor_) |
2972 | 0 | { |
2973 | 0 | backgroundColor(backgroundColor_); |
2974 | 0 | extent(geometry_); |
2975 | 0 | } |
2976 | | |
2977 | | void Magick::Image::extent(const Geometry &geometry_, |
2978 | | const Color &backgroundColor_,const GravityType gravity_) |
2979 | 0 | { |
2980 | 0 | backgroundColor(backgroundColor_); |
2981 | 0 | extent(geometry_,gravity_); |
2982 | 0 | } |
2983 | | |
2984 | | void Magick::Image::extent(const Geometry &geometry_, |
2985 | | const GravityType gravity_) |
2986 | 0 | { |
2987 | 0 | RectangleInfo |
2988 | 0 | geometry; |
2989 | |
|
2990 | 0 | SetGeometry(image(),&geometry); |
2991 | 0 | geometry.width=geometry_.width(); |
2992 | 0 | geometry.height=geometry_.height(); |
2993 | 0 | GravityAdjustGeometry(image()->columns,image()->rows,gravity_,&geometry); |
2994 | 0 | extent(geometry); |
2995 | 0 | } |
2996 | | |
2997 | | void Magick::Image::flip(void) |
2998 | 0 | { |
2999 | 0 | MagickCore::Image |
3000 | 0 | *newImage; |
3001 | |
|
3002 | 0 | GetPPException; |
3003 | 0 | newImage=FlipImage(constImage(),exceptionInfo); |
3004 | 0 | replaceImage(newImage); |
3005 | 0 | ThrowImageException; |
3006 | 0 | } |
3007 | | |
3008 | | void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_, |
3009 | | const unsigned int alpha_,const bool invert_) |
3010 | 0 | { |
3011 | 0 | PixelInfo |
3012 | 0 | target; |
3013 | |
|
3014 | 0 | modifyImage(); |
3015 | |
|
3016 | 0 | target=static_cast<PixelInfo>(pixelColor(x_,y_)); |
3017 | 0 | target.alpha=alpha_; |
3018 | 0 | GetPPException; |
3019 | 0 | GetAndSetPPChannelMask(AlphaChannel); |
3020 | 0 | FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_, |
3021 | 0 | (MagickBooleanType)invert_,exceptionInfo); |
3022 | 0 | RestorePPChannelMask; |
3023 | 0 | ThrowImageException; |
3024 | 0 | } |
3025 | | |
3026 | | void Magick::Image::floodFillAlpha(const ssize_t x_,const ssize_t y_, |
3027 | | const unsigned int alpha_,const Color &target_,const bool invert_) |
3028 | 0 | { |
3029 | 0 | PixelInfo |
3030 | 0 | target; |
3031 | |
|
3032 | 0 | modifyImage(); |
3033 | |
|
3034 | 0 | target=static_cast<PixelInfo>(target_); |
3035 | 0 | target.alpha=alpha_; |
3036 | 0 | GetPPException; |
3037 | 0 | GetAndSetPPChannelMask(AlphaChannel); |
3038 | 0 | FloodfillPaintImage(image(),options()->drawInfo(),&target,x_,y_, |
3039 | 0 | (MagickBooleanType)invert_,exceptionInfo); |
3040 | 0 | RestorePPChannelMask; |
3041 | 0 | ThrowImageException; |
3042 | 0 | } |
3043 | | |
3044 | | void Magick::Image::floodFillColor(const Geometry &point_, |
3045 | | const Magick::Color &fillColor_,const bool invert_) |
3046 | 0 | { |
3047 | 0 | floodFillColor(point_.xOff(),point_.yOff(),fillColor_,invert_); |
3048 | 0 | } |
3049 | | |
3050 | | void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_, |
3051 | | const Magick::Color &fillColor_,const bool invert_) |
3052 | 0 | { |
3053 | 0 | PixelInfo |
3054 | 0 | pixel; |
3055 | |
|
3056 | 0 | modifyImage(); |
3057 | |
|
3058 | 0 | pixel=static_cast<PixelInfo>(pixelColor(x_,y_)); |
3059 | 0 | floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_); |
3060 | 0 | } |
3061 | | |
3062 | | void Magick::Image::floodFillColor(const Geometry &point_, |
3063 | | const Magick::Color &fillColor_,const Magick::Color &borderColor_, |
3064 | | const bool invert_) |
3065 | 0 | { |
3066 | 0 | floodFillColor(point_.xOff(),point_.yOff(),fillColor_,borderColor_,invert_); |
3067 | 0 | } |
3068 | | |
3069 | | void Magick::Image::floodFillColor(const ssize_t x_,const ssize_t y_, |
3070 | | const Magick::Color &fillColor_,const Magick::Color &borderColor_, |
3071 | | const bool invert_) |
3072 | 0 | { |
3073 | 0 | PixelInfo |
3074 | 0 | pixel; |
3075 | |
|
3076 | 0 | modifyImage(); |
3077 | |
|
3078 | 0 | pixel=static_cast<PixelInfo>(borderColor_); |
3079 | 0 | floodFill(x_,y_,(Magick::Image *)NULL,fillColor_,&pixel,invert_); |
3080 | 0 | } |
3081 | | |
3082 | | void Magick::Image::floodFillTexture(const Magick::Geometry &point_, |
3083 | | const Magick::Image &texture_,const bool invert_) |
3084 | 0 | { |
3085 | 0 | floodFillTexture(point_.xOff(),point_.yOff(),texture_,invert_); |
3086 | 0 | } |
3087 | | |
3088 | | void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_, |
3089 | | const Magick::Image &texture_,const bool invert_) |
3090 | 0 | { |
3091 | 0 | PixelInfo |
3092 | 0 | pixel; |
3093 | |
|
3094 | 0 | modifyImage(); |
3095 | |
|
3096 | 0 | pixel=static_cast<PixelInfo>(pixelColor(x_,y_)); |
3097 | 0 | floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_); |
3098 | 0 | } |
3099 | | |
3100 | | void Magick::Image::floodFillTexture(const Magick::Geometry &point_, |
3101 | | const Magick::Image &texture_,const Magick::Color &borderColor_, |
3102 | | const bool invert_) |
3103 | 0 | { |
3104 | 0 | floodFillTexture(point_.xOff(),point_.yOff(),texture_,borderColor_,invert_); |
3105 | 0 | } |
3106 | | |
3107 | | void Magick::Image::floodFillTexture(const ssize_t x_,const ssize_t y_, |
3108 | | const Magick::Image &texture_,const Magick::Color &borderColor_, |
3109 | | const bool invert_) |
3110 | 0 | { |
3111 | 0 | PixelInfo |
3112 | 0 | pixel; |
3113 | |
|
3114 | 0 | modifyImage(); |
3115 | |
|
3116 | 0 | pixel=static_cast<PixelInfo>(borderColor_); |
3117 | 0 | floodFill(x_,y_,&texture_,Magick::Color(),&pixel,invert_); |
3118 | 0 | } |
3119 | | |
3120 | | void Magick::Image::flop(void) |
3121 | 0 | { |
3122 | 0 | MagickCore::Image |
3123 | 0 | *newImage; |
3124 | |
|
3125 | 0 | GetPPException; |
3126 | 0 | newImage=FlopImage(constImage(),exceptionInfo); |
3127 | 0 | replaceImage(newImage); |
3128 | 0 | ThrowImageException; |
3129 | 0 | } |
3130 | | |
3131 | | void Magick::Image::fontTypeMetrics(const std::string &text_, |
3132 | | TypeMetric *metrics) |
3133 | 0 | { |
3134 | 0 | DrawInfo |
3135 | 0 | *drawInfo; |
3136 | |
|
3137 | 0 | drawInfo=options()->drawInfo(); |
3138 | 0 | drawInfo->text=DestroyString(drawInfo->text); |
3139 | 0 | drawInfo->text=const_cast<char *>(text_.c_str()); |
3140 | 0 | GetPPException; |
3141 | 0 | GetTypeMetrics(image(),drawInfo,&(metrics->_typeMetric),exceptionInfo); |
3142 | 0 | drawInfo->text=(char *) NULL; |
3143 | 0 | ThrowImageException; |
3144 | 0 | } |
3145 | | |
3146 | | void Magick::Image::fontTypeMetricsMultiline(const std::string &text_, |
3147 | | TypeMetric *metrics) |
3148 | 0 | { |
3149 | 0 | DrawInfo |
3150 | 0 | *drawInfo; |
3151 | |
|
3152 | 0 | drawInfo=options()->drawInfo(); |
3153 | 0 | drawInfo->text=DestroyString(drawInfo->text); |
3154 | 0 | drawInfo->text=const_cast<char *>(text_.c_str()); |
3155 | 0 | GetPPException; |
3156 | 0 | (void) GetMultilineTypeMetrics(image(),drawInfo,&(metrics->_typeMetric), |
3157 | 0 | exceptionInfo); |
3158 | 0 | drawInfo->text=(char *) NULL; |
3159 | 0 | ThrowImageException; |
3160 | 0 | } |
3161 | | |
3162 | | void Magick::Image::frame(const Geometry &geometry_) |
3163 | 0 | { |
3164 | 0 | FrameInfo |
3165 | 0 | info; |
3166 | | |
3167 | 0 | MagickCore::Image |
3168 | 0 | *newImage; |
3169 | |
|
3170 | 0 | info.x=static_cast<ssize_t>(geometry_.width()); |
3171 | 0 | info.y=static_cast<ssize_t>(geometry_.height()); |
3172 | 0 | info.width=columns() + (static_cast<size_t>(info.x) << 1); |
3173 | 0 | info.height=rows() + (static_cast<size_t>(info.y) << 1); |
3174 | 0 | info.outer_bevel=geometry_.xOff(); |
3175 | 0 | info.inner_bevel=geometry_.yOff(); |
3176 | |
|
3177 | 0 | GetPPException; |
3178 | 0 | newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo); |
3179 | 0 | replaceImage(newImage); |
3180 | 0 | ThrowImageException; |
3181 | 0 | } |
3182 | | |
3183 | | void Magick::Image::frame(const size_t width_,const size_t height_, |
3184 | | const ssize_t innerBevel_,const ssize_t outerBevel_) |
3185 | 0 | { |
3186 | 0 | FrameInfo |
3187 | 0 | info; |
3188 | |
|
3189 | 0 | MagickCore::Image |
3190 | 0 | *newImage; |
3191 | |
|
3192 | 0 | info.x=static_cast<ssize_t>(width_); |
3193 | 0 | info.y=static_cast<ssize_t>(height_); |
3194 | 0 | info.width=columns() + (static_cast<size_t>(info.x) << 1); |
3195 | 0 | info.height=rows() + (static_cast<size_t>(info.y) << 1); |
3196 | 0 | info.outer_bevel=static_cast<ssize_t>(outerBevel_); |
3197 | 0 | info.inner_bevel=static_cast<ssize_t>(innerBevel_); |
3198 | |
|
3199 | 0 | GetPPException; |
3200 | 0 | newImage=FrameImage(constImage(),&info,image()->compose,exceptionInfo); |
3201 | 0 | replaceImage(newImage); |
3202 | 0 | ThrowImageException; |
3203 | 0 | } |
3204 | | |
3205 | | void Magick::Image::fx(const std::string expression_) |
3206 | 0 | { |
3207 | 0 | MagickCore::Image |
3208 | 0 | *newImage; |
3209 | |
|
3210 | 0 | GetPPException; |
3211 | 0 | newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo); |
3212 | 0 | replaceImage(newImage); |
3213 | 0 | ThrowImageException; |
3214 | 0 | } |
3215 | | |
3216 | | void Magick::Image::fx(const std::string expression_, |
3217 | | const Magick::ChannelType channel_) |
3218 | 0 | { |
3219 | 0 | MagickCore::Image |
3220 | 0 | *newImage; |
3221 | |
|
3222 | 0 | GetPPException; |
3223 | 0 | GetAndSetPPChannelMask(channel_); |
3224 | 0 | newImage=FxImage(constImage(),expression_.c_str(),exceptionInfo); |
3225 | 0 | RestorePPChannelMask; |
3226 | 0 | replaceImage(newImage); |
3227 | 0 | ThrowImageException; |
3228 | 0 | } |
3229 | | |
3230 | | void Magick::Image::gamma(const double gamma_) |
3231 | 0 | { |
3232 | 0 | modifyImage(); |
3233 | 0 | GetPPException; |
3234 | 0 | GammaImage(image(),gamma_,exceptionInfo); |
3235 | 0 | ThrowImageException; |
3236 | 0 | } |
3237 | | |
3238 | | void Magick::Image::gamma(const double gammaRed_,const double gammaGreen_, |
3239 | | const double gammaBlue_) |
3240 | 0 | { |
3241 | 0 | modifyImage(); |
3242 | 0 | GetPPException; |
3243 | 0 | GetAndSetPPChannelMask(RedChannel); |
3244 | 0 | (void) GammaImage(image(),gammaRed_,exceptionInfo); |
3245 | 0 | SetPPChannelMask(GreenChannel); |
3246 | 0 | (void) GammaImage(image(),gammaGreen_,exceptionInfo); |
3247 | 0 | SetPPChannelMask(BlueChannel); |
3248 | 0 | (void) GammaImage(image(),gammaBlue_,exceptionInfo); |
3249 | 0 | RestorePPChannelMask; |
3250 | 0 | ThrowImageException; |
3251 | 0 | } |
3252 | | |
3253 | | void Magick::Image::gaussianBlur(const double radius_,const double sigma_) |
3254 | 0 | { |
3255 | 0 | MagickCore::Image |
3256 | 0 | *newImage; |
3257 | |
|
3258 | 0 | GetPPException; |
3259 | 0 | newImage=GaussianBlurImage(constImage(),radius_,sigma_,exceptionInfo); |
3260 | 0 | replaceImage(newImage); |
3261 | 0 | ThrowImageException; |
3262 | 0 | } |
3263 | | |
3264 | | void Magick::Image::gaussianBlurChannel(const ChannelType channel_, |
3265 | | const double radius_,const double sigma_) |
3266 | 0 | { |
3267 | 0 | MagickCore::Image |
3268 | 0 | *newImage; |
3269 | |
|
3270 | 0 | GetPPException; |
3271 | 0 | GetAndSetPPChannelMask(channel_); |
3272 | 0 | newImage=GaussianBlurImage(constImage(),radius_,sigma_,exceptionInfo); |
3273 | 0 | RestorePPChannelMask; |
3274 | 0 | replaceImage(newImage); |
3275 | 0 | ThrowImageException; |
3276 | 0 | } |
3277 | | |
3278 | | const Magick::Quantum *Magick::Image::getConstPixels(const ssize_t x_, |
3279 | | const ssize_t y_,const size_t columns_,const size_t rows_) const |
3280 | 0 | { |
3281 | 0 | const Quantum |
3282 | 0 | *p; |
3283 | |
|
3284 | 0 | GetPPException; |
3285 | 0 | p=GetVirtualPixels(constImage(),x_, y_,columns_, rows_,exceptionInfo); |
3286 | 0 | ThrowImageException; |
3287 | 0 | return(p); |
3288 | 0 | } |
3289 | | |
3290 | | const void *Magick::Image::getConstMetacontent(void) const |
3291 | 0 | { |
3292 | 0 | const void |
3293 | 0 | *result; |
3294 | |
|
3295 | 0 | result=GetVirtualMetacontent(constImage()); |
3296 | |
|
3297 | 0 | if(!result) |
3298 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
3299 | 0 | "Unable to retrieve meta content."); |
3300 | |
|
3301 | 0 | return(result); |
3302 | 0 | } |
3303 | | |
3304 | | void *Magick::Image::getMetacontent(void ) |
3305 | 0 | { |
3306 | 0 | void |
3307 | 0 | *result; |
3308 | |
|
3309 | 0 | result=GetAuthenticMetacontent(image()); |
3310 | |
|
3311 | 0 | if(!result) |
3312 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
3313 | 0 | "Unable to retrieve meta content."); |
3314 | |
|
3315 | 0 | return(result); |
3316 | 0 | } |
3317 | | |
3318 | | Magick::Quantum *Magick::Image::getPixels(const ssize_t x_,const ssize_t y_, |
3319 | | const size_t columns_,const size_t rows_) |
3320 | 0 | { |
3321 | 0 | Quantum |
3322 | 0 | *result; |
3323 | |
|
3324 | 0 | modifyImage(); |
3325 | 0 | GetPPException; |
3326 | 0 | result=GetAuthenticPixels(image(),x_, y_,columns_,rows_,exceptionInfo); |
3327 | 0 | ThrowImageException; |
3328 | |
|
3329 | 0 | return(result); |
3330 | 0 | } |
3331 | | |
3332 | | void Magick::Image::grayscale(const PixelIntensityMethod method_) |
3333 | 0 | { |
3334 | 0 | modifyImage(); |
3335 | 0 | GetPPException; |
3336 | 0 | (void) GrayscaleImage(image(),method_,exceptionInfo); |
3337 | 0 | ThrowImageException; |
3338 | 0 | } |
3339 | | |
3340 | | void Magick::Image::haldClut(const Image &clutImage_) |
3341 | 0 | { |
3342 | 0 | modifyImage(); |
3343 | 0 | GetPPException; |
3344 | 0 | (void) HaldClutImage(image(),clutImage_.constImage(),exceptionInfo); |
3345 | 0 | ThrowImageException; |
3346 | 0 | } |
3347 | | |
3348 | | void Magick::Image::houghLine(const size_t width_,const size_t height_, |
3349 | | const size_t threshold_) |
3350 | 0 | { |
3351 | 0 | MagickCore::Image |
3352 | 0 | *newImage; |
3353 | |
|
3354 | 0 | GetPPException; |
3355 | 0 | newImage=HoughLineImage(constImage(),width_,height_,threshold_, |
3356 | 0 | exceptionInfo); |
3357 | 0 | replaceImage(newImage); |
3358 | 0 | ThrowImageException; |
3359 | 0 | } |
3360 | | |
3361 | | Magick::ImageType Magick::Image::identifyType(void) const |
3362 | 0 | { |
3363 | 0 | ImageType |
3364 | 0 | image_type; |
3365 | |
|
3366 | 0 | GetPPException; |
3367 | 0 | image_type=IdentifyImageType(constImage(),exceptionInfo); |
3368 | 0 | ThrowImageException; |
3369 | 0 | return(image_type); |
3370 | 0 | } |
3371 | | |
3372 | | void Magick::Image::implode(const double factor_) |
3373 | 0 | { |
3374 | 0 | MagickCore::Image |
3375 | 0 | *newImage; |
3376 | |
|
3377 | 0 | GetPPException; |
3378 | 0 | newImage=ImplodeImage(constImage(),factor_,image()->interpolate, |
3379 | 0 | exceptionInfo); |
3380 | 0 | replaceImage(newImage); |
3381 | 0 | ThrowImageException; |
3382 | 0 | } |
3383 | | |
3384 | | void Magick::Image::inverseFourierTransform(const Image &phase_) |
3385 | 0 | { |
3386 | 0 | inverseFourierTransform(phase_,true); |
3387 | 0 | } |
3388 | | |
3389 | | void Magick::Image::inverseFourierTransform(const Image &phase_, |
3390 | | const bool magnitude_) |
3391 | 0 | { |
3392 | 0 | MagickCore::Image |
3393 | 0 | *newImage; |
3394 | |
|
3395 | 0 | GetPPException; |
3396 | 0 | newImage=InverseFourierTransformImage(constImage(),phase_.constImage(), |
3397 | 0 | magnitude_ == true ? MagickTrue : MagickFalse,exceptionInfo); |
3398 | 0 | replaceImage(newImage); |
3399 | 0 | ThrowImageException; |
3400 | 0 | } |
3401 | | |
3402 | | void Magick::Image::kuwahara(const double radius_,const double sigma_) |
3403 | 0 | { |
3404 | 0 | MagickCore::Image |
3405 | 0 | *newImage; |
3406 | |
|
3407 | 0 | GetPPException; |
3408 | 0 | newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo); |
3409 | 0 | replaceImage(newImage); |
3410 | 0 | ThrowImageException; |
3411 | 0 | } |
3412 | | |
3413 | | void Magick::Image::kuwaharaChannel(const ChannelType channel_, |
3414 | | const double radius_,const double sigma_) |
3415 | 0 | { |
3416 | 0 | MagickCore::Image |
3417 | 0 | *newImage; |
3418 | |
|
3419 | 0 | GetPPException; |
3420 | 0 | GetAndSetPPChannelMask(channel_); |
3421 | 0 | newImage=KuwaharaImage(constImage(),radius_,sigma_,exceptionInfo); |
3422 | 0 | replaceImage(newImage); |
3423 | 0 | RestorePPChannelMask; |
3424 | 0 | ThrowImageException; |
3425 | 0 | } |
3426 | | |
3427 | | void Magick::Image::level(const double blackPoint_,const double whitePoint_, |
3428 | | const double gamma_) |
3429 | 0 | { |
3430 | 0 | modifyImage(); |
3431 | 0 | GetPPException; |
3432 | 0 | (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo); |
3433 | 0 | ThrowImageException; |
3434 | 0 | } |
3435 | | |
3436 | | void Magick::Image::levelChannel(const ChannelType channel_, |
3437 | | const double blackPoint_,const double whitePoint_,const double gamma_) |
3438 | 0 | { |
3439 | 0 | modifyImage(); |
3440 | 0 | GetPPException; |
3441 | 0 | GetAndSetPPChannelMask(channel_); |
3442 | 0 | (void) LevelImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo); |
3443 | 0 | RestorePPChannelMask; |
3444 | 0 | ThrowImageException; |
3445 | 0 | } |
3446 | | |
3447 | | void Magick::Image::levelColors(const Color &blackColor_, |
3448 | | const Color &whiteColor_,const bool invert_) |
3449 | 0 | { |
3450 | 0 | PixelInfo |
3451 | 0 | black, |
3452 | 0 | white; |
3453 | |
|
3454 | 0 | modifyImage(); |
3455 | |
|
3456 | 0 | black=static_cast<PixelInfo>(blackColor_); |
3457 | 0 | white=static_cast<PixelInfo>(whiteColor_); |
3458 | 0 | GetPPException; |
3459 | 0 | (void) LevelImageColors(image(),&black,&white,invert_ == true ? |
3460 | 0 | MagickTrue : MagickFalse,exceptionInfo); |
3461 | 0 | ThrowImageException; |
3462 | 0 | } |
3463 | | |
3464 | | void Magick::Image::levelColorsChannel(const ChannelType channel_, |
3465 | | const Color &blackColor_,const Color &whiteColor_,const bool invert_) |
3466 | 0 | { |
3467 | 0 | PixelInfo |
3468 | 0 | black, |
3469 | 0 | white; |
3470 | |
|
3471 | 0 | modifyImage(); |
3472 | |
|
3473 | 0 | black=static_cast<PixelInfo>(blackColor_); |
3474 | 0 | white=static_cast<PixelInfo>(whiteColor_); |
3475 | 0 | GetPPException; |
3476 | 0 | GetAndSetPPChannelMask(channel_); |
3477 | 0 | (void) LevelImageColors(image(),&black,&white,invert_ == true ? |
3478 | 0 | MagickTrue : MagickFalse,exceptionInfo); |
3479 | 0 | RestorePPChannelMask; |
3480 | 0 | ThrowImageException; |
3481 | 0 | } |
3482 | | |
3483 | | void Magick::Image::levelize(const double blackPoint_,const double whitePoint_, |
3484 | | const double gamma_) |
3485 | 0 | { |
3486 | 0 | modifyImage(); |
3487 | 0 | GetPPException; |
3488 | 0 | (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo); |
3489 | 0 | ThrowImageException; |
3490 | 0 | } |
3491 | | |
3492 | | void Magick::Image::levelizeChannel(const ChannelType channel_, |
3493 | | const double blackPoint_,const double whitePoint_,const double gamma_) |
3494 | 0 | { |
3495 | 0 | modifyImage(); |
3496 | 0 | GetPPException; |
3497 | 0 | GetAndSetPPChannelMask(channel_); |
3498 | 0 | (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo); |
3499 | 0 | RestorePPChannelMask; |
3500 | 0 | ThrowImageException; |
3501 | 0 | } |
3502 | | |
3503 | | void Magick::Image::linearStretch(const double blackPoint_, |
3504 | | const double whitePoint_) |
3505 | 0 | { |
3506 | 0 | modifyImage(); |
3507 | 0 | GetPPException; |
3508 | 0 | LinearStretchImage(image(),blackPoint_,whitePoint_,exceptionInfo); |
3509 | 0 | ThrowImageException; |
3510 | 0 | } |
3511 | | |
3512 | | void Magick::Image::liquidRescale(const Geometry &geometry_) |
3513 | 0 | { |
3514 | 0 | MagickCore::Image |
3515 | 0 | *newImage; |
3516 | |
|
3517 | 0 | size_t |
3518 | 0 | height=rows(), |
3519 | 0 | width=columns(); |
3520 | |
|
3521 | 0 | ssize_t |
3522 | 0 | x=0, |
3523 | 0 | y=0; |
3524 | |
|
3525 | 0 | ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width, |
3526 | 0 | &height); |
3527 | |
|
3528 | 0 | GetPPException; |
3529 | 0 | newImage=LiquidRescaleImage(image(),width,height,(double) x,(double) y,exceptionInfo); |
3530 | 0 | replaceImage(newImage); |
3531 | 0 | ThrowImageException; |
3532 | 0 | } |
3533 | | |
3534 | | void Magick::Image::localContrast(const double radius_,const double strength_) |
3535 | 0 | { |
3536 | 0 | MagickCore::Image |
3537 | 0 | *newImage; |
3538 | |
|
3539 | 0 | GetPPException; |
3540 | 0 | newImage=LocalContrastImage(constImage(),radius_,strength_,exceptionInfo); |
3541 | 0 | replaceImage(newImage); |
3542 | 0 | ThrowImageException; |
3543 | 0 | } |
3544 | | |
3545 | | void Magick::Image::localContrastChannel(const ChannelType channel_, |
3546 | | const double radius_,const double strength_) |
3547 | 0 | { |
3548 | 0 | MagickCore::Image |
3549 | 0 | *newImage; |
3550 | |
|
3551 | 0 | GetPPException; |
3552 | 0 | GetAndSetPPChannelMask(channel_); |
3553 | 0 | newImage=LocalContrastImage(constImage(),radius_,strength_,exceptionInfo); |
3554 | 0 | RestorePPChannelMask; |
3555 | 0 | replaceImage(newImage); |
3556 | 0 | ThrowImageException; |
3557 | 0 | } |
3558 | | |
3559 | | void Magick::Image::magnify(void) |
3560 | 0 | { |
3561 | 0 | MagickCore::Image |
3562 | 0 | *newImage; |
3563 | |
|
3564 | 0 | GetPPException; |
3565 | 0 | newImage=MagnifyImage(constImage(),exceptionInfo); |
3566 | 0 | replaceImage(newImage); |
3567 | 0 | ThrowImageException; |
3568 | 0 | } |
3569 | | |
3570 | | void Magick::Image::map(const Image &mapImage_,const bool dither_) |
3571 | 0 | { |
3572 | 0 | map(mapImage_, dither_ ? RiemersmaDitherMethod : NoDitherMethod); |
3573 | 0 | } |
3574 | | |
3575 | | void Magick::Image::map(const Image &mapImage_,const DitherMethod ditherMethod_) |
3576 | 0 | { |
3577 | 0 | modifyImage(); |
3578 | 0 | GetPPException; |
3579 | 0 | options()->quantizeDither(ditherMethod_); |
3580 | 0 | RemapImage(options()->quantizeInfo(),image(),mapImage_.constImage(), |
3581 | 0 | exceptionInfo); |
3582 | 0 | ThrowImageException; |
3583 | 0 | } |
3584 | | |
3585 | | void Magick::Image::meanShift(const size_t width_,const size_t height_, |
3586 | | const double color_distance_) |
3587 | 0 | { |
3588 | 0 | MagickCore::Image |
3589 | 0 | *newImage; |
3590 | |
|
3591 | 0 | GetPPException; |
3592 | 0 | newImage=MeanShiftImage(constImage(),width_,height_,color_distance_, |
3593 | 0 | exceptionInfo); |
3594 | 0 | replaceImage(newImage); |
3595 | 0 | ThrowImageException; |
3596 | 0 | } |
3597 | | |
3598 | | void Magick::Image::medianFilter(const double radius_) |
3599 | 0 | { |
3600 | 0 | MagickCore::Image |
3601 | 0 | *newImage; |
3602 | |
|
3603 | 0 | GetPPException; |
3604 | 0 | newImage=StatisticImage(image(),MedianStatistic,(size_t) radius_, |
3605 | 0 | (size_t) radius_,exceptionInfo); |
3606 | 0 | replaceImage(newImage); |
3607 | 0 | ThrowImageException; |
3608 | 0 | } |
3609 | | |
3610 | | void Magick::Image::minify(void) |
3611 | 0 | { |
3612 | 0 | MagickCore::Image |
3613 | 0 | *newImage; |
3614 | |
|
3615 | 0 | GetPPException; |
3616 | 0 | newImage=MinifyImage(constImage(),exceptionInfo); |
3617 | 0 | replaceImage(newImage); |
3618 | 0 | ThrowImageException; |
3619 | 0 | } |
3620 | | |
3621 | | void Magick::Image::modulate(const double brightness_,const double saturation_, |
3622 | | const double hue_) |
3623 | 0 | { |
3624 | 0 | char |
3625 | 0 | modulate[MagickPathExtent + 1]; |
3626 | |
|
3627 | 0 | FormatLocaleString(modulate,MagickPathExtent,"%3.6f,%3.6f,%3.6f",brightness_, |
3628 | 0 | saturation_,hue_); |
3629 | |
|
3630 | 0 | modifyImage(); |
3631 | 0 | GetPPException; |
3632 | 0 | ModulateImage(image(),modulate,exceptionInfo); |
3633 | 0 | ThrowImageException; |
3634 | 0 | } |
3635 | | |
3636 | | Magick::ImageMoments Magick::Image::moments(void) const |
3637 | 0 | { |
3638 | 0 | return(ImageMoments(*this)); |
3639 | 0 | } |
3640 | | |
3641 | | void Magick::Image::morphology(const MorphologyMethod method_, |
3642 | | const std::string kernel_,const ssize_t iterations_) |
3643 | 0 | { |
3644 | 0 | KernelInfo |
3645 | 0 | *kernel; |
3646 | |
|
3647 | 0 | MagickCore::Image |
3648 | 0 | *newImage; |
3649 | |
|
3650 | 0 | GetPPException; |
3651 | 0 | kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo); |
3652 | 0 | if (kernel == (KernelInfo *) NULL) |
3653 | 0 | throwExceptionExplicit(MagickCore::OptionError,"Unable to parse kernel."); |
3654 | 0 | newImage=MorphologyImage(constImage(),method_,iterations_,kernel, |
3655 | 0 | exceptionInfo); |
3656 | 0 | replaceImage(newImage); |
3657 | 0 | kernel=DestroyKernelInfo(kernel); |
3658 | 0 | ThrowImageException; |
3659 | 0 | } |
3660 | | |
3661 | | void Magick::Image::morphology(const MorphologyMethod method_, |
3662 | | const KernelInfoType kernel_,const std::string arguments_, |
3663 | | const ssize_t iterations_) |
3664 | 0 | { |
3665 | 0 | const char |
3666 | 0 | *option; |
3667 | |
|
3668 | 0 | std::string |
3669 | 0 | kernel; |
3670 | |
|
3671 | 0 | option=CommandOptionToMnemonic(MagickKernelOptions,kernel_); |
3672 | 0 | if (option == (const char *)NULL) |
3673 | 0 | { |
3674 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
3675 | 0 | "Unable to determine kernel type."); |
3676 | 0 | return; |
3677 | 0 | } |
3678 | 0 | kernel=std::string(option); |
3679 | 0 | if (!arguments_.empty()) |
3680 | 0 | kernel+=":"+arguments_; |
3681 | |
|
3682 | 0 | morphology(method_,kernel,iterations_); |
3683 | 0 | } |
3684 | | |
3685 | | void Magick::Image::morphologyChannel(const ChannelType channel_, |
3686 | | const MorphologyMethod method_,const std::string kernel_, |
3687 | | const ssize_t iterations_) |
3688 | 0 | { |
3689 | 0 | KernelInfo |
3690 | 0 | *kernel; |
3691 | |
|
3692 | 0 | MagickCore::Image |
3693 | 0 | *newImage; |
3694 | | |
3695 | |
|
3696 | 0 | GetPPException; |
3697 | 0 | kernel=AcquireKernelInfo(kernel_.c_str(),exceptionInfo); |
3698 | 0 | if (kernel == (KernelInfo *)NULL) |
3699 | 0 | { |
3700 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
3701 | 0 | "Unable to parse kernel."); |
3702 | 0 | return; |
3703 | 0 | } |
3704 | 0 | GetAndSetPPChannelMask(channel_); |
3705 | 0 | newImage=MorphologyImage(constImage(),method_,iterations_,kernel, |
3706 | 0 | exceptionInfo); |
3707 | 0 | RestorePPChannelMask; |
3708 | 0 | replaceImage(newImage); |
3709 | 0 | kernel=DestroyKernelInfo(kernel); |
3710 | 0 | ThrowImageException; |
3711 | 0 | } |
3712 | | |
3713 | | void Magick::Image::morphologyChannel(const ChannelType channel_, |
3714 | | const MorphologyMethod method_,const KernelInfoType kernel_, |
3715 | | const std::string arguments_,const ssize_t iterations_) |
3716 | 0 | { |
3717 | 0 | const char |
3718 | 0 | *option; |
3719 | |
|
3720 | 0 | std::string |
3721 | 0 | kernel; |
3722 | |
|
3723 | 0 | option=CommandOptionToMnemonic(MagickKernelOptions,kernel_); |
3724 | 0 | if (option == (const char *)NULL) |
3725 | 0 | { |
3726 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
3727 | 0 | "Unable to determine kernel type."); |
3728 | 0 | return; |
3729 | 0 | } |
3730 | | |
3731 | 0 | kernel=std::string(option); |
3732 | 0 | if (!arguments_.empty()) |
3733 | 0 | kernel+=":"+arguments_; |
3734 | |
|
3735 | 0 | morphologyChannel(channel_,method_,kernel,iterations_); |
3736 | 0 | } |
3737 | | |
3738 | | void Magick::Image::motionBlur(const double radius_,const double sigma_, |
3739 | | const double angle_) |
3740 | 0 | { |
3741 | 0 | MagickCore::Image |
3742 | 0 | *newImage; |
3743 | |
|
3744 | 0 | GetPPException; |
3745 | 0 | newImage=MotionBlurImage(constImage(),radius_,sigma_,angle_,exceptionInfo); |
3746 | 0 | replaceImage(newImage); |
3747 | 0 | ThrowImageException; |
3748 | 0 | } |
3749 | | |
3750 | | void Magick::Image::negate(const bool grayscale_) |
3751 | 0 | { |
3752 | 0 | modifyImage(); |
3753 | 0 | GetPPException; |
3754 | 0 | NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo); |
3755 | 0 | ThrowImageException; |
3756 | 0 | } |
3757 | | |
3758 | | void Magick::Image::negateChannel(const ChannelType channel_, |
3759 | | const bool grayscale_) |
3760 | 0 | { |
3761 | 0 | modifyImage(); |
3762 | 0 | GetPPException; |
3763 | 0 | GetAndSetPPChannelMask(channel_); |
3764 | 0 | NegateImage(image(),(MagickBooleanType) grayscale_,exceptionInfo); |
3765 | 0 | RestorePPChannelMask; |
3766 | 0 | ThrowImageException; |
3767 | 0 | } |
3768 | | |
3769 | | void Magick::Image::normalize(void) |
3770 | 0 | { |
3771 | 0 | modifyImage(); |
3772 | 0 | GetPPException; |
3773 | 0 | NormalizeImage(image(),exceptionInfo); |
3774 | 0 | ThrowImageException; |
3775 | 0 | } |
3776 | | |
3777 | | void Magick::Image::oilPaint(const double radius_,const double sigma_) |
3778 | 0 | { |
3779 | 0 | MagickCore::Image |
3780 | 0 | *newImage; |
3781 | |
|
3782 | 0 | GetPPException; |
3783 | 0 | newImage=OilPaintImage(constImage(),radius_,sigma_,exceptionInfo); |
3784 | 0 | replaceImage(newImage); |
3785 | 0 | ThrowImageException; |
3786 | 0 | } |
3787 | | |
3788 | | void Magick::Image::opaque(const Color &opaqueColor_,const Color &penColor_, |
3789 | | const bool invert_) |
3790 | 0 | { |
3791 | 0 | std::string |
3792 | 0 | opaqueColor, |
3793 | 0 | penColor; |
3794 | |
|
3795 | 0 | PixelInfo |
3796 | 0 | opaque, |
3797 | 0 | pen; |
3798 | |
|
3799 | 0 | if (!opaqueColor_.isValid()) |
3800 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
3801 | 0 | "Opaque color argument is invalid"); |
3802 | |
|
3803 | 0 | if (!penColor_.isValid()) |
3804 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
3805 | 0 | "Pen color argument is invalid"); |
3806 | |
|
3807 | 0 | modifyImage(); |
3808 | 0 | opaqueColor=opaqueColor_; |
3809 | 0 | penColor=penColor_; |
3810 | |
|
3811 | 0 | GetPPException; |
3812 | 0 | (void) QueryColorCompliance(opaqueColor.c_str(),AllCompliance,&opaque, |
3813 | 0 | exceptionInfo); |
3814 | 0 | (void) QueryColorCompliance(penColor.c_str(),AllCompliance,&pen, |
3815 | 0 | exceptionInfo); |
3816 | 0 | OpaquePaintImage(image(),&opaque,&pen,invert_ ? MagickTrue : MagickFalse, |
3817 | 0 | exceptionInfo); |
3818 | 0 | ThrowImageException; |
3819 | 0 | } |
3820 | | |
3821 | | void Magick::Image::orderedDither(std::string thresholdMap_) |
3822 | 0 | { |
3823 | 0 | modifyImage(); |
3824 | 0 | GetPPException; |
3825 | 0 | (void) OrderedDitherImage(image(),thresholdMap_.c_str(),exceptionInfo); |
3826 | 0 | ThrowImageException; |
3827 | 0 | } |
3828 | | |
3829 | | void Magick::Image::orderedDitherChannel(const ChannelType channel_, |
3830 | | std::string thresholdMap_) |
3831 | 0 | { |
3832 | 0 | modifyImage(); |
3833 | 0 | GetPPException; |
3834 | 0 | GetAndSetPPChannelMask(channel_); |
3835 | 0 | (void)OrderedDitherImage(image(),thresholdMap_.c_str(),exceptionInfo); |
3836 | 0 | RestorePPChannelMask; |
3837 | 0 | ThrowImageException; |
3838 | 0 | } |
3839 | | |
3840 | | void Magick::Image::perceptible(const double epsilon_) |
3841 | 0 | { |
3842 | 0 | modifyImage(); |
3843 | 0 | GetPPException; |
3844 | 0 | PerceptibleImage(image(),epsilon_,exceptionInfo); |
3845 | 0 | ThrowImageException; |
3846 | 0 | } |
3847 | | |
3848 | | void Magick::Image::perceptibleChannel(const ChannelType channel_, |
3849 | | const double epsilon_) |
3850 | 0 | { |
3851 | 0 | modifyImage(); |
3852 | 0 | GetPPException; |
3853 | 0 | GetAndSetPPChannelMask(channel_); |
3854 | 0 | PerceptibleImage(image(),epsilon_,exceptionInfo); |
3855 | 0 | RestorePPChannelMask; |
3856 | 0 | ThrowImageException; |
3857 | 0 | } |
3858 | | |
3859 | | Magick::ImagePerceptualHash Magick::Image::perceptualHash() const |
3860 | 0 | { |
3861 | 0 | return(ImagePerceptualHash(*this)); |
3862 | 0 | } |
3863 | | |
3864 | | void Magick::Image::ping(const std::string &imageSpec_) |
3865 | 0 | { |
3866 | 0 | MagickCore::Image |
3867 | 0 | *newImage; |
3868 | |
|
3869 | 0 | GetPPException; |
3870 | 0 | options()->fileName(imageSpec_); |
3871 | 0 | newImage=PingImage(imageInfo(),exceptionInfo); |
3872 | 0 | read(newImage,exceptionInfo); |
3873 | 0 | } |
3874 | | |
3875 | | void Magick::Image::ping(const Blob& blob_) |
3876 | 30.3k | { |
3877 | 30.3k | MagickCore::Image |
3878 | 30.3k | *newImage; |
3879 | | |
3880 | 30.3k | GetPPException; |
3881 | 30.3k | newImage=PingBlob(imageInfo(),blob_.data(),blob_.length(),exceptionInfo); |
3882 | 30.3k | read(newImage,exceptionInfo); |
3883 | 30.3k | } |
3884 | | |
3885 | | void Magick::Image::pixelColor(const ssize_t x_,const ssize_t y_, |
3886 | | const Color &color_) |
3887 | 0 | { |
3888 | 0 | PixelInfo |
3889 | 0 | packet; |
3890 | |
|
3891 | 0 | Quantum |
3892 | 0 | *pixel; |
3893 | | |
3894 | | // Test arguments to ensure they are within the image. |
3895 | 0 | if (y_ > (ssize_t) rows() || x_ > (ssize_t) columns()) |
3896 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
3897 | 0 | "Access outside of image boundary"); |
3898 | |
|
3899 | 0 | modifyImage(); |
3900 | | |
3901 | | // Set image to DirectClass |
3902 | 0 | classType(DirectClass ); |
3903 | | |
3904 | | // Get pixel view |
3905 | 0 | Pixels pixels(*this); |
3906 | | // Set pixel value |
3907 | 0 | pixel=pixels.get(x_, y_, 1, 1 ); |
3908 | 0 | packet=color_; |
3909 | 0 | MagickCore::SetPixelViaPixelInfo(constImage(),&packet,pixel); |
3910 | | // Tell ImageMagick that pixels have been updated |
3911 | 0 | pixels.sync(); |
3912 | 0 | } |
3913 | | |
3914 | | Magick::Color Magick::Image::pixelColor(const ssize_t x_, |
3915 | | const ssize_t y_) const |
3916 | 0 | { |
3917 | 0 | const Quantum |
3918 | 0 | *pixel; |
3919 | |
|
3920 | 0 | pixel=getConstPixels(x_,y_,1,1); |
3921 | 0 | if (pixel) |
3922 | 0 | { |
3923 | 0 | PixelInfo |
3924 | 0 | packet; |
3925 | |
|
3926 | 0 | MagickCore::GetPixelInfoPixel(constImage(),pixel,&packet); |
3927 | 0 | return(Color(packet)); |
3928 | 0 | } |
3929 | | |
3930 | 0 | return(Color()); // invalid |
3931 | 0 | } |
3932 | | |
3933 | | void Magick::Image::polaroid(const std::string &caption_,const double angle_, |
3934 | | const PixelInterpolateMethod method_) |
3935 | 0 | { |
3936 | 0 | MagickCore::Image |
3937 | 0 | *newImage; |
3938 | |
|
3939 | 0 | GetPPException; |
3940 | 0 | newImage=PolaroidImage(constImage(),options()->drawInfo(),caption_.c_str(), |
3941 | 0 | angle_,method_,exceptionInfo); |
3942 | 0 | replaceImage(newImage); |
3943 | 0 | ThrowImageException; |
3944 | 0 | } |
3945 | | |
3946 | | void Magick::Image::posterize(const size_t levels_,const DitherMethod method_) |
3947 | 0 | { |
3948 | 0 | modifyImage(); |
3949 | 0 | GetPPException; |
3950 | 0 | PosterizeImage(image(),levels_,method_,exceptionInfo); |
3951 | 0 | ThrowImageException; |
3952 | 0 | } |
3953 | | |
3954 | | void Magick::Image::posterizeChannel(const ChannelType channel_, |
3955 | | const size_t levels_,const DitherMethod method_) |
3956 | 0 | { |
3957 | 0 | modifyImage(); |
3958 | 0 | GetPPException; |
3959 | 0 | GetAndSetPPChannelMask(channel_); |
3960 | 0 | PosterizeImage(image(),levels_,method_,exceptionInfo); |
3961 | 0 | RestorePPChannelMask; |
3962 | 0 | ThrowImageException; |
3963 | 0 | } |
3964 | | |
3965 | | void Magick::Image::process(std::string name_,const ssize_t argc, |
3966 | | const char **argv) |
3967 | 0 | { |
3968 | 0 | modifyImage(); |
3969 | |
|
3970 | 0 | GetPPException; |
3971 | 0 | (void) InvokeDynamicImageFilter(name_.c_str(),&image(),(int) argc,argv, |
3972 | 0 | exceptionInfo); |
3973 | 0 | ThrowImageException; |
3974 | 0 | } |
3975 | | |
3976 | | void Magick::Image::profile(const std::string name_, |
3977 | | const Magick::Blob &profile_) |
3978 | 0 | { |
3979 | 0 | modifyImage(); |
3980 | 0 | GetPPException; |
3981 | 0 | (void) ProfileImage(image(),name_.c_str(),(unsigned char *)profile_.data(), |
3982 | 0 | profile_.length(),exceptionInfo); |
3983 | 0 | ThrowImageException; |
3984 | 0 | } |
3985 | | |
3986 | | Magick::Blob Magick::Image::profile(const std::string name_) const |
3987 | 0 | { |
3988 | 0 | const StringInfo |
3989 | 0 | *profile; |
3990 | |
|
3991 | 0 | profile=GetImageProfile(constImage(),name_.c_str()); |
3992 | |
|
3993 | 0 | if (profile == (StringInfo *) NULL) |
3994 | 0 | return(Blob()); |
3995 | 0 | return(Blob((void*) GetStringInfoDatum(profile),GetStringInfoLength( |
3996 | 0 | profile))); |
3997 | 0 | } |
3998 | | |
3999 | | void Magick::Image::quantize(const bool measureError_) |
4000 | 0 | { |
4001 | 0 | modifyImage(); |
4002 | | |
4003 | 0 | if (measureError_) |
4004 | 0 | options()->quantizeInfo()->measure_error=MagickTrue; |
4005 | 0 | else |
4006 | 0 | options()->quantizeInfo()->measure_error=MagickFalse; |
4007 | |
|
4008 | 0 | GetPPException; |
4009 | 0 | QuantizeImage(options()->quantizeInfo(),image(),exceptionInfo); |
4010 | 0 | ThrowImageException; |
4011 | 0 | } |
4012 | | |
4013 | | void Magick::Image::raise(const Geometry &geometry_,const bool raisedFlag_) |
4014 | 0 | { |
4015 | 0 | RectangleInfo |
4016 | 0 | raiseInfo=geometry_; |
4017 | |
|
4018 | 0 | GetPPException; |
4019 | 0 | modifyImage(); |
4020 | 0 | RaiseImage(image(),&raiseInfo,raisedFlag_ == true ? MagickTrue : MagickFalse, |
4021 | 0 | exceptionInfo); |
4022 | 0 | ThrowImageException; |
4023 | 0 | } |
4024 | | |
4025 | | void Magick::Image::randomThreshold(const double low_,const double high_) |
4026 | 0 | { |
4027 | 0 | GetPPException; |
4028 | 0 | (void) RandomThresholdImage(image(),low_,high_,exceptionInfo); |
4029 | 0 | ThrowImageException; |
4030 | 0 | } |
4031 | | |
4032 | | void Magick::Image::randomThresholdChannel(const ChannelType channel_, |
4033 | | const double low_,const double high_) |
4034 | 0 | { |
4035 | 0 | modifyImage(); |
4036 | 0 | GetPPException; |
4037 | 0 | GetAndSetPPChannelMask(channel_); |
4038 | 0 | (void) RandomThresholdImage(image(),low_,high_,exceptionInfo); |
4039 | 0 | RestorePPChannelMask; |
4040 | 0 | ThrowImageException; |
4041 | 0 | } |
4042 | | |
4043 | | void Magick::Image::read(const Blob &blob_) |
4044 | 547k | { |
4045 | 547k | MagickCore::Image |
4046 | 547k | *newImage; |
4047 | | |
4048 | 547k | GetPPException; |
4049 | 547k | newImage=BlobToImage(imageInfo(),static_cast<const void *>(blob_.data()), |
4050 | 547k | blob_.length(),exceptionInfo); |
4051 | 547k | read(newImage,exceptionInfo); |
4052 | 547k | } |
4053 | | |
4054 | | void Magick::Image::read(const Blob &blob_,const Geometry &size_) |
4055 | 0 | { |
4056 | 0 | size(size_); |
4057 | 0 | read(blob_); |
4058 | 0 | } |
4059 | | |
4060 | | void Magick::Image::read(const Blob &blob_,const Geometry &size_, |
4061 | | const size_t depth_) |
4062 | 0 | { |
4063 | 0 | size(size_); |
4064 | 0 | depth(depth_); |
4065 | 0 | read(blob_); |
4066 | 0 | } |
4067 | | |
4068 | | void Magick::Image::read(const Blob &blob_,const Geometry &size_, |
4069 | | const size_t depth_,const std::string &magick_) |
4070 | 0 | { |
4071 | 0 | size(size_); |
4072 | 0 | depth(depth_); |
4073 | 0 | magick(magick_); |
4074 | | // Set explicit image format |
4075 | 0 | fileName(magick_ + ':'); |
4076 | 0 | read(blob_); |
4077 | 0 | } |
4078 | | |
4079 | | void Magick::Image::read(const Blob &blob_,const Geometry &size_, |
4080 | | const std::string &magick_) |
4081 | 0 | { |
4082 | 0 | size(size_); |
4083 | 0 | magick(magick_); |
4084 | | // Set explicit image format |
4085 | 0 | fileName(magick_ + ':'); |
4086 | 0 | read(blob_); |
4087 | 0 | } |
4088 | | |
4089 | | void Magick::Image::read(const Geometry &size_,const std::string &imageSpec_) |
4090 | 0 | { |
4091 | 0 | size(size_); |
4092 | 0 | read(imageSpec_); |
4093 | 0 | } |
4094 | | |
4095 | | void Magick::Image::read(const size_t width_,const size_t height_, |
4096 | | const std::string &map_,const StorageType type_,const void *pixels_) |
4097 | 0 | { |
4098 | 0 | MagickCore::Image |
4099 | 0 | *newImage; |
4100 | |
|
4101 | 0 | GetPPException; |
4102 | 0 | newImage=ConstituteImage(width_,height_,map_.c_str(),type_, pixels_, |
4103 | 0 | exceptionInfo); |
4104 | 0 | replaceImage(newImage); |
4105 | 0 | ThrowImageException; |
4106 | 0 | } |
4107 | | |
4108 | | void Magick::Image::read(const std::string &imageSpec_) |
4109 | 27.8k | { |
4110 | 27.8k | MagickCore::Image |
4111 | 27.8k | *newImage; |
4112 | | |
4113 | 27.8k | GetPPException; |
4114 | 27.8k | options()->fileName(imageSpec_); |
4115 | 27.8k | newImage=ReadImage(imageInfo(),exceptionInfo); |
4116 | 27.8k | read(newImage,exceptionInfo); |
4117 | 27.8k | } |
4118 | | |
4119 | | void Magick::Image::readMask(const Magick::Image &mask_) |
4120 | 0 | { |
4121 | 0 | mask(mask_,ReadPixelMask); |
4122 | 0 | } |
4123 | | |
4124 | | Magick::Image Magick::Image::readMask(void) const |
4125 | 0 | { |
4126 | 0 | return(mask(ReadPixelMask)); |
4127 | 0 | } |
4128 | | |
4129 | | void Magick::Image::readPixels(const Magick::QuantumType quantum_, |
4130 | | const unsigned char *source_) |
4131 | 0 | { |
4132 | 0 | QuantumInfo |
4133 | 0 | *quantum_info; |
4134 | |
|
4135 | 0 | quantum_info=AcquireQuantumInfo(imageInfo(),image()); |
4136 | 0 | GetPPException; |
4137 | 0 | ImportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info, |
4138 | 0 | quantum_,source_,exceptionInfo); |
4139 | 0 | quantum_info=DestroyQuantumInfo(quantum_info); |
4140 | 0 | ThrowImageException; |
4141 | 0 | } |
4142 | | |
4143 | | void Magick::Image::reduceNoise(void) |
4144 | 0 | { |
4145 | 0 | reduceNoise(3); |
4146 | 0 | } |
4147 | | |
4148 | | void Magick::Image::reduceNoise(const size_t order_) |
4149 | 0 | { |
4150 | 0 | MagickCore::Image |
4151 | 0 | *newImage; |
4152 | |
|
4153 | 0 | GetPPException; |
4154 | 0 | newImage=StatisticImage(constImage(),NonpeakStatistic,order_, |
4155 | 0 | order_,exceptionInfo); |
4156 | 0 | replaceImage(newImage); |
4157 | 0 | ThrowImageException; |
4158 | 0 | } |
4159 | | |
4160 | | void Magick::Image::repage() |
4161 | 0 | { |
4162 | 0 | modifyImage(); |
4163 | 0 | options()->page(Geometry()); |
4164 | 0 | image()->page.width = 0; |
4165 | 0 | image()->page.height = 0; |
4166 | 0 | image()->page.x = 0; |
4167 | 0 | image()->page.y = 0; |
4168 | 0 | } |
4169 | | |
4170 | | void Magick::Image::resample(const Point &density_) |
4171 | 0 | { |
4172 | 0 | MagickCore::Image |
4173 | 0 | *newImage; |
4174 | |
|
4175 | 0 | GetPPException; |
4176 | 0 | newImage=ResampleImage(constImage(),density_.x(),density_.y(), |
4177 | 0 | image()->filter,exceptionInfo); |
4178 | 0 | replaceImage(newImage); |
4179 | 0 | ThrowImageException; |
4180 | 0 | } |
4181 | | |
4182 | | void Magick::Image::resize(const Geometry &geometry_) |
4183 | 0 | { |
4184 | 0 | MagickCore::Image |
4185 | 0 | *newImage; |
4186 | |
|
4187 | 0 | size_t |
4188 | 0 | height=rows(), |
4189 | 0 | width=columns(); |
4190 | |
|
4191 | 0 | ssize_t |
4192 | 0 | x=0, |
4193 | 0 | y=0; |
4194 | | |
4195 | | // Calculate new size. This code should be supported using binary arguments |
4196 | | // in the ImageMagick library. |
4197 | 0 | ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width, |
4198 | 0 | &height); |
4199 | |
|
4200 | 0 | GetPPException; |
4201 | 0 | newImage=ResizeImage(constImage(),width,height,image()->filter, |
4202 | 0 | exceptionInfo); |
4203 | 0 | replaceImage(newImage); |
4204 | 0 | ThrowImageException; |
4205 | 0 | } |
4206 | | |
4207 | | void Magick::Image::roll(const Geometry &roll_) |
4208 | 0 | { |
4209 | 0 | MagickCore::Image |
4210 | 0 | *newImage; |
4211 | |
|
4212 | 0 | GetPPException; |
4213 | 0 | newImage=RollImage(constImage(),roll_.xOff(),roll_.yOff(),exceptionInfo); |
4214 | 0 | replaceImage(newImage); |
4215 | 0 | ThrowImageException; |
4216 | 0 | } |
4217 | | |
4218 | | void Magick::Image::roll(const ssize_t columns_,const ssize_t rows_) |
4219 | 0 | { |
4220 | 0 | MagickCore::Image |
4221 | 0 | *newImage; |
4222 | |
|
4223 | 0 | GetPPException; |
4224 | 0 | newImage=RollImage(constImage(),columns_, rows_,exceptionInfo); |
4225 | 0 | replaceImage(newImage); |
4226 | 0 | ThrowImageException; |
4227 | 0 | } |
4228 | | |
4229 | | void Magick::Image::rotate(const double degrees_) |
4230 | 0 | { |
4231 | 0 | MagickCore::Image |
4232 | 0 | *newImage; |
4233 | |
|
4234 | 0 | GetPPException; |
4235 | 0 | newImage=RotateImage(constImage(),degrees_,exceptionInfo); |
4236 | 0 | replaceImage(newImage); |
4237 | 0 | ThrowImageException; |
4238 | 0 | } |
4239 | | |
4240 | | void Magick::Image::rotationalBlur(const double angle_) |
4241 | 0 | { |
4242 | 0 | MagickCore::Image |
4243 | 0 | *newImage; |
4244 | |
|
4245 | 0 | GetPPException; |
4246 | 0 | newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo); |
4247 | 0 | replaceImage(newImage); |
4248 | 0 | ThrowImageException; |
4249 | 0 | } |
4250 | | |
4251 | | void Magick::Image::rotationalBlurChannel(const ChannelType channel_, |
4252 | | const double angle_) |
4253 | 0 | { |
4254 | 0 | MagickCore::Image |
4255 | 0 | *newImage; |
4256 | |
|
4257 | 0 | GetPPException; |
4258 | 0 | GetAndSetPPChannelMask(channel_); |
4259 | 0 | newImage=RotationalBlurImage(constImage(),angle_,exceptionInfo); |
4260 | 0 | RestorePPChannelMask; |
4261 | 0 | replaceImage(newImage); |
4262 | 0 | ThrowImageException; |
4263 | 0 | } |
4264 | | |
4265 | | void Magick::Image::sample(const Geometry &geometry_) |
4266 | 0 | { |
4267 | 0 | MagickCore::Image |
4268 | 0 | *newImage; |
4269 | |
|
4270 | 0 | size_t |
4271 | 0 | height=rows(), |
4272 | 0 | width=columns(); |
4273 | |
|
4274 | 0 | ssize_t |
4275 | 0 | x=0, |
4276 | 0 | y=0; |
4277 | |
|
4278 | 0 | ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width, |
4279 | 0 | &height); |
4280 | |
|
4281 | 0 | GetPPException; |
4282 | 0 | newImage=SampleImage(constImage(),width,height,exceptionInfo); |
4283 | 0 | replaceImage(newImage); |
4284 | 0 | ThrowImageException; |
4285 | 0 | } |
4286 | | |
4287 | | void Magick::Image::scale(const Geometry &geometry_) |
4288 | 0 | { |
4289 | 0 | MagickCore::Image |
4290 | 0 | *newImage; |
4291 | |
|
4292 | 0 | size_t |
4293 | 0 | height=rows(), |
4294 | 0 | width=columns(); |
4295 | |
|
4296 | 0 | ssize_t |
4297 | 0 | x=0, |
4298 | 0 | y=0; |
4299 | |
|
4300 | 0 | ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width, |
4301 | 0 | &height); |
4302 | |
|
4303 | 0 | GetPPException; |
4304 | 0 | newImage=ScaleImage(constImage(),width,height,exceptionInfo); |
4305 | 0 | replaceImage(newImage); |
4306 | 0 | ThrowImageException; |
4307 | 0 | } |
4308 | | |
4309 | | void Magick::Image::segment(const double clusterThreshold_, |
4310 | | const double smoothingThreshold_) |
4311 | 0 | { |
4312 | 0 | modifyImage(); |
4313 | 0 | GetPPException; |
4314 | 0 | SegmentImage(image(),options()->quantizeColorSpace(), |
4315 | 0 | (MagickBooleanType) options()->verbose(),clusterThreshold_, |
4316 | 0 | smoothingThreshold_,exceptionInfo); |
4317 | 0 | SyncImage(image(),exceptionInfo); |
4318 | 0 | ThrowImageException; |
4319 | 0 | } |
4320 | | |
4321 | | void Magick::Image::selectiveBlur(const double radius_,const double sigma_, |
4322 | | const double threshold_) |
4323 | 0 | { |
4324 | 0 | MagickCore::Image |
4325 | 0 | *newImage; |
4326 | |
|
4327 | 0 | GetPPException; |
4328 | 0 | newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_, |
4329 | 0 | exceptionInfo); |
4330 | 0 | replaceImage(newImage); |
4331 | 0 | ThrowImageException; |
4332 | 0 | } |
4333 | | |
4334 | | void Magick::Image::selectiveBlurChannel(const ChannelType channel_, |
4335 | | const double radius_,const double sigma_,const double threshold_) |
4336 | 0 | { |
4337 | 0 | MagickCore::Image |
4338 | 0 | *newImage; |
4339 | |
|
4340 | 0 | GetPPException; |
4341 | 0 | GetAndSetPPChannelMask(channel_); |
4342 | 0 | newImage=SelectiveBlurImage(constImage(),radius_,sigma_,threshold_, |
4343 | 0 | exceptionInfo); |
4344 | 0 | RestorePPChannelMask; |
4345 | 0 | replaceImage(newImage); |
4346 | 0 | ThrowImageException; |
4347 | 0 | } |
4348 | | |
4349 | | Magick::Image Magick::Image::separate(const ChannelType channel_) const |
4350 | 0 | { |
4351 | 0 | MagickCore::Image |
4352 | 0 | *image; |
4353 | |
|
4354 | 0 | GetPPException; |
4355 | 0 | image=SeparateImage(constImage(),channel_,exceptionInfo); |
4356 | 0 | ThrowImageException; |
4357 | 0 | if (image == (MagickCore::Image *) NULL) |
4358 | 0 | return(Magick::Image()); |
4359 | 0 | else |
4360 | 0 | return(Magick::Image(image)); |
4361 | 0 | } |
4362 | | |
4363 | | void Magick::Image::sepiaTone(const double threshold_) |
4364 | 0 | { |
4365 | 0 | MagickCore::Image |
4366 | 0 | *newImage; |
4367 | |
|
4368 | 0 | GetPPException; |
4369 | 0 | newImage=SepiaToneImage(constImage(),threshold_,exceptionInfo); |
4370 | 0 | replaceImage(newImage); |
4371 | 0 | ThrowImageException; |
4372 | 0 | } |
4373 | | |
4374 | | bool Magick::Image::setColorMetric(const Image &reference_) |
4375 | 0 | { |
4376 | 0 | bool |
4377 | 0 | status; |
4378 | |
|
4379 | 0 | Image |
4380 | 0 | ref=reference_; |
4381 | |
|
4382 | 0 | GetPPException; |
4383 | 0 | modifyImage(); |
4384 | 0 | status=static_cast<bool>(SetImageColorMetric(image(),ref.constImage(), |
4385 | 0 | exceptionInfo)); |
4386 | 0 | ThrowImageException; |
4387 | 0 | return(status); |
4388 | 0 | } |
4389 | | |
4390 | | Magick::Quantum *Magick::Image::setPixels(const ssize_t x_,const ssize_t y_, |
4391 | | const size_t columns_,const size_t rows_) |
4392 | 0 | { |
4393 | 0 | Quantum |
4394 | 0 | *result; |
4395 | |
|
4396 | 0 | modifyImage(); |
4397 | 0 | GetPPException; |
4398 | 0 | result=QueueAuthenticPixels(image(),x_,y_,columns_,rows_,exceptionInfo); |
4399 | 0 | ThrowImageException; |
4400 | 0 | return(result); |
4401 | 0 | } |
4402 | | |
4403 | | void Magick::Image::shade(const double azimuth_,const double elevation_, |
4404 | | const bool colorShading_) |
4405 | 0 | { |
4406 | 0 | MagickCore::Image |
4407 | 0 | *newImage; |
4408 | |
|
4409 | 0 | GetPPException; |
4410 | 0 | newImage=ShadeImage(constImage(),colorShading_ == true ? |
4411 | 0 | MagickTrue : MagickFalse,azimuth_,elevation_,exceptionInfo); |
4412 | 0 | replaceImage(newImage); |
4413 | 0 | ThrowImageException; |
4414 | 0 | } |
4415 | | |
4416 | | void Magick::Image::shadow(const double percent_opacity_,const double sigma_, |
4417 | | const ssize_t x_,const ssize_t y_) |
4418 | 0 | { |
4419 | 0 | MagickCore::Image |
4420 | 0 | *newImage; |
4421 | |
|
4422 | 0 | GetPPException; |
4423 | 0 | newImage=ShadowImage(constImage(),percent_opacity_, sigma_,x_, y_, |
4424 | 0 | exceptionInfo); |
4425 | 0 | replaceImage(newImage); |
4426 | 0 | ThrowImageException; |
4427 | 0 | } |
4428 | | |
4429 | | void Magick::Image::sharpen(const double radius_,const double sigma_) |
4430 | 0 | { |
4431 | 0 | MagickCore::Image |
4432 | 0 | *newImage; |
4433 | |
|
4434 | 0 | GetPPException; |
4435 | 0 | newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo); |
4436 | 0 | replaceImage(newImage); |
4437 | 0 | ThrowImageException; |
4438 | 0 | } |
4439 | | |
4440 | | void Magick::Image::sharpenChannel(const ChannelType channel_, |
4441 | | const double radius_,const double sigma_) |
4442 | 0 | { |
4443 | 0 | MagickCore::Image |
4444 | 0 | *newImage; |
4445 | |
|
4446 | 0 | GetPPException; |
4447 | 0 | GetAndSetPPChannelMask(channel_); |
4448 | 0 | newImage=SharpenImage(constImage(),radius_,sigma_,exceptionInfo); |
4449 | 0 | RestorePPChannelMask; |
4450 | 0 | replaceImage(newImage); |
4451 | 0 | ThrowImageException; |
4452 | 0 | } |
4453 | | |
4454 | | void Magick::Image::shave(const Geometry &geometry_) |
4455 | 0 | { |
4456 | 0 | MagickCore::Image |
4457 | 0 | *newImage; |
4458 | |
|
4459 | 0 | RectangleInfo |
4460 | 0 | shaveInfo=geometry_; |
4461 | |
|
4462 | 0 | GetPPException; |
4463 | 0 | newImage=ShaveImage(constImage(),&shaveInfo,exceptionInfo); |
4464 | 0 | replaceImage(newImage); |
4465 | 0 | ThrowImageException; |
4466 | 0 | } |
4467 | | |
4468 | | void Magick::Image::shear(const double xShearAngle_,const double yShearAngle_) |
4469 | 0 | { |
4470 | 0 | MagickCore::Image |
4471 | 0 | *newImage; |
4472 | |
|
4473 | 0 | GetPPException; |
4474 | 0 | newImage=ShearImage(constImage(),xShearAngle_,yShearAngle_,exceptionInfo); |
4475 | 0 | replaceImage(newImage); |
4476 | 0 | ThrowImageException; |
4477 | 0 | } |
4478 | | |
4479 | | void Magick::Image::sigmoidalContrast(const bool sharpen_, |
4480 | | const double contrast,const double midpoint) |
4481 | 0 | { |
4482 | 0 | modifyImage(); |
4483 | 0 | GetPPException; |
4484 | 0 | (void) SigmoidalContrastImage(image(),(MagickBooleanType) sharpen_,contrast, |
4485 | 0 | midpoint,exceptionInfo); |
4486 | 0 | ThrowImageException; |
4487 | 0 | } |
4488 | | |
4489 | | std::string Magick::Image::signature(const bool force_) const |
4490 | 0 | { |
4491 | 0 | return(_imgRef->signature(force_)); |
4492 | 0 | } |
4493 | | |
4494 | | void Magick::Image::sketch(const double radius_,const double sigma_, |
4495 | | const double angle_) |
4496 | 0 | { |
4497 | 0 | MagickCore::Image |
4498 | 0 | *newImage; |
4499 | |
|
4500 | 0 | GetPPException; |
4501 | 0 | newImage=SketchImage(constImage(),radius_,sigma_,angle_,exceptionInfo); |
4502 | 0 | replaceImage(newImage); |
4503 | 0 | ThrowImageException; |
4504 | 0 | } |
4505 | | |
4506 | | void Magick::Image::solarize(const double factor_) |
4507 | 0 | { |
4508 | 0 | modifyImage(); |
4509 | 0 | GetPPException; |
4510 | 0 | SolarizeImage(image(),factor_,exceptionInfo); |
4511 | 0 | ThrowImageException; |
4512 | 0 | } |
4513 | | |
4514 | | void Magick::Image::sparseColor(const ChannelType channel_, |
4515 | | const SparseColorMethod method_,const size_t numberArguments_, |
4516 | | const double *arguments_) |
4517 | 0 | { |
4518 | 0 | MagickCore::Image |
4519 | 0 | *newImage; |
4520 | |
|
4521 | 0 | GetPPException; |
4522 | 0 | GetAndSetPPChannelMask(channel_); |
4523 | 0 | newImage=SparseColorImage(constImage(),method_,numberArguments_,arguments_, |
4524 | 0 | exceptionInfo); |
4525 | 0 | RestorePPChannelMask; |
4526 | 0 | replaceImage(newImage); |
4527 | 0 | ThrowImageException; |
4528 | 0 | } |
4529 | | |
4530 | | void Magick::Image::splice(const Geometry &geometry_) |
4531 | 0 | { |
4532 | 0 | MagickCore::Image |
4533 | 0 | *newImage; |
4534 | |
|
4535 | 0 | RectangleInfo |
4536 | 0 | spliceInfo=geometry_; |
4537 | |
|
4538 | 0 | GetPPException; |
4539 | 0 | newImage=SpliceImage(constImage(),&spliceInfo,exceptionInfo); |
4540 | 0 | replaceImage(newImage); |
4541 | 0 | ThrowImageException; |
4542 | 0 | } |
4543 | | |
4544 | | void Magick::Image::splice(const Geometry &geometry_, |
4545 | | const Color &backgroundColor_) |
4546 | 0 | { |
4547 | 0 | backgroundColor(backgroundColor_); |
4548 | 0 | splice(geometry_); |
4549 | 0 | } |
4550 | | |
4551 | | void Magick::Image::splice(const Geometry &geometry_, |
4552 | | const Color &backgroundColor_,const GravityType gravity_) |
4553 | 0 | { |
4554 | 0 | backgroundColor(backgroundColor_); |
4555 | 0 | image()->gravity=gravity_; |
4556 | 0 | splice(geometry_); |
4557 | 0 | } |
4558 | | |
4559 | | void Magick::Image::spread(const double amount_) |
4560 | 0 | { |
4561 | 0 | MagickCore::Image |
4562 | 0 | *newImage; |
4563 | |
|
4564 | 0 | GetPPException; |
4565 | 0 | newImage=SpreadImage(constImage(),image()->interpolate,amount_,exceptionInfo); |
4566 | 0 | replaceImage(newImage); |
4567 | 0 | ThrowImageException; |
4568 | 0 | } |
4569 | | |
4570 | | Magick::ImageStatistics Magick::Image::statistics() const |
4571 | 0 | { |
4572 | 0 | return(ImageStatistics(*this)); |
4573 | 0 | } |
4574 | | |
4575 | | void Magick::Image::stegano(const Image &watermark_) |
4576 | 0 | { |
4577 | 0 | MagickCore::Image |
4578 | 0 | *newImage; |
4579 | |
|
4580 | 0 | GetPPException; |
4581 | 0 | newImage=SteganoImage(constImage(),watermark_.constImage(),exceptionInfo); |
4582 | 0 | replaceImage(newImage); |
4583 | 0 | ThrowImageException; |
4584 | 0 | } |
4585 | | |
4586 | | void Magick::Image::stereo(const Image &rightImage_) |
4587 | 0 | { |
4588 | 0 | MagickCore::Image |
4589 | 0 | *newImage; |
4590 | |
|
4591 | 0 | GetPPException; |
4592 | 0 | newImage=StereoImage(constImage(),rightImage_.constImage(),exceptionInfo); |
4593 | 0 | replaceImage(newImage); |
4594 | 0 | ThrowImageException; |
4595 | 0 | } |
4596 | | |
4597 | | void Magick::Image::strip(void) |
4598 | 0 | { |
4599 | 0 | modifyImage(); |
4600 | 0 | GetPPException; |
4601 | 0 | StripImage(image(),exceptionInfo); |
4602 | 0 | ThrowImageException; |
4603 | 0 | } |
4604 | | |
4605 | | Magick::Image Magick::Image::subImageSearch(const Image &reference_, |
4606 | | const MetricType metric_,Geometry *offset_,double *similarityMetric_, |
4607 | | const double similarityThreshold) |
4608 | 0 | { |
4609 | 0 | MagickCore::Image |
4610 | 0 | *newImage; |
4611 | |
|
4612 | 0 | RectangleInfo |
4613 | 0 | offset; |
4614 | |
|
4615 | 0 | GetPPException; |
4616 | 0 | newImage=SimilarityImage(image(),reference_.constImage(),metric_, |
4617 | 0 | similarityThreshold,&offset,similarityMetric_,exceptionInfo); |
4618 | 0 | ThrowImageException; |
4619 | 0 | if (offset_ != (Geometry *) NULL) |
4620 | 0 | *offset_=offset; |
4621 | 0 | if (newImage == (MagickCore::Image *) NULL) |
4622 | 0 | return(Magick::Image()); |
4623 | 0 | else |
4624 | 0 | return(Magick::Image(newImage)); |
4625 | 0 | } |
4626 | | |
4627 | | void Magick::Image::swirl(const double degrees_) |
4628 | 0 | { |
4629 | 0 | MagickCore::Image |
4630 | 0 | *newImage; |
4631 | |
|
4632 | 0 | GetPPException; |
4633 | 0 | newImage=SwirlImage(constImage(),degrees_,image()->interpolate, |
4634 | 0 | exceptionInfo); |
4635 | 0 | replaceImage(newImage); |
4636 | 0 | ThrowImageException; |
4637 | 0 | } |
4638 | | |
4639 | | void Magick::Image::syncPixels(void) |
4640 | 0 | { |
4641 | 0 | GetPPException; |
4642 | 0 | (void) SyncAuthenticPixels(image(),exceptionInfo); |
4643 | 0 | ThrowImageException; |
4644 | 0 | } |
4645 | | |
4646 | | void Magick::Image::texture(const Image &texture_) |
4647 | 0 | { |
4648 | 0 | modifyImage(); |
4649 | 0 | GetPPException; |
4650 | 0 | TextureImage(image(),texture_.constImage(),exceptionInfo); |
4651 | 0 | ThrowImageException; |
4652 | 0 | } |
4653 | | |
4654 | | void Magick::Image::threshold(const double threshold_) |
4655 | 0 | { |
4656 | 0 | modifyImage(); |
4657 | 0 | GetPPException; |
4658 | 0 | BilevelImage(image(),threshold_,exceptionInfo); |
4659 | 0 | ThrowImageException; |
4660 | 0 | } |
4661 | | |
4662 | | void Magick::Image::thumbnail(const Geometry &geometry_) |
4663 | 0 | { |
4664 | 0 | MagickCore::Image |
4665 | 0 | *newImage; |
4666 | |
|
4667 | 0 | size_t |
4668 | 0 | height=rows(), |
4669 | 0 | width=columns(); |
4670 | |
|
4671 | 0 | ssize_t |
4672 | 0 | x=0, |
4673 | 0 | y=0; |
4674 | |
|
4675 | 0 | ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width, |
4676 | 0 | &height); |
4677 | |
|
4678 | 0 | GetPPException; |
4679 | 0 | newImage=ThumbnailImage(constImage(),width,height,exceptionInfo); |
4680 | 0 | replaceImage(newImage); |
4681 | 0 | ThrowImageException; |
4682 | 0 | } |
4683 | | |
4684 | | void Magick::Image::tint(const std::string opacity_) |
4685 | 0 | { |
4686 | 0 | MagickCore::Image |
4687 | 0 | *newImage; |
4688 | |
|
4689 | 0 | PixelInfo |
4690 | 0 | color; |
4691 | |
|
4692 | 0 | GetPPException; |
4693 | 0 | color=static_cast<PixelInfo>(constOptions()->fillColor()); |
4694 | 0 | newImage=TintImage(constImage(),opacity_.c_str(),&color,exceptionInfo); |
4695 | 0 | replaceImage(newImage); |
4696 | 0 | ThrowImageException; |
4697 | 0 | } |
4698 | | |
4699 | | void Magick::Image::transformOrigin(const double x_,const double y_) |
4700 | 0 | { |
4701 | 0 | modifyImage(); |
4702 | 0 | options()->transformOrigin(x_,y_); |
4703 | 0 | } |
4704 | | |
4705 | | void Magick::Image::transformReset(void) |
4706 | 0 | { |
4707 | 0 | modifyImage(); |
4708 | 0 | options()->transformReset(); |
4709 | 0 | } |
4710 | | |
4711 | | void Magick::Image::transformScale(const double sx_,const double sy_) |
4712 | 0 | { |
4713 | 0 | modifyImage(); |
4714 | 0 | options()->transformScale(sx_,sy_); |
4715 | 0 | } |
4716 | | |
4717 | | void Magick::Image::transparent(const Color &color_,const bool inverse_) |
4718 | 0 | { |
4719 | 0 | PixelInfo |
4720 | 0 | target; |
4721 | |
|
4722 | 0 | std::string |
4723 | 0 | color; |
4724 | |
|
4725 | 0 | if (!color_.isValid()) |
4726 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
4727 | 0 | "Color argument is invalid"); |
4728 | |
|
4729 | 0 | color=color_; |
4730 | 0 | GetPPException; |
4731 | 0 | (void) QueryColorCompliance(color.c_str(),AllCompliance,&target, |
4732 | 0 | exceptionInfo); |
4733 | 0 | modifyImage(); |
4734 | 0 | TransparentPaintImage(image(),&target,TransparentAlpha, |
4735 | 0 | inverse_ == true ? MagickTrue : MagickFalse,exceptionInfo); |
4736 | 0 | ThrowImageException; |
4737 | 0 | } |
4738 | | |
4739 | | void Magick::Image::transparentChroma(const Color &colorLow_, |
4740 | | const Color &colorHigh_) |
4741 | 0 | { |
4742 | 0 | std::string |
4743 | 0 | colorHigh, |
4744 | 0 | colorLow; |
4745 | |
|
4746 | 0 | PixelInfo |
4747 | 0 | targetHigh, |
4748 | 0 | targetLow; |
4749 | |
|
4750 | 0 | if (!colorLow_.isValid() || !colorHigh_.isValid()) |
4751 | 0 | throwExceptionExplicit(MagickCore::OptionError, |
4752 | 0 | "Color argument is invalid"); |
4753 | |
|
4754 | 0 | colorLow=colorLow_; |
4755 | 0 | colorHigh=colorHigh_; |
4756 | |
|
4757 | 0 | GetPPException; |
4758 | 0 | (void) QueryColorCompliance(colorLow.c_str(),AllCompliance,&targetLow, |
4759 | 0 | exceptionInfo); |
4760 | 0 | (void) QueryColorCompliance(colorHigh.c_str(),AllCompliance,&targetHigh, |
4761 | 0 | exceptionInfo); |
4762 | 0 | modifyImage(); |
4763 | 0 | TransparentPaintImageChroma(image(),&targetLow,&targetHigh,TransparentAlpha, |
4764 | 0 | MagickFalse,exceptionInfo); |
4765 | 0 | ThrowImageException; |
4766 | 0 | } |
4767 | | |
4768 | | void Magick::Image::transpose(void) |
4769 | 0 | { |
4770 | 0 | MagickCore::Image |
4771 | 0 | *newImage; |
4772 | |
|
4773 | 0 | GetPPException; |
4774 | 0 | newImage=TransposeImage(constImage(),exceptionInfo); |
4775 | 0 | replaceImage(newImage); |
4776 | 0 | ThrowImageException; |
4777 | 0 | } |
4778 | | |
4779 | | void Magick::Image::transverse(void) |
4780 | 0 | { |
4781 | 0 | MagickCore::Image |
4782 | 0 | *newImage; |
4783 | |
|
4784 | 0 | GetPPException; |
4785 | 0 | newImage=TransverseImage(constImage(),exceptionInfo); |
4786 | 0 | replaceImage(newImage); |
4787 | 0 | ThrowImageException; |
4788 | 0 | } |
4789 | | |
4790 | | void Magick::Image::trim(void) |
4791 | 0 | { |
4792 | 0 | MagickCore::Image |
4793 | 0 | *newImage; |
4794 | |
|
4795 | 0 | GetPPException; |
4796 | 0 | newImage=TrimImage(constImage(),exceptionInfo); |
4797 | 0 | replaceImage(newImage); |
4798 | 0 | ThrowImageException; |
4799 | 0 | } |
4800 | | |
4801 | | Magick::Image Magick::Image::uniqueColors(void) const |
4802 | 0 | { |
4803 | 0 | MagickCore::Image |
4804 | 0 | *image; |
4805 | |
|
4806 | 0 | GetPPException; |
4807 | 0 | image=UniqueImageColors(constImage(),exceptionInfo); |
4808 | 0 | ThrowImageException; |
4809 | 0 | if (image == (MagickCore::Image *) NULL) |
4810 | 0 | return(Magick::Image()); |
4811 | 0 | else |
4812 | 0 | return(Magick::Image(image)); |
4813 | 0 | } |
4814 | | |
4815 | | void Magick::Image::unsharpmask(const double radius_,const double sigma_, |
4816 | | const double amount_,const double threshold_) |
4817 | 0 | { |
4818 | 0 | MagickCore::Image |
4819 | 0 | *newImage; |
4820 | |
|
4821 | 0 | GetPPException; |
4822 | 0 | newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_, |
4823 | 0 | exceptionInfo); |
4824 | 0 | replaceImage(newImage); |
4825 | 0 | ThrowImageException; |
4826 | 0 | } |
4827 | | |
4828 | | void Magick::Image::unsharpmaskChannel(const ChannelType channel_, |
4829 | | const double radius_,const double sigma_,const double amount_, |
4830 | | const double threshold_) |
4831 | 0 | { |
4832 | 0 | MagickCore::Image |
4833 | 0 | *newImage; |
4834 | |
|
4835 | 0 | GetPPException; |
4836 | 0 | GetAndSetPPChannelMask(channel_); |
4837 | 0 | newImage=UnsharpMaskImage(constImage(),radius_,sigma_,amount_,threshold_, |
4838 | 0 | exceptionInfo); |
4839 | 0 | RestorePPChannelMask; |
4840 | 0 | replaceImage(newImage); |
4841 | 0 | ThrowImageException; |
4842 | 0 | } |
4843 | | |
4844 | | void Magick::Image::vignette(const double radius_,const double sigma_, |
4845 | | const ssize_t x_,const ssize_t y_) |
4846 | 0 | { |
4847 | 0 | MagickCore::Image |
4848 | 0 | *newImage; |
4849 | |
|
4850 | 0 | GetPPException; |
4851 | 0 | newImage=VignetteImage(constImage(),radius_,sigma_,x_,y_,exceptionInfo); |
4852 | 0 | replaceImage(newImage); |
4853 | 0 | ThrowImageException; |
4854 | 0 | } |
4855 | | |
4856 | | void Magick::Image::wave(const double amplitude_,const double wavelength_) |
4857 | 0 | { |
4858 | 0 | MagickCore::Image |
4859 | 0 | *newImage; |
4860 | |
|
4861 | 0 | GetPPException; |
4862 | 0 | newImage=WaveImage(constImage(),amplitude_,wavelength_,image()->interpolate, |
4863 | 0 | exceptionInfo); |
4864 | 0 | replaceImage(newImage); |
4865 | 0 | ThrowImageException; |
4866 | 0 | } |
4867 | | |
4868 | | void Magick::Image::waveletDenoise(const double threshold_, |
4869 | | const double softness_) |
4870 | 0 | { |
4871 | 0 | MagickCore::Image |
4872 | 0 | *newImage; |
4873 | |
|
4874 | 0 | GetPPException; |
4875 | 0 | newImage=WaveletDenoiseImage(constImage(),threshold_,softness_, |
4876 | 0 | exceptionInfo); |
4877 | 0 | replaceImage(newImage); |
4878 | 0 | ThrowImageException; |
4879 | 0 | } |
4880 | | |
4881 | | void Magick::Image::whiteThreshold(const std::string &threshold_) |
4882 | 0 | { |
4883 | 0 | modifyImage(); |
4884 | 0 | GetPPException; |
4885 | 0 | WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo); |
4886 | 0 | ThrowImageException; |
4887 | 0 | } |
4888 | | |
4889 | | void Magick::Image::whiteThresholdChannel(const ChannelType channel_, |
4890 | | const std::string &threshold_) |
4891 | 0 | { |
4892 | 0 | modifyImage(); |
4893 | 0 | GetPPException; |
4894 | 0 | GetAndSetPPChannelMask(channel_); |
4895 | 0 | WhiteThresholdImage(image(),threshold_.c_str(),exceptionInfo); |
4896 | 0 | RestorePPChannelMask; |
4897 | 0 | ThrowImageException; |
4898 | 0 | } |
4899 | | |
4900 | | void Magick::Image::write(Blob *blob_) |
4901 | 0 | { |
4902 | 0 | size_t |
4903 | 0 | length=0; |
4904 | |
|
4905 | 0 | void |
4906 | 0 | *data; |
4907 | |
|
4908 | 0 | modifyImage(); |
4909 | 0 | GetPPException; |
4910 | 0 | data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo); |
4911 | 0 | if (length > 0) |
4912 | 0 | blob_->updateNoCopy(data,length,Blob::MallocAllocator); |
4913 | 0 | else |
4914 | 0 | data=RelinquishMagickMemory(data); |
4915 | 0 | ThrowImageException; |
4916 | 0 | } |
4917 | | |
4918 | | void Magick::Image::write(Blob *blob_,const std::string &magick_) |
4919 | 68.6k | { |
4920 | 68.6k | size_t |
4921 | 68.6k | length=0; |
4922 | | |
4923 | 68.6k | void |
4924 | 68.6k | *data; |
4925 | | |
4926 | 68.6k | modifyImage(); |
4927 | 68.6k | magick(magick_); |
4928 | 68.6k | GetPPException; |
4929 | 68.6k | data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo); |
4930 | 68.6k | if (length > 0) |
4931 | 64.7k | blob_->updateNoCopy(data,length,Blob::MallocAllocator); |
4932 | 3.92k | else |
4933 | 3.92k | data=RelinquishMagickMemory(data); |
4934 | 68.6k | ThrowImageException; |
4935 | 68.6k | } |
4936 | | |
4937 | | void Magick::Image::write(Blob *blob_,const std::string &magick_, |
4938 | | const size_t depth_) |
4939 | 0 | { |
4940 | 0 | size_t |
4941 | 0 | length=0; |
4942 | |
|
4943 | 0 | void |
4944 | 0 | *data; |
4945 | |
|
4946 | 0 | modifyImage(); |
4947 | 0 | magick(magick_); |
4948 | 0 | depth(depth_); |
4949 | 0 | GetPPException; |
4950 | 0 | data=ImagesToBlob(constImageInfo(),image(),&length,exceptionInfo); |
4951 | 0 | if (length > 0) |
4952 | 0 | blob_->updateNoCopy(data,length,Blob::MallocAllocator); |
4953 | 0 | else |
4954 | 0 | data=RelinquishMagickMemory(data); |
4955 | 0 | ThrowImageException; |
4956 | 0 | } |
4957 | | |
4958 | | void Magick::Image::write(const ssize_t x_,const ssize_t y_, |
4959 | | const size_t columns_,const size_t rows_,const std::string &map_, |
4960 | | const StorageType type_,void *pixels_) |
4961 | 0 | { |
4962 | 0 | GetPPException; |
4963 | 0 | ExportImagePixels(image(),x_,y_,columns_,rows_,map_.c_str(),type_,pixels_, |
4964 | 0 | exceptionInfo); |
4965 | 0 | ThrowImageException; |
4966 | 0 | } |
4967 | | |
4968 | | void Magick::Image::write(const std::string &imageSpec_) |
4969 | 0 | { |
4970 | 0 | modifyImage(); |
4971 | 0 | fileName(imageSpec_); |
4972 | 0 | GetPPException; |
4973 | 0 | WriteImage(constImageInfo(),image(),exceptionInfo); |
4974 | 0 | ThrowImageException; |
4975 | 0 | } |
4976 | | |
4977 | | void Magick::Image::writeMask(const Magick::Image &mask_) |
4978 | 0 | { |
4979 | 0 | mask(mask_,WritePixelMask); |
4980 | 0 | } |
4981 | | |
4982 | | Magick::Image Magick::Image::writeMask(void) const |
4983 | 0 | { |
4984 | 0 | return(mask(WritePixelMask)); |
4985 | 0 | } |
4986 | | |
4987 | | void Magick::Image::writePixels(const Magick::QuantumType quantum_, |
4988 | | unsigned char *destination_) |
4989 | 0 | { |
4990 | 0 | QuantumInfo |
4991 | 0 | *quantum_info; |
4992 | |
|
4993 | 0 | quantum_info=AcquireQuantumInfo(imageInfo(),image()); |
4994 | 0 | GetPPException; |
4995 | 0 | ExportQuantumPixels(image(),(MagickCore::CacheView *) NULL,quantum_info, |
4996 | 0 | quantum_,destination_, exceptionInfo); |
4997 | 0 | quantum_info=DestroyQuantumInfo(quantum_info); |
4998 | 0 | ThrowImageException; |
4999 | 0 | } |
5000 | | |
5001 | | void Magick::Image::zoom(const Geometry &geometry_) |
5002 | 0 | { |
5003 | 0 | MagickCore::Image |
5004 | 0 | *newImage; |
5005 | |
|
5006 | 0 | size_t |
5007 | 0 | height=rows(), |
5008 | 0 | width=columns(); |
5009 | |
|
5010 | 0 | ssize_t |
5011 | 0 | x=0, |
5012 | 0 | y=0; |
5013 | |
|
5014 | 0 | ParseMetaGeometry(static_cast<std::string>(geometry_).c_str(),&x,&y,&width, |
5015 | 0 | &height); |
5016 | |
|
5017 | 0 | GetPPException; |
5018 | 0 | newImage=ResizeImage(constImage(),width,height,image()->filter,exceptionInfo); |
5019 | 0 | replaceImage(newImage); |
5020 | 0 | ThrowImageException; |
5021 | 0 | } |
5022 | | |
5023 | | Magick::Image::Image(MagickCore::Image *image_) |
5024 | 0 | : _imgRef(new ImageRef(image_)) |
5025 | 0 | { |
5026 | 0 | } |
5027 | | |
5028 | | MagickCore::Image *&Magick::Image::image(void) |
5029 | 2.39M | { |
5030 | 2.39M | return(_imgRef->image()); |
5031 | 2.39M | } |
5032 | | |
5033 | | const MagickCore::Image *Magick::Image::constImage(void) const |
5034 | 0 | { |
5035 | 0 | return(_imgRef->image()); |
5036 | 0 | } |
5037 | | |
5038 | | MagickCore::ImageInfo *Magick::Image::imageInfo(void) |
5039 | 605k | { |
5040 | 605k | return(_imgRef->options()->imageInfo()); |
5041 | 605k | } |
5042 | | |
5043 | | const MagickCore::ImageInfo *Magick::Image::constImageInfo(void) const |
5044 | 430k | { |
5045 | 430k | return(_imgRef->options()->imageInfo()); |
5046 | 430k | } |
5047 | | |
5048 | | Magick::Options *Magick::Image::options(void) |
5049 | 1.19M | { |
5050 | 1.19M | return(_imgRef->options()); |
5051 | 1.19M | } |
5052 | | |
5053 | | const Magick::Options *Magick::Image::constOptions(void) const |
5054 | 1.03M | { |
5055 | 1.03M | return(_imgRef->options()); |
5056 | 1.03M | } |
5057 | | |
5058 | | MagickCore::QuantizeInfo *Magick::Image::quantizeInfo(void) |
5059 | 0 | { |
5060 | 0 | return(_imgRef->options()->quantizeInfo()); |
5061 | 0 | } |
5062 | | |
5063 | | const MagickCore::QuantizeInfo *Magick::Image::constQuantizeInfo(void) const |
5064 | 0 | { |
5065 | 0 | return(_imgRef->options()->quantizeInfo()); |
5066 | 0 | } |
5067 | | |
5068 | | void Magick::Image::modifyImage(void) |
5069 | 1.23M | { |
5070 | 1.23M | if (!_imgRef->isShared()) |
5071 | 1.23M | return; |
5072 | | |
5073 | 0 | GetPPException; |
5074 | 0 | replaceImage(CloneImage(image(),0,0,MagickTrue,exceptionInfo)); |
5075 | 0 | ThrowImageException; |
5076 | 0 | } |
5077 | | |
5078 | | MagickCore::Image *Magick::Image::replaceImage(MagickCore::Image *replacement_) |
5079 | 605k | { |
5080 | 605k | MagickCore::Image |
5081 | 605k | *image; |
5082 | | |
5083 | 605k | if (replacement_) |
5084 | 244k | image=replacement_; |
5085 | 361k | else |
5086 | 361k | { |
5087 | 361k | GetPPException; |
5088 | 361k | image=AcquireImage(constImageInfo(),exceptionInfo); |
5089 | 361k | ThrowImageException; |
5090 | 361k | } |
5091 | | |
5092 | 605k | _imgRef=ImageRef::replaceImage(_imgRef,image); |
5093 | 605k | return(image); |
5094 | 605k | } |
5095 | | |
5096 | | void Magick::Image::read(MagickCore::Image *image, |
5097 | | MagickCore::ExceptionInfo *exceptionInfo) |
5098 | 605k | { |
5099 | | // Ensure that multiple image frames were not read. |
5100 | 605k | if (image != (MagickCore::Image *) NULL && |
5101 | 244k | image->next != (MagickCore::Image *) NULL) |
5102 | 16.5k | { |
5103 | 16.5k | MagickCore::Image |
5104 | 16.5k | *next; |
5105 | | |
5106 | | // Destroy any extra image frames |
5107 | 16.5k | next=image->next; |
5108 | 16.5k | image->next=(MagickCore::Image *) NULL; |
5109 | 16.5k | next->previous=(MagickCore::Image *) NULL; |
5110 | 16.5k | DestroyImageList(next); |
5111 | 16.5k | } |
5112 | 605k | replaceImage(image); |
5113 | 605k | if (exceptionInfo->severity == MagickCore::UndefinedException && |
5114 | 93.4k | image == (MagickCore::Image *) NULL) |
5115 | 7.83k | { |
5116 | 7.83k | (void) MagickCore::DestroyExceptionInfo(exceptionInfo); |
5117 | 7.83k | if (!quiet()) |
5118 | 7.83k | throwExceptionExplicit(MagickCore::ImageWarning, |
5119 | 7.83k | "No image was loaded."); |
5120 | 7.83k | return; |
5121 | 7.83k | } |
5122 | 597k | ThrowImageException; |
5123 | 597k | } |
5124 | | |
5125 | | void Magick::Image::floodFill(const ssize_t x_,const ssize_t y_, |
5126 | | const Magick::Image *fillPattern_,const Magick::Color &fill_, |
5127 | | const MagickCore::PixelInfo *target_,const bool invert_) |
5128 | 0 | { |
5129 | 0 | Magick::Color |
5130 | 0 | fillColor; |
5131 | |
|
5132 | 0 | MagickCore::Image |
5133 | 0 | *fillPattern; |
5134 | | |
5135 | | // Set drawing fill pattern or fill color |
5136 | 0 | fillColor=options()->fillColor(); |
5137 | 0 | fillPattern=(MagickCore::Image *)NULL; |
5138 | 0 | if (options()->fillPattern() != (MagickCore::Image *)NULL) |
5139 | 0 | { |
5140 | 0 | GetPPException; |
5141 | 0 | fillPattern=CloneImage(options()->fillPattern(),0,0,MagickTrue, |
5142 | 0 | exceptionInfo); |
5143 | 0 | ThrowImageException; |
5144 | 0 | } |
5145 | |
|
5146 | 0 | if (fillPattern_ == (Magick::Image *)NULL) |
5147 | 0 | { |
5148 | 0 | options()->fillPattern((MagickCore::Image *)NULL); |
5149 | 0 | options()->fillColor(fill_); |
5150 | 0 | } |
5151 | 0 | else |
5152 | 0 | options()->fillPattern(fillPattern_->constImage()); |
5153 | |
|
5154 | 0 | GetPPException; |
5155 | 0 | (void) FloodfillPaintImage(image(),options()->drawInfo(), |
5156 | 0 | target_,static_cast<ssize_t>(x_),static_cast<ssize_t>(y_), |
5157 | 0 | (MagickBooleanType) invert_,exceptionInfo); |
5158 | |
|
5159 | 0 | options()->fillColor(fillColor); |
5160 | 0 | options()->fillPattern(fillPattern); |
5161 | 0 | ThrowImageException; |
5162 | 0 | } |
5163 | | |
5164 | | void Magick::Image::mask(const Magick::Image &mask_,const PixelMask type) |
5165 | 0 | { |
5166 | 0 | modifyImage(); |
5167 | |
|
5168 | 0 | GetPPException; |
5169 | 0 | if (mask_.isValid()) |
5170 | 0 | SetImageMask(image(),type,mask_.constImage(),exceptionInfo); |
5171 | 0 | else |
5172 | 0 | SetImageMask(image(),type,(MagickCore::Image *) NULL,exceptionInfo); |
5173 | 0 | ThrowImageException; |
5174 | 0 | } |
5175 | | |
5176 | | Magick::Image Magick::Image::mask(const PixelMask type) const |
5177 | 0 | { |
5178 | 0 | MagickCore::Image |
5179 | 0 | *image; |
5180 | |
|
5181 | 0 | GetPPException; |
5182 | 0 | image = GetImageMask(constImage(),type,exceptionInfo); |
5183 | 0 | ThrowImageException; |
5184 | |
|
5185 | 0 | if (image == (MagickCore::Image *) NULL) |
5186 | 0 | return(Magick::Image()); |
5187 | 0 | else |
5188 | 0 | return(Magick::Image(image)); |
5189 | 0 | } |