43#include "MagickCore/studio.h"
44#include "MagickCore/artifact.h"
45#include "MagickCore/cache.h"
46#include "MagickCore/color.h"
47#include "MagickCore/compare.h"
48#include "MagickCore/constitute.h"
49#include "MagickCore/draw.h"
50#include "MagickCore/effect.h"
51#include "MagickCore/exception.h"
52#include "MagickCore/exception-private.h"
53#include "MagickCore/fx.h"
54#include "MagickCore/fx-private.h"
55#include "MagickCore/gem.h"
56#include "MagickCore/geometry.h"
57#include "MagickCore/image.h"
58#include "MagickCore/layer.h"
59#include "MagickCore/list.h"
60#include "MagickCore/memory_.h"
61#include "MagickCore/monitor.h"
62#include "MagickCore/montage.h"
63#include "MagickCore/option.h"
64#include "MagickCore/profile.h"
65#include "MagickCore/quantum.h"
66#include "MagickCore/resource_.h"
67#include "MagickCore/splay-tree.h"
68#include "MagickCore/signature-private.h"
69#include "MagickCore/statistic.h"
70#include "MagickCore/string_.h"
71#include "MagickCore/token.h"
72#include "MagickCore/utility.h"
73#include "MagickCore/xml-tree.h"
102MagickExport MagickBooleanType CloneImageArtifacts(
Image *image,
103 const Image *clone_image)
105 assert(image != (
Image *) NULL);
106 assert(image->signature == MagickCoreSignature);
107 assert(clone_image != (
const Image *) NULL);
108 assert(clone_image->signature == MagickCoreSignature);
109 if (IsEventLogging() != MagickFalse)
111 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
112 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",
113 clone_image->filename);
115 if (clone_image->artifacts != (
void *) NULL)
117 if (image->artifacts != (
void *) NULL)
118 DestroyImageArtifacts(image);
119 image->artifacts=CloneSplayTree((
SplayTreeInfo *) clone_image->artifacts,
120 (
void *(*)(
void *)) ConstantString,(
void *(*)(
void *)) ConstantString);
152MagickExport MagickBooleanType DefineImageArtifact(
Image *image,
153 const char *artifact)
156 key[MagickPathExtent],
157 value[MagickPathExtent];
162 assert(image != (
Image *) NULL);
163 assert(artifact != (
const char *) NULL);
164 (void) CopyMagickString(key,artifact,MagickPathExtent-1);
165 for (p=key; *p !=
'\0'; p++)
170 (void) CopyMagickString(value,p+1,MagickPathExtent);
172 return(SetImageArtifact(image,key,value));
199MagickExport MagickBooleanType DeleteImageArtifact(
Image *image,
200 const char *artifact)
202 assert(image != (
Image *) NULL);
203 assert(image->signature == MagickCoreSignature);
204 if (IsEventLogging() != MagickFalse)
205 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
206 if (image->artifacts == (
void *) NULL)
208 return(DeleteNodeFromSplayTree((
SplayTreeInfo *) image->artifacts,artifact));
234MagickExport
void DestroyImageArtifacts(
Image *image)
236 assert(image != (
Image *) NULL);
237 assert(image->signature == MagickCoreSignature);
238 if (IsEventLogging() != MagickFalse)
239 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
240 if (image->artifacts != (
void *) NULL)
274MagickExport
const char *GetImageArtifact(
const Image *image,
275 const char *artifact)
280 assert(image != (
Image *) NULL);
281 assert(image->signature == MagickCoreSignature);
282 if (IsEventLogging() != MagickFalse)
283 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
284 p=(
const char *) NULL;
285 if (image->artifacts != (
void *) NULL)
287 if (artifact == (
const char *) NULL)
288 return((
const char *) GetRootValueFromSplayTree((
SplayTreeInfo *)
290 p=(
const char *) GetValueFromSplayTree((
SplayTreeInfo *) image->artifacts,
292 if (p != (
const char *) NULL)
295 if ((image->image_info != (
ImageInfo *) NULL) &&
296 (image->image_info->options != (
void *) NULL))
298 image->image_info->options,artifact);
324MagickExport
const char *GetNextImageArtifact(
const Image *image)
326 assert(image != (
Image *) NULL);
327 assert(image->signature == MagickCoreSignature);
328 if (IsEventLogging() != MagickFalse)
329 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
330 if (image->artifacts == (
void *) NULL)
331 return((
const char *) NULL);
332 return((
const char *) GetNextKeyInSplayTree(
364MagickExport
char *RemoveImageArtifact(
Image *image,
const char *artifact)
369 assert(image != (
Image *) NULL);
370 assert(image->signature == MagickCoreSignature);
371 if (IsEventLogging() != MagickFalse)
372 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
373 if (image->artifacts == (
void *) NULL)
374 return((
char *) NULL);
375 value=(
char *) RemoveNodeFromSplayTree((
SplayTreeInfo *) image->artifacts,
407MagickExport
void ResetImageArtifactIterator(
const Image *image)
409 assert(image != (
Image *) NULL);
410 assert(image->signature == MagickCoreSignature);
411 if (IsEventLogging() != MagickFalse)
412 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
413 if (image->artifacts == (
void *) NULL)
449MagickExport MagickBooleanType SetImageArtifact(
Image *image,
450 const char *artifact,
const char *value)
455 assert(image != (
Image *) NULL);
456 assert(image->signature == MagickCoreSignature);
457 if (IsEventLogging() != MagickFalse)
458 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
462 if (image->artifacts == (
void *) NULL)
463 image->artifacts=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,
464 RelinquishMagickMemory);
468 if (value == (
const char *) NULL)
469 return(DeleteImageArtifact(image,artifact));
473 status=AddValueToSplayTree((
SplayTreeInfo *) image->artifacts,
474 ConstantString(artifact),ConstantString(value));