43#include "MagickCore/studio.h"
44#include "MagickCore/artifact.h"
45#include "MagickCore/image.h"
46#include "MagickCore/log.h"
47#include "MagickCore/monitor.h"
48#include "MagickCore/monitor-private.h"
49#include "MagickCore/pixel-accessor.h"
75MagickPrivate MagickBooleanType MonitorComponentGenesis(
void)
78 monitor_semaphore=AcquireSemaphoreInfo();
100MagickPrivate
void MonitorComponentTerminus(
void)
103 ActivateSemaphoreInfo(&monitor_semaphore);
104 LockSemaphoreInfo(monitor_semaphore);
105 UnlockSemaphoreInfo(monitor_semaphore);
106 RelinquishSemaphoreInfo(&monitor_semaphore);
141MagickExport MagickBooleanType SetImageProgress(
const Image *image,
142 const char *tag,
const MagickOffsetType offset,
const MagickSizeType extent)
145 message[MagickPathExtent];
150 if (image->progress_monitor == (MagickProgressMonitor) NULL)
152 (void) FormatLocaleString(message,MagickPathExtent,
"%s/%s",
153 tag == (
const char *) NULL ?
"null" : tag,image->filename);
155 ActivateSemaphoreInfo(&monitor_semaphore);
156 LockSemaphoreInfo(monitor_semaphore);
157 status=image->progress_monitor(message,offset,extent,image->client_data);
158 (void) FormatLocaleString(message,MagickPathExtent,
"%g%%:%s:%s",
159 (
double) (100.0*offset*PerceptibleReciprocal(extent-1.0)),
160 tag == (
const char *) NULL ?
"null" : tag,image->filename);
161 (void) SetImageArtifact((
Image *) image,
"monitor:progress",message);
162 UnlockSemaphoreInfo(monitor_semaphore);
203MagickExport MagickProgressMonitor SetImageProgressMonitor(
Image *image,
204 const MagickProgressMonitor progress_monitor,
void *client_data)
206 MagickProgressMonitor
209 previous_monitor=image->progress_monitor;
210 image->progress_monitor=progress_monitor;
211 image->client_data=client_data;
212 return(previous_monitor);
252MagickExport MagickProgressMonitor SetImageInfoProgressMonitor(
253 ImageInfo *image_info,
const MagickProgressMonitor progress_monitor,
256 MagickProgressMonitor
259 previous_monitor=image_info->progress_monitor;
260 image_info->progress_monitor=progress_monitor;
261 image_info->client_data=client_data;
262 return(previous_monitor);