00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include "magick/studio.h"
00044 #include "magick/artifact.h"
00045 #include "magick/cache.h"
00046 #include "magick/color.h"
00047 #include "magick/compare.h"
00048 #include "magick/constitute.h"
00049 #include "magick/draw.h"
00050 #include "magick/effect.h"
00051 #include "magick/exception.h"
00052 #include "magick/exception-private.h"
00053 #include "magick/fx.h"
00054 #include "magick/fx-private.h"
00055 #include "magick/gem.h"
00056 #include "magick/geometry.h"
00057 #include "magick/image.h"
00058 #include "magick/layer.h"
00059 #include "magick/list.h"
00060 #include "magick/memory_.h"
00061 #include "magick/monitor.h"
00062 #include "magick/montage.h"
00063 #include "magick/option.h"
00064 #include "magick/profile.h"
00065 #include "magick/quantum.h"
00066 #include "magick/resource_.h"
00067 #include "magick/splay-tree.h"
00068 #include "magick/signature-private.h"
00069 #include "magick/statistic.h"
00070 #include "magick/string_.h"
00071 #include "magick/token.h"
00072 #include "magick/utility.h"
00073 #include "magick/xml-tree.h"
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 MagickExport MagickBooleanType CloneImageArtifacts(Image *image,
00101 const Image *clone_image)
00102 {
00103 assert(image != (Image *) NULL);
00104 assert(image->signature == MagickSignature);
00105 if (image->debug != MagickFalse)
00106 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
00107 assert(clone_image != (const Image *) NULL);
00108 assert(clone_image->signature == MagickSignature);
00109 if (clone_image->debug != MagickFalse)
00110 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
00111 clone_image->filename);
00112 if (clone_image->artifacts != (void *) NULL)
00113 image->artifacts=CloneSplayTree((SplayTreeInfo *) clone_image->artifacts,
00114 (void *(*)(void *)) ConstantString,(void *(*)(void *)) ConstantString);
00115 return(MagickTrue);
00116 }
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 MagickExport MagickBooleanType DefineImageArtifact(Image *image,
00144 const char *artifact)
00145 {
00146 char
00147 key[MaxTextExtent],
00148 value[MaxTextExtent];
00149
00150 register char
00151 *p;
00152
00153 assert(image != (Image *) NULL);
00154 assert(artifact != (const char *) NULL);
00155 (void) CopyMagickString(key,artifact,MaxTextExtent-1);
00156 for (p=key; *p != '\0'; p++)
00157 if (*p == '=')
00158 break;
00159 *value='\0';
00160 if (*p == '=')
00161 (void) CopyMagickString(value,p+1,MaxTextExtent);
00162 *p='\0';
00163 return(SetImageArtifact(image,key,value));
00164 }
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 MagickExport MagickBooleanType DeleteImageArtifact(Image *image,
00191 const char *artifact)
00192 {
00193 assert(image != (Image *) NULL);
00194 assert(image->signature == MagickSignature);
00195 if (image->debug != MagickFalse)
00196 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
00197 image->filename);
00198 if (image->artifacts == (void *) NULL)
00199 return(MagickFalse);
00200 return(DeleteNodeFromSplayTree((SplayTreeInfo *) image->artifacts,artifact));
00201 }
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 MagickExport void DestroyImageArtifacts(Image *image)
00227 {
00228 assert(image != (Image *) NULL);
00229 assert(image->signature == MagickSignature);
00230 if (image->debug != MagickFalse)
00231 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
00232 image->filename);
00233 if (image->artifacts != (void *) NULL)
00234 image->artifacts=(void *) DestroySplayTree((SplayTreeInfo *)
00235 image->artifacts);
00236 }
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 MagickExport const char *GetImageArtifact(const Image *image,
00263 const char *artifact)
00264 {
00265 register const char
00266 *p;
00267
00268 assert(image != (Image *) NULL);
00269 assert(image->signature == MagickSignature);
00270 if (image->debug != MagickFalse)
00271 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
00272 p=(const char *) NULL;
00273 if (artifact == (const char *) NULL)
00274 {
00275 ResetSplayTreeIterator((SplayTreeInfo *) image->artifacts);
00276 p=(const char *) GetNextValueInSplayTree((SplayTreeInfo *)
00277 image->artifacts);
00278 return(p);
00279 }
00280 if (image->artifacts != (void *) NULL)
00281 {
00282 p=(const char *) GetValueFromSplayTree((SplayTreeInfo *)
00283 image->artifacts,artifact);
00284 if (p != (const char *) NULL)
00285 return(p);
00286 }
00287 return(p);
00288 }
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312 MagickExport char *GetNextImageArtifact(const Image *image)
00313 {
00314 assert(image != (Image *) NULL);
00315 assert(image->signature == MagickSignature);
00316 if (image->debug != MagickFalse)
00317 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
00318 image->filename);
00319 if (image->artifacts == (void *) NULL)
00320 return((char *) NULL);
00321 return((char *) GetNextKeyInSplayTree((SplayTreeInfo *) image->artifacts));
00322 }
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 MagickExport char *RemoveImageArtifact(Image *image,const char *artifact)
00350 {
00351 char
00352 *value;
00353
00354 assert(image != (Image *) NULL);
00355 assert(image->signature == MagickSignature);
00356 if (image->debug != MagickFalse)
00357 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
00358 image->filename);
00359 if (image->artifacts == (void *) NULL)
00360 return((char *) NULL);
00361 value=(char *) RemoveNodeFromSplayTree((SplayTreeInfo *) image->artifacts,
00362 artifact);
00363 return(value);
00364 }
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390 MagickExport void ResetImageArtifactIterator(const Image *image)
00391 {
00392 assert(image != (Image *) NULL);
00393 assert(image->signature == MagickSignature);
00394 if (image->debug != MagickFalse)
00395 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
00396 image->filename);
00397 if (image->artifacts == (void *) NULL)
00398 return;
00399 ResetSplayTreeIterator((SplayTreeInfo *) image->artifacts);
00400 }
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429 MagickExport MagickBooleanType SetImageArtifact(Image *image,
00430 const char *artifact,const char *value)
00431 {
00432 MagickBooleanType
00433 status;
00434
00435 assert(image != (Image *) NULL);
00436 assert(image->signature == MagickSignature);
00437 if (image->debug != MagickFalse)
00438 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
00439 image->filename);
00440 if (image->artifacts == (void *) NULL)
00441 image->artifacts=NewSplayTree(CompareSplayTreeString,
00442 RelinquishMagickMemory,RelinquishMagickMemory);
00443 if ((value == (const char *) NULL) || (*value == '\0'))
00444 return(DeleteImageArtifact(image,artifact));
00445 status=AddValueToSplayTree((SplayTreeInfo *) image->artifacts,
00446 ConstantString(artifact),ConstantString(value));
00447 return(status);
00448 }