cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 6 | % M M OOO N N IIIII TTTTT OOO RRRR % |
| 7 | % MM MM O O NN N I T O O R R % |
| 8 | % M M M O O N N N I T O O RRRR % |
| 9 | % M M O O N NN I T O O R R % |
| 10 | % M M OOO N N IIIII T OOO R R % |
| 11 | % % |
| 12 | % % |
| 13 | % MagickCore Progress Monitor Methods % |
| 14 | % % |
| 15 | % Software Design % |
| 16 | % John Cristy % |
| 17 | % December 1995 % |
| 18 | % % |
| 19 | % % |
| 20 | % Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization % |
| 21 | % dedicated to making software imaging solutions freely available. % |
| 22 | % % |
| 23 | % You may not use this file except in compliance with the License. You may % |
| 24 | % obtain a copy of the License at % |
| 25 | % % |
| 26 | % http://www.imagemagick.org/script/license.php % |
| 27 | % % |
| 28 | % Unless required by applicable law or agreed to in writing, software % |
| 29 | % distributed under the License is distributed on an "AS IS" BASIS, % |
| 30 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % |
| 31 | % See the License for the specific language governing permissions and % |
| 32 | % limitations under the License. % |
| 33 | % % |
| 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 | % |
| 36 | % |
| 37 | % |
| 38 | */ |
| 39 | |
| 40 | /* |
| 41 | Include declarations. |
| 42 | */ |
| 43 | #include "magick/studio.h" |
| 44 | #include "magick/image.h" |
| 45 | #include "magick/log.h" |
| 46 | #include "magick/monitor.h" |
| 47 | |
| 48 | /* |
| 49 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 50 | % % |
| 51 | % % |
| 52 | % % |
| 53 | % S e t I m a g e P r o g r e s s M o n i t o r % |
| 54 | % % |
| 55 | % % |
| 56 | % % |
| 57 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 58 | % |
| 59 | % SetImageProgressMonitor() sets the image progress monitor to the specified |
| 60 | % method and returns the previous progress monitor if any. The progress |
| 61 | % monitor method looks like this: |
| 62 | % |
| 63 | % MagickBooleanType MagickProgressMonitor(const char *text, |
cristy | b32b90a | 2009-09-07 21:45:48 +0000 | [diff] [blame^] | 64 | % const MagickOffsetType offset,const MagickSizeType extent, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 65 | % void *client_data) |
| 66 | % |
| 67 | % If the progress monitor returns MagickFalse, the current operation is |
| 68 | % interrupted. |
| 69 | % |
| 70 | % The format of the SetImageProgressMonitor method is: |
| 71 | % |
| 72 | % MagickProgressMonitor SetImageProgressMonitor(Image *image, |
| 73 | % const MagickProgressMonitor progress_monitor,void *client_data) |
| 74 | % |
| 75 | % A description of each parameter follows: |
| 76 | % |
| 77 | % o image: the image. |
| 78 | % |
| 79 | % o progress_monitor: Specifies a pointer to a method to monitor progress of |
| 80 | % an image operation. |
| 81 | % |
| 82 | % o client_data: Specifies a pointer to any client data. |
| 83 | % |
| 84 | */ |
| 85 | MagickExport MagickProgressMonitor SetImageProgressMonitor(Image *image, |
| 86 | const MagickProgressMonitor progress_monitor,void *client_data) |
| 87 | { |
| 88 | MagickProgressMonitor |
| 89 | previous_monitor; |
| 90 | |
| 91 | previous_monitor=image->progress_monitor; |
| 92 | image->progress_monitor=progress_monitor; |
| 93 | image->client_data=client_data; |
| 94 | return(previous_monitor); |
| 95 | } |
| 96 | |
| 97 | /* |
| 98 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 99 | % % |
| 100 | % % |
| 101 | % % |
| 102 | % S e t I m a g e I n f o P r o g r e s s M o n i t o r % |
| 103 | % % |
| 104 | % % |
| 105 | % % |
| 106 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 107 | % |
| 108 | % SetImageInfoProgressMonitor() sets the image_info progress monitor to the |
| 109 | % specified method and returns the previous progress monitor if any. The |
| 110 | % progress monitor method looks like this: |
| 111 | % |
| 112 | % MagickBooleanType MagickProgressMonitor(const char *text, |
cristy | b32b90a | 2009-09-07 21:45:48 +0000 | [diff] [blame^] | 113 | % const MagickOffsetType offset,const MagickSizeType extent, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 114 | % void *client_data) |
| 115 | % |
| 116 | % If the progress monitor returns MagickFalse, the current operation is |
| 117 | % interrupted. |
| 118 | % |
| 119 | % The format of the SetImageInfoProgressMonitor method is: |
| 120 | % |
| 121 | % MagickProgressMonitor SetImageInfoProgressMonitor(ImageInfo *image_info, |
| 122 | % const MagickProgressMonitor progress_monitor,void *client_data) |
| 123 | % |
| 124 | % A description of each parameter follows: |
| 125 | % |
| 126 | % o image_info: the image info. |
| 127 | % |
| 128 | % o progress_monitor: Specifies a pointer to a method to monitor progress of |
| 129 | % an image operation. |
| 130 | % |
| 131 | % o client_data: Specifies a pointer to any client data. |
| 132 | % |
| 133 | */ |
| 134 | MagickExport MagickProgressMonitor SetImageInfoProgressMonitor( |
| 135 | ImageInfo *image_info,const MagickProgressMonitor progress_monitor, |
| 136 | void *client_data) |
| 137 | { |
| 138 | MagickProgressMonitor |
| 139 | previous_monitor; |
| 140 | |
| 141 | previous_monitor=image_info->progress_monitor; |
| 142 | image_info->progress_monitor=progress_monitor; |
| 143 | image_info->client_data=client_data; |
| 144 | return(previous_monitor); |
| 145 | } |