2 Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 https://www.imagemagick.org/script/license.php
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
16 MagickWand mogrify command-line private methods.
18 #ifndef MAGICKWAND_MOGRIFY_PRIVATE_H
19 #define MAGICKWAND_MOGRIFY_PRIVATE_H
21 #if defined(__cplusplus) || defined(c_plusplus)
25 #define AppendImageStack(images) \
27 (void) SyncImagesSettings(image_info,images,exception); \
28 AppendImageToList(&image_stack[k].image,images); \
29 image=image_stack[k].image; \
31 #define DestroyImageStack() \
35 image_stack[k].image=DestroyImageList(image_stack[k].image); \
36 image_stack[k].image_info=DestroyImageInfo(image_stack[k].image_info); \
37 image_info=image_stack[MaxImageStackDepth].image_info; \
39 #define FinalizeImageSettings(image_info,image,advance) \
41 FireImageStack(MagickTrue,advance,MagickTrue); \
42 if (image != (Image *) NULL) \
43 (void) SyncImagesSettings(image_info,image,exception); \
45 #define FireImageStack(postfix,advance,fire) \
46 if ((j <= i) && (i < (ssize_t) argc)) \
48 DisableMSCWarning(4127) \
49 if (image_stack[k].image == (Image *) NULL) \
50 status&=MogrifyImageInfo(image_stack[k].image_info,(int) (i-j+1), \
51 (const char **) (argv+j),exception); \
53 if ((fire) != MagickFalse) \
55 status&=MogrifyImages(image_stack[k].image_info,postfix,(int) \
56 (i-j+1),(const char **) (argv+j),&image_stack[k].image, \
58 image=image_stack[k].image; \
59 if ((advance) != MagickFalse) \
65 #define MaxImageStackDepth 128
66 #define NewImageStack() \
68 image_stack[MaxImageStackDepth].image_info=image_info; \
69 image_stack[0].image_info=CloneImageInfo(image_info); \
70 image_stack[0].image=NewImageList(); \
71 image_info=image_stack[0].image_info; \
72 image=image_stack[0].image; \
74 #define PushImageStack() \
77 image_stack[k].image_info=CloneImageInfo(image_stack[k-1].image_info); \
78 image_stack[k].image=NewImageList(); \
79 image_info=image_stack[k].image_info; \
80 image=image_stack[k].image; \
82 #define PopImageStack() \
84 if (respect_parenthesis == MagickFalse) \
86 image_stack[k-1].image_info=DestroyImageInfo(image_stack[k-1].image_info); \
87 image_stack[k-1].image_info=CloneImageInfo(image_stack[k].image_info); \
89 image_stack[k].image_info=DestroyImageInfo(image_stack[k].image_info); \
90 AppendImageToList(&image_stack[k-1].image,image_stack[k].image); \
92 image_info=image_stack[k].image_info; \
93 image=image_stack[k].image; \
95 #define QuantumTick(i,span) ((MagickBooleanType) ((((i) & ((i)-1)) == 0) || \
96 (((i) & 0xfff) == 0) || \
97 ((MagickOffsetType) (i) == ((MagickOffsetType) (span)-1))))
98 #define RemoveImageStack(images) \
100 images=RemoveFirstImageFromList(&image_stack[k].image); \
101 image=image_stack[k].image; \
103 #define RemoveAllImageStack() \
105 if (image_stack[k].image != (Image *) NULL) \
106 image_stack[k].image=DestroyImageList(image_stack[k].image); \
108 #define SetImageStack(image) \
110 image_stack[k].image=(image); \
113 typedef struct _ImageStack
122 #if defined(__cplusplus) || defined(c_plusplus)