cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 5 | % IIIII M M AAA GGGG EEEEE % |
| 6 | % I MM MM A A G E % |
| 7 | % I M M M AAAAA G GG EEE % |
| 8 | % I M M A A G G E % |
| 9 | % IIIII M M A A GGGG EEEEE % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 10 | % % |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 11 | % V V IIIII EEEEE W W % |
| 12 | % V V I E W W % |
| 13 | % V V I EEE W W W % |
| 14 | % V V I E WW WW % |
| 15 | % V IIIII EEEEE W W % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 16 | % % |
| 17 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 18 | % MagickCore Image View Methods % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 19 | % % |
| 20 | % Software Design % |
| 21 | % John Cristy % |
| 22 | % March 2003 % |
| 23 | % % |
| 24 | % % |
cristy | 16af1cb | 2009-12-11 21:38:29 +0000 | [diff] [blame] | 25 | % Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 26 | % dedicated to making software imaging solutions freely available. % |
| 27 | % % |
| 28 | % You may not use this file except in compliance with the License. You may % |
| 29 | % obtain a copy of the License at % |
| 30 | % % |
| 31 | % http://www.imagemagick.org/script/license.php % |
| 32 | % % |
| 33 | % Unless required by applicable law or agreed to in writing, software % |
| 34 | % distributed under the License is distributed on an "AS IS" BASIS, % |
| 35 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % |
| 36 | % See the License for the specific language governing permissions and % |
| 37 | % limitations under the License. % |
| 38 | % % |
| 39 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 40 | % |
| 41 | % |
| 42 | % |
| 43 | */ |
| 44 | |
| 45 | /* |
| 46 | Include declarations. |
| 47 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 48 | #include "magick/studio.h" |
| 49 | #include "magick/MagickCore.h" |
| 50 | #include "magick/exception-private.h" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 51 | #include "magick/monitor-private.h" |
| 52 | #include "magick/thread-private.h" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 53 | |
| 54 | /* |
| 55 | Typedef declarations. |
| 56 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 57 | struct _ImageView |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 58 | { |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 59 | char |
| 60 | *description; |
| 61 | |
| 62 | RectangleInfo |
| 63 | extent; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 64 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 65 | Image |
| 66 | *image; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 67 | |
| 68 | CacheView |
| 69 | *view; |
| 70 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 71 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 72 | number_threads; |
| 73 | |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 74 | ExceptionInfo |
| 75 | *exception; |
| 76 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 77 | MagickBooleanType |
| 78 | debug; |
| 79 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 80 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 81 | signature; |
| 82 | }; |
| 83 | |
| 84 | /* |
| 85 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 86 | % % |
| 87 | % % |
| 88 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 89 | % C l o n e I m a g e V i e w % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 90 | % % |
| 91 | % % |
| 92 | % % |
| 93 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 94 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 95 | % CloneImageView() makes a copy of the specified image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 96 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 97 | % The format of the CloneImageView method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 98 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 99 | % ImageView *CloneImageView(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 100 | % |
| 101 | % A description of each parameter follows: |
| 102 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 103 | % o image_view: the image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 104 | % |
| 105 | */ |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 106 | MagickExport ImageView *CloneImageView(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 107 | { |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 108 | ImageView |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 109 | *clone_view; |
| 110 | |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 111 | assert(image_view != (ImageView *) NULL); |
| 112 | assert(image_view->signature == MagickSignature); |
cristy | 73bd4a5 | 2010-10-05 11:24:23 +0000 | [diff] [blame^] | 113 | clone_view=(ImageView *) AcquireMagickMemory(sizeof(*clone_view)); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 114 | if (clone_view == (ImageView *) NULL) |
| 115 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 116 | (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view)); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 117 | clone_view->description=ConstantString(image_view->description); |
| 118 | clone_view->extent=image_view->extent; |
| 119 | clone_view->view=CloneCacheView(image_view->view); |
| 120 | clone_view->number_threads=image_view->number_threads; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 121 | clone_view->exception=AcquireExceptionInfo(); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 122 | InheritException(clone_view->exception,image_view->exception); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 123 | clone_view->debug=image_view->debug; |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 124 | clone_view->signature=MagickSignature; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 125 | return(clone_view); |
| 126 | } |
| 127 | |
| 128 | /* |
| 129 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 130 | % % |
| 131 | % % |
| 132 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 133 | % D e s t r o y I m a g e V i e w % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 134 | % % |
| 135 | % % |
| 136 | % % |
| 137 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 138 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 139 | % DestroyImageView() deallocates memory associated with a image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 140 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 141 | % The format of the DestroyImageView method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 142 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 143 | % ImageView *DestroyImageView(ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 144 | % |
| 145 | % A description of each parameter follows: |
| 146 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 147 | % o image_view: the image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 148 | % |
| 149 | */ |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 150 | MagickExport ImageView *DestroyImageView(ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 151 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 152 | assert(image_view != (ImageView *) NULL); |
| 153 | assert(image_view->signature == MagickSignature); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 154 | if (image_view->description != (char *) NULL) |
| 155 | image_view->description=DestroyString(image_view->description); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 156 | image_view->view=DestroyCacheView(image_view->view); |
| 157 | image_view->exception=DestroyExceptionInfo(image_view->exception); |
| 158 | image_view->signature=(~MagickSignature); |
| 159 | image_view=(ImageView *) RelinquishMagickMemory(image_view); |
| 160 | return(image_view); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | /* |
| 164 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 165 | % % |
| 166 | % % |
| 167 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 168 | % D u p l e x T r a n s f e r I m a g e V i e w I t e r a t o r % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 169 | % % |
| 170 | % % |
| 171 | % % |
| 172 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 173 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 174 | % DuplexTransferImageViewIterator() iterates over three image views in |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 175 | % parallel and calls your transfer method for each scanline of the view. The |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 176 | % source and duplex pixel extent is not confined to the image canvas-- that is |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 177 | % you can include negative offsets or widths or heights that exceed the image |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 178 | % dimension. However, the destination image view is confined to the image |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 179 | % canvas-- that is no negative offsets or widths or heights that exceed the |
| 180 | % image dimension are permitted. |
| 181 | % |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 182 | % The callback signature is: |
| 183 | % |
| 184 | % MagickBooleanType DuplexTransferImageViewMethod(const ImageView *source, |
| 185 | % const ImageView *duplex,ImageView *destination,const ssize_t y, |
| 186 | % const int thread_id,void *context) |
| 187 | % |
cristy | 5873947 | 2010-06-26 20:27:18 +0000 | [diff] [blame] | 188 | % Use this pragma if the view is not single threaded: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 189 | % |
| 190 | % #pragma omp critical |
| 191 | % |
| 192 | % to define a section of code in your callback transfer method that must be |
| 193 | % executed by a single thread at a time. |
| 194 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 195 | % The format of the DuplexTransferImageViewIterator method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 196 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 197 | % MagickBooleanType DuplexTransferImageViewIterator(ImageView *source, |
| 198 | % ImageView *duplex,ImageView *destination, |
| 199 | % DuplexTransferImageViewMethod transfer,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 200 | % |
| 201 | % A description of each parameter follows: |
| 202 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 203 | % o source: the source image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 204 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 205 | % o duplex: the duplex image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 206 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 207 | % o destination: the destination image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 208 | % |
| 209 | % o transfer: the transfer callback method. |
| 210 | % |
| 211 | % o context: the user defined context. |
| 212 | % |
| 213 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 214 | MagickExport MagickBooleanType DuplexTransferImageViewIterator( |
| 215 | ImageView *source,ImageView *duplex,ImageView *destination, |
| 216 | DuplexTransferImageViewMethod transfer,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 217 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 218 | ExceptionInfo |
| 219 | *exception; |
| 220 | |
| 221 | Image |
| 222 | *destination_image, |
| 223 | *duplex_image, |
| 224 | *source_image; |
| 225 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 226 | MagickBooleanType |
| 227 | status; |
| 228 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 229 | MagickOffsetType |
| 230 | progress; |
| 231 | |
| 232 | ssize_t |
| 233 | y; |
| 234 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 235 | assert(source != (ImageView *) NULL); |
| 236 | assert(source->signature == MagickSignature); |
| 237 | if (transfer == (DuplexTransferImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 238 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 239 | source_image=source->image; |
| 240 | duplex_image=duplex->image; |
| 241 | destination_image=destination->image; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 242 | if (SetImageStorageClass(destination_image,DirectClass) == MagickFalse) |
| 243 | return(MagickFalse); |
| 244 | status=MagickTrue; |
| 245 | progress=0; |
| 246 | exception=destination->exception; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 247 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | cde47d3 | 2009-11-04 03:05:18 +0000 | [diff] [blame] | 248 | #pragma omp parallel for schedule(static,1) shared(progress,status) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 249 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 250 | for (y=source->extent.y; y < (ssize_t) source->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 251 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 252 | const int |
| 253 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 254 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 255 | MagickBooleanType |
| 256 | sync; |
| 257 | |
| 258 | register const IndexPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 259 | *restrict duplex_indexes, |
| 260 | *restrict indexes; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 261 | |
| 262 | register const PixelPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 263 | *restrict duplex_pixels, |
| 264 | *restrict pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 265 | |
| 266 | register IndexPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 267 | *restrict destination_indexes; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 268 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 269 | register PixelPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 270 | *restrict destination_pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 271 | |
| 272 | if (status == MagickFalse) |
| 273 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 274 | pixels=GetCacheViewVirtualPixels(source->view,source->extent.x,y, |
| 275 | source->extent.width,1,source->exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 276 | if (pixels == (const PixelPacket *) NULL) |
| 277 | { |
| 278 | status=MagickFalse; |
| 279 | continue; |
| 280 | } |
| 281 | indexes=GetCacheViewVirtualIndexQueue(source->view); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 282 | duplex_pixels=GetCacheViewVirtualPixels(duplex->view,duplex->extent.x,y, |
| 283 | duplex->extent.width,1,duplex->exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 284 | if (duplex_pixels == (const PixelPacket *) NULL) |
| 285 | { |
| 286 | status=MagickFalse; |
| 287 | continue; |
| 288 | } |
| 289 | duplex_indexes=GetCacheViewVirtualIndexQueue(duplex->view); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 290 | destination_pixels=GetCacheViewAuthenticPixels(destination->view, |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 291 | destination->extent.x,y,destination->extent.width,1,exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 292 | if (destination_pixels == (PixelPacket *) NULL) |
| 293 | { |
| 294 | status=MagickFalse; |
| 295 | continue; |
| 296 | } |
| 297 | destination_indexes=GetCacheViewAuthenticIndexQueue(destination->view); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 298 | if (transfer(source,duplex,destination,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 299 | status=MagickFalse; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 300 | sync=SyncCacheViewAuthenticPixels(destination->view,exception); |
| 301 | if (sync == MagickFalse) |
| 302 | { |
| 303 | InheritException(destination->exception,GetCacheViewException( |
| 304 | source->view)); |
| 305 | status=MagickFalse; |
| 306 | } |
| 307 | if (source_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 308 | { |
| 309 | MagickBooleanType |
| 310 | proceed; |
| 311 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 312 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 313 | #pragma omp critical (MagickCore_DuplexTransferImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 314 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 315 | proceed=SetImageProgress(source_image,source->description,progress++, |
| 316 | source->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 317 | if (proceed == MagickFalse) |
| 318 | status=MagickFalse; |
| 319 | } |
| 320 | } |
| 321 | return(status); |
| 322 | } |
| 323 | |
| 324 | /* |
| 325 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 326 | % % |
| 327 | % % |
| 328 | % % |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 329 | % G e t I m a g e V i e w A u t h e n t i c I n d e x e s % |
| 330 | % % |
| 331 | % % |
| 332 | % % |
| 333 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 334 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 335 | % GetImageViewAuthenticIndexes() returns the image view authentic indexes. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 336 | % |
| 337 | % The format of the GetImageViewAuthenticPixels method is: |
| 338 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 339 | % IndexPacket *GetImageViewAuthenticIndexes(const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 340 | % |
| 341 | % A description of each parameter follows: |
| 342 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 343 | % o image_view: the image view. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 344 | % |
| 345 | */ |
| 346 | MagickExport IndexPacket *GetImageViewAuthenticIndexes( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 347 | const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 348 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 349 | assert(image_view != (ImageView *) NULL); |
| 350 | assert(image_view->signature == MagickSignature); |
| 351 | return(GetCacheViewAuthenticIndexQueue(image_view->view)); |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | /* |
| 355 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 356 | % % |
| 357 | % % |
| 358 | % % |
| 359 | % G e t I m a g e V i e w A u t h e n t i c P i x e l s % |
| 360 | % % |
| 361 | % % |
| 362 | % % |
| 363 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 364 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 365 | % GetImageViewAuthenticPixels() returns the image view authentic pixels. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 366 | % |
| 367 | % The format of the GetImageViewAuthenticPixels method is: |
| 368 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 369 | % PixelPacket *GetImageViewAuthenticPixels(const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 370 | % |
| 371 | % A description of each parameter follows: |
| 372 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 373 | % o image_view: the image view. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 374 | % |
| 375 | */ |
| 376 | MagickExport PixelPacket *GetImageViewAuthenticPixels( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 377 | const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 378 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 379 | assert(image_view != (ImageView *) NULL); |
| 380 | assert(image_view->signature == MagickSignature); |
| 381 | return(GetCacheViewAuthenticPixelQueue(image_view->view)); |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 382 | } |
| 383 | |
| 384 | /* |
| 385 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 386 | % % |
| 387 | % % |
| 388 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 389 | % G e t I m a g e V i e w E x c e p t i o n % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 390 | % % |
| 391 | % % |
| 392 | % % |
| 393 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 394 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 395 | % GetImageViewException() returns the severity, reason, and description of any |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 396 | % error that occurs when utilizing a image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 397 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 398 | % The format of the GetImageViewException method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 399 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 400 | % char *GetImageViewException(const PixelImage *image_view, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 401 | % ExceptionType *severity) |
| 402 | % |
| 403 | % A description of each parameter follows: |
| 404 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 405 | % o image_view: the pixel image_view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 406 | % |
| 407 | % o severity: the severity of the error is returned here. |
| 408 | % |
| 409 | */ |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 410 | MagickExport char *GetImageViewException(const ImageView *image_view, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 411 | ExceptionType *severity) |
| 412 | { |
| 413 | char |
| 414 | *description; |
| 415 | |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 416 | assert(image_view != (const ImageView *) NULL); |
| 417 | assert(image_view->signature == MagickSignature); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 418 | assert(severity != (ExceptionType *) NULL); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 419 | *severity=image_view->exception->severity; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 420 | description=(char *) AcquireQuantumMemory(2UL*MaxTextExtent, |
| 421 | sizeof(*description)); |
| 422 | if (description == (char *) NULL) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 423 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 424 | *description='\0'; |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 425 | if (image_view->exception->reason != (char *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 426 | (void) CopyMagickString(description,GetLocaleExceptionMessage( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 427 | image_view->exception->severity,image_view->exception->reason), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 428 | MaxTextExtent); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 429 | if (image_view->exception->description != (char *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 430 | { |
| 431 | (void) ConcatenateMagickString(description," (",MaxTextExtent); |
| 432 | (void) ConcatenateMagickString(description,GetLocaleExceptionMessage( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 433 | image_view->exception->severity,image_view->exception->description), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 434 | MaxTextExtent); |
| 435 | (void) ConcatenateMagickString(description,")",MaxTextExtent); |
| 436 | } |
| 437 | return(description); |
| 438 | } |
| 439 | |
| 440 | /* |
| 441 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 442 | % % |
| 443 | % % |
| 444 | % % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 445 | % G e t I m a g e V i e w E x t e n t % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 446 | % % |
| 447 | % % |
| 448 | % % |
| 449 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 450 | % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 451 | % GetImageViewExtent() returns the image view extent. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 452 | % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 453 | % The format of the GetImageViewExtent method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 454 | % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 455 | % RectangleInfo GetImageViewExtent(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 456 | % |
| 457 | % A description of each parameter follows: |
| 458 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 459 | % o image_view: the image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 460 | % |
| 461 | */ |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 462 | MagickExport RectangleInfo GetImageViewExtent(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 463 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 464 | assert(image_view != (ImageView *) NULL); |
| 465 | assert(image_view->signature == MagickSignature); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 466 | return(image_view->extent); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 467 | } |
| 468 | |
| 469 | /* |
| 470 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 471 | % % |
| 472 | % % |
| 473 | % % |
| 474 | % G e t I m a g e V i e w I m a g e % |
| 475 | % % |
| 476 | % % |
| 477 | % % |
| 478 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 479 | % |
| 480 | % GetImageViewImage() returns the image associated with the image view. |
| 481 | % |
| 482 | % The format of the GetImageViewImage method is: |
| 483 | % |
| 484 | % MagickCore *GetImageViewImage(const ImageView *image_view) |
| 485 | % |
| 486 | % A description of each parameter follows: |
| 487 | % |
| 488 | % o image_view: the image view. |
| 489 | % |
| 490 | */ |
| 491 | MagickExport Image *GetImageViewImage(const ImageView *image_view) |
| 492 | { |
| 493 | assert(image_view != (ImageView *) NULL); |
| 494 | assert(image_view->signature == MagickSignature); |
| 495 | return(image_view->image); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | /* |
| 499 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 500 | % % |
| 501 | % % |
| 502 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 503 | % G e t I m a g e V i e w I t e r a t o r % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 504 | % % |
| 505 | % % |
| 506 | % % |
| 507 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 508 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 509 | % GetImageViewIterator() iterates over the image view in parallel and calls |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 510 | % your get method for each scanline of the view. The pixel extent is |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 511 | % not confined to the image canvas-- that is you can include negative offsets |
| 512 | % or widths or heights that exceed the image dimension. Any updates to |
| 513 | % the pixels in your callback are ignored. |
| 514 | % |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 515 | % The callback signature is: |
| 516 | % |
| 517 | % MagickBooleanType GetImageViewMethod(const ImageView *source, |
| 518 | % const ssize_t y,const int thread_id,void *context) |
| 519 | % |
cristy | 5873947 | 2010-06-26 20:27:18 +0000 | [diff] [blame] | 520 | % Use this pragma if the view is not single threaded: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 521 | % |
| 522 | % #pragma omp critical |
| 523 | % |
| 524 | % to define a section of code in your callback get method that must be |
| 525 | % executed by a single thread at a time. |
| 526 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 527 | % The format of the GetImageViewIterator method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 528 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 529 | % MagickBooleanType GetImageViewIterator(ImageView *source, |
| 530 | % GetImageViewMethod get,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 531 | % |
| 532 | % A description of each parameter follows: |
| 533 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 534 | % o source: the source image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 535 | % |
| 536 | % o get: the get callback method. |
| 537 | % |
| 538 | % o context: the user defined context. |
| 539 | % |
| 540 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 541 | MagickExport MagickBooleanType GetImageViewIterator(ImageView *source, |
| 542 | GetImageViewMethod get,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 543 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 544 | Image |
| 545 | *source_image; |
| 546 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 547 | MagickBooleanType |
| 548 | status; |
| 549 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 550 | MagickOffsetType |
| 551 | progress; |
| 552 | |
| 553 | ssize_t |
| 554 | y; |
| 555 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 556 | assert(source != (ImageView *) NULL); |
| 557 | assert(source->signature == MagickSignature); |
| 558 | if (get == (GetImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 559 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 560 | source_image=source->image; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 561 | status=MagickTrue; |
| 562 | progress=0; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 563 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 309f613 | 2010-06-07 13:19:01 +0000 | [diff] [blame] | 564 | #pragma omp parallel for schedule(static,1) shared(progress,status) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 565 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 566 | for (y=source->extent.y; y < (ssize_t) source->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 567 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 568 | const int |
| 569 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 570 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 571 | register const IndexPacket |
| 572 | *indexes; |
| 573 | |
| 574 | register const PixelPacket |
| 575 | *pixels; |
| 576 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 577 | if (status == MagickFalse) |
| 578 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 579 | pixels=GetCacheViewVirtualPixels(source->view,source->extent.x,y, |
| 580 | source->extent.width,1,source->exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 581 | if (pixels == (const PixelPacket *) NULL) |
| 582 | { |
| 583 | status=MagickFalse; |
| 584 | continue; |
| 585 | } |
| 586 | indexes=GetCacheViewVirtualIndexQueue(source->view); |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 587 | if (get(source,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 588 | status=MagickFalse; |
| 589 | if (source_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 590 | { |
| 591 | MagickBooleanType |
| 592 | proceed; |
| 593 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 594 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 595 | #pragma omp critical (MagickCore_GetImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 596 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 597 | proceed=SetImageProgress(source_image,source->description,progress++, |
| 598 | source->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 599 | if (proceed == MagickFalse) |
| 600 | status=MagickFalse; |
| 601 | } |
| 602 | } |
| 603 | return(status); |
| 604 | } |
| 605 | |
| 606 | /* |
| 607 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 608 | % % |
| 609 | % % |
| 610 | % % |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 611 | % G e t I m a g e V i e w V i r t u a l I n d e x e s % |
| 612 | % % |
| 613 | % % |
| 614 | % % |
| 615 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 616 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 617 | % GetImageViewVirtualIndexes() returns the image view virtual indexes. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 618 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 619 | % The format of the GetImageViewVirtualIndexes method is: |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 620 | % |
| 621 | % const IndexPacket *GetImageViewVirtualIndexes( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 622 | % const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 623 | % |
| 624 | % A description of each parameter follows: |
| 625 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 626 | % o image_view: the image view. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 627 | % |
| 628 | */ |
| 629 | MagickExport const IndexPacket *GetImageViewVirtualIndexes( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 630 | const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 631 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 632 | assert(image_view != (ImageView *) NULL); |
| 633 | assert(image_view->signature == MagickSignature); |
| 634 | return(GetCacheViewVirtualIndexQueue(image_view->view)); |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 635 | } |
| 636 | |
| 637 | /* |
| 638 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 639 | % % |
| 640 | % % |
| 641 | % % |
| 642 | % G e t I m a g e V i e w V i r t u a l P i x e l s % |
| 643 | % % |
| 644 | % % |
| 645 | % % |
| 646 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 647 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 648 | % GetImageViewVirtualPixels() returns the image view virtual pixels. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 649 | % |
| 650 | % The format of the GetImageViewVirtualPixels method is: |
| 651 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 652 | % const PixelPacket *GetImageViewVirtualPixels(const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 653 | % |
| 654 | % A description of each parameter follows: |
| 655 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 656 | % o image_view: the image view. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 657 | % |
| 658 | */ |
| 659 | MagickExport const PixelPacket *GetImageViewVirtualPixels( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 660 | const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 661 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 662 | assert(image_view != (ImageView *) NULL); |
| 663 | assert(image_view->signature == MagickSignature); |
| 664 | return(GetCacheViewVirtualPixelQueue(image_view->view)); |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 665 | } |
| 666 | |
| 667 | /* |
| 668 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 669 | % % |
| 670 | % % |
| 671 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 672 | % I s I m a g e V i e w % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 673 | % % |
| 674 | % % |
| 675 | % % |
| 676 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 677 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 678 | % IsImageView() returns MagickTrue if the the parameter is verified as a image |
| 679 | % view object. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 680 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 681 | % The format of the IsImageView method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 682 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 683 | % MagickBooleanType IsImageView(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 684 | % |
| 685 | % A description of each parameter follows: |
| 686 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 687 | % o image_view: the image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 688 | % |
| 689 | */ |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 690 | MagickExport MagickBooleanType IsImageView(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 691 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 692 | if (image_view == (const ImageView *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 693 | return(MagickFalse); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 694 | if (image_view->signature != MagickSignature) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 695 | return(MagickFalse); |
| 696 | return(MagickTrue); |
| 697 | } |
| 698 | |
| 699 | /* |
| 700 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 701 | % % |
| 702 | % % |
| 703 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 704 | % N e w I m a g e V i e w % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 705 | % % |
| 706 | % % |
| 707 | % % |
| 708 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 709 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 710 | % NewImageView() returns a image view required for all other methods in the |
| 711 | % Image View API. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 712 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 713 | % The format of the NewImageView method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 714 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 715 | % ImageView *NewImageView(MagickCore *wand) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 716 | % |
| 717 | % A description of each parameter follows: |
| 718 | % |
| 719 | % o wand: the wand. |
| 720 | % |
| 721 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 722 | MagickExport ImageView *NewImageView(Image *image) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 723 | { |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 724 | ImageView |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 725 | *image_view; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 726 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 727 | assert(image != (Image *) NULL); |
| 728 | assert(image->signature == MagickSignature); |
cristy | 73bd4a5 | 2010-10-05 11:24:23 +0000 | [diff] [blame^] | 729 | image_view=(ImageView *) AcquireMagickMemory(sizeof(*image_view)); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 730 | if (image_view == (ImageView *) NULL) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 731 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 732 | (void) ResetMagickMemory(image_view,0,sizeof(*image_view)); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 733 | image_view->description=ConstantString("ImageView"); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 734 | image_view->image=image; |
| 735 | image_view->view=AcquireCacheView(image_view->image); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 736 | image_view->extent.width=image->columns; |
| 737 | image_view->extent.height=image->rows; |
| 738 | image_view->extent.x=0; |
| 739 | image_view->extent.y=0; |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 740 | image_view->number_threads=GetOpenMPMaximumThreads(); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 741 | image_view->exception=AcquireExceptionInfo(); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 742 | image_view->debug=IsEventLogging(); |
| 743 | image_view->signature=MagickSignature; |
| 744 | return(image_view); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 745 | } |
| 746 | |
| 747 | /* |
| 748 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 749 | % % |
| 750 | % % |
| 751 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 752 | % N e w I m a g e V i e w R e g i o n % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 753 | % % |
| 754 | % % |
| 755 | % % |
| 756 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 757 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 758 | % NewImageViewRegion() returns a image view required for all other methods |
| 759 | % in the Image View API. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 760 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 761 | % The format of the NewImageViewRegion method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 762 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 763 | % ImageView *NewImageViewRegion(MagickCore *wand,const ssize_t x, |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 764 | % const ssize_t y,const size_t width,const size_t height) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 765 | % |
| 766 | % A description of each parameter follows: |
| 767 | % |
| 768 | % o wand: the magick wand. |
| 769 | % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 770 | % o x,y,columns,rows: These values define the perimeter of a extent of |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 771 | % pixel_wands view. |
| 772 | % |
| 773 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 774 | MagickExport ImageView *NewImageViewRegion(Image *image,const ssize_t x, |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 775 | const ssize_t y,const size_t width,const size_t height) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 776 | { |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 777 | ImageView |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 778 | *image_view; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 779 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 780 | assert(image != (Image *) NULL); |
| 781 | assert(image->signature == MagickSignature); |
cristy | 73bd4a5 | 2010-10-05 11:24:23 +0000 | [diff] [blame^] | 782 | image_view=(ImageView *) AcquireMagickMemory(sizeof(*image_view)); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 783 | if (image_view == (ImageView *) NULL) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 784 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 785 | (void) ResetMagickMemory(image_view,0,sizeof(*image_view)); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 786 | image_view->description=ConstantString("ImageView"); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 787 | image_view->view=AcquireCacheView(image_view->image); |
| 788 | image_view->image=image; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 789 | image_view->extent.width=width; |
| 790 | image_view->extent.height=height; |
| 791 | image_view->extent.x=x; |
| 792 | image_view->extent.y=y; |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 793 | image_view->number_threads=GetOpenMPMaximumThreads(); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 794 | image_view->exception=AcquireExceptionInfo(); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 795 | image_view->debug=IsEventLogging(); |
| 796 | image_view->signature=MagickSignature; |
| 797 | return(image_view); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 798 | } |
| 799 | |
| 800 | /* |
| 801 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 802 | % % |
| 803 | % % |
| 804 | % % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 805 | % S e t I m a g e V i e w D e s c r i p t i o n % |
| 806 | % % |
| 807 | % % |
| 808 | % % |
| 809 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 810 | % |
| 811 | % SetImageViewDescription() associates a description with an image view. |
| 812 | % |
| 813 | % The format of the SetImageViewDescription method is: |
| 814 | % |
| 815 | % void SetImageViewDescription(ImageView *image_view, |
| 816 | % const char *description) |
| 817 | % |
| 818 | % A description of each parameter follows: |
| 819 | % |
| 820 | % o image_view: the image view. |
| 821 | % |
| 822 | % o description: the image view description. |
| 823 | % |
| 824 | */ |
| 825 | MagickExport void SetImageViewDescription(ImageView *image_view, |
| 826 | const char *description) |
| 827 | { |
| 828 | assert(image_view != (ImageView *) NULL); |
| 829 | assert(image_view->signature == MagickSignature); |
| 830 | image_view->description=ConstantString(description); |
| 831 | } |
| 832 | |
| 833 | /* |
| 834 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 835 | % % |
| 836 | % % |
| 837 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 838 | % S e t I m a g e V i e w I t e r a t o r % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 839 | % % |
| 840 | % % |
| 841 | % % |
| 842 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 843 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 844 | % SetImageViewIterator() iterates over the image view in parallel and calls |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 845 | % your set method for each scanline of the view. The pixel extent is |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 846 | % confined to the image canvas-- that is no negative offsets or widths or |
| 847 | % heights that exceed the image dimension. The pixels are initiallly |
| 848 | % undefined and any settings you make in the callback method are automagically |
| 849 | % synced back to your image. |
| 850 | % |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 851 | % The callback signature is: |
| 852 | % |
| 853 | % MagickBooleanType SetImageViewMethod(ImageView *destination, |
| 854 | % const ssize_t y,const int thread_id,void *context) |
| 855 | % |
cristy | 5873947 | 2010-06-26 20:27:18 +0000 | [diff] [blame] | 856 | % Use this pragma if the view is not single threaded: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 857 | % |
| 858 | % #pragma omp critical |
| 859 | % |
| 860 | % to define a section of code in your callback set method that must be |
| 861 | % executed by a single thread at a time. |
| 862 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 863 | % The format of the SetImageViewIterator method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 864 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 865 | % MagickBooleanType SetImageViewIterator(ImageView *destination, |
| 866 | % SetImageViewMethod set,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 867 | % |
| 868 | % A description of each parameter follows: |
| 869 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 870 | % o destination: the image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 871 | % |
| 872 | % o set: the set callback method. |
| 873 | % |
| 874 | % o context: the user defined context. |
| 875 | % |
| 876 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 877 | MagickExport MagickBooleanType SetImageViewIterator(ImageView *destination, |
| 878 | SetImageViewMethod set,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 879 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 880 | ExceptionInfo |
| 881 | *exception; |
| 882 | |
| 883 | Image |
| 884 | *destination_image; |
| 885 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 886 | MagickBooleanType |
| 887 | status; |
| 888 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 889 | MagickOffsetType |
| 890 | progress; |
| 891 | |
| 892 | ssize_t |
| 893 | y; |
| 894 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 895 | assert(destination != (ImageView *) NULL); |
| 896 | assert(destination->signature == MagickSignature); |
| 897 | if (set == (SetImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 898 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 899 | destination_image=destination->image; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 900 | if (SetImageStorageClass(destination_image,DirectClass) == MagickFalse) |
| 901 | return(MagickFalse); |
| 902 | status=MagickTrue; |
| 903 | progress=0; |
| 904 | exception=destination->exception; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 905 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 309f613 | 2010-06-07 13:19:01 +0000 | [diff] [blame] | 906 | #pragma omp parallel for schedule(static,1) shared(progress,status) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 907 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 908 | for (y=destination->extent.y; y < (ssize_t) destination->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 909 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 910 | const int |
| 911 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 912 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 913 | MagickBooleanType |
| 914 | sync; |
| 915 | |
| 916 | register IndexPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 917 | *restrict indexes; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 918 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 919 | register PixelPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 920 | *restrict pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 921 | |
| 922 | if (status == MagickFalse) |
| 923 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 924 | pixels=GetCacheViewAuthenticPixels(destination->view,destination->extent.x, |
| 925 | y,destination->extent.width,1,exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 926 | if (pixels == (PixelPacket *) NULL) |
| 927 | { |
| 928 | InheritException(destination->exception,GetCacheViewException( |
| 929 | destination->view)); |
| 930 | status=MagickFalse; |
| 931 | continue; |
| 932 | } |
| 933 | indexes=GetCacheViewAuthenticIndexQueue(destination->view); |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 934 | if (set(destination,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 935 | status=MagickFalse; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 936 | sync=SyncCacheViewAuthenticPixels(destination->view,exception); |
| 937 | if (sync == MagickFalse) |
| 938 | { |
| 939 | InheritException(destination->exception,GetCacheViewException( |
| 940 | destination->view)); |
| 941 | status=MagickFalse; |
| 942 | } |
| 943 | if (destination_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 944 | { |
| 945 | MagickBooleanType |
| 946 | proceed; |
| 947 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 948 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 949 | #pragma omp critical (MagickCore_SetImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 950 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 951 | proceed=SetImageProgress(destination_image,destination->description, |
| 952 | progress++,destination->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 953 | if (proceed == MagickFalse) |
| 954 | status=MagickFalse; |
| 955 | } |
| 956 | } |
| 957 | return(status); |
| 958 | } |
| 959 | |
| 960 | /* |
| 961 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 962 | % % |
| 963 | % % |
| 964 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 965 | % T r a n s f e r I m a g e V i e w I t e r a t o r % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 966 | % % |
| 967 | % % |
| 968 | % % |
| 969 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 970 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 971 | % TransferImageViewIterator() iterates over two image views in parallel and |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 972 | % calls your transfer method for each scanline of the view. The source pixel |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 973 | % extent is not confined to the image canvas-- that is you can include |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 974 | % negative offsets or widths or heights that exceed the image dimension. |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 975 | % However, the destination image view is confined to the image canvas-- that |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 976 | % is no negative offsets or widths or heights that exceed the image dimension |
| 977 | % are permitted. |
| 978 | % |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 979 | % The callback signature is: |
| 980 | % |
| 981 | % MagickBooleanType TransferImageViewMethod(const ImageView *source, |
| 982 | % ImageView *destination,const ssize_t y,const int thread_id, |
| 983 | % void *context) |
| 984 | % |
cristy | 5873947 | 2010-06-26 20:27:18 +0000 | [diff] [blame] | 985 | % Use this pragma if the view is not single threaded: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 986 | % |
| 987 | % #pragma omp critical |
| 988 | % |
| 989 | % to define a section of code in your callback transfer method that must be |
| 990 | % executed by a single thread at a time. |
| 991 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 992 | % The format of the TransferImageViewIterator method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 993 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 994 | % MagickBooleanType TransferImageViewIterator(ImageView *source, |
| 995 | % ImageView *destination,TransferImageViewMethod transfer,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 996 | % |
| 997 | % A description of each parameter follows: |
| 998 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 999 | % o source: the source image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1000 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 1001 | % o destination: the destination image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1002 | % |
| 1003 | % o transfer: the transfer callback method. |
| 1004 | % |
| 1005 | % o context: the user defined context. |
| 1006 | % |
| 1007 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1008 | MagickExport MagickBooleanType TransferImageViewIterator(ImageView *source, |
| 1009 | ImageView *destination,TransferImageViewMethod transfer,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1010 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1011 | ExceptionInfo |
| 1012 | *exception; |
| 1013 | |
| 1014 | Image |
| 1015 | *destination_image, |
| 1016 | *source_image; |
| 1017 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1018 | MagickBooleanType |
| 1019 | status; |
| 1020 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 1021 | MagickOffsetType |
| 1022 | progress; |
| 1023 | |
| 1024 | ssize_t |
| 1025 | y; |
| 1026 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1027 | assert(source != (ImageView *) NULL); |
| 1028 | assert(source->signature == MagickSignature); |
| 1029 | if (transfer == (TransferImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1030 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1031 | source_image=source->image; |
| 1032 | destination_image=destination->image; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1033 | if (SetImageStorageClass(destination_image,DirectClass) == MagickFalse) |
| 1034 | return(MagickFalse); |
| 1035 | status=MagickTrue; |
| 1036 | progress=0; |
| 1037 | exception=destination->exception; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 1038 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 309f613 | 2010-06-07 13:19:01 +0000 | [diff] [blame] | 1039 | #pragma omp parallel for schedule(static,1) shared(progress,status) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1040 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1041 | for (y=source->extent.y; y < (ssize_t) source->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1042 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 1043 | const int |
| 1044 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 1045 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1046 | MagickBooleanType |
| 1047 | sync; |
| 1048 | |
| 1049 | register const IndexPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 1050 | *restrict indexes; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1051 | |
| 1052 | register const PixelPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 1053 | *restrict pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1054 | |
| 1055 | register IndexPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 1056 | *restrict destination_indexes; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1057 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1058 | register PixelPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 1059 | *restrict destination_pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1060 | |
| 1061 | if (status == MagickFalse) |
| 1062 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1063 | pixels=GetCacheViewVirtualPixels(source->view,source->extent.x,y, |
| 1064 | source->extent.width,1,source->exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1065 | if (pixels == (const PixelPacket *) NULL) |
| 1066 | { |
| 1067 | status=MagickFalse; |
| 1068 | continue; |
| 1069 | } |
| 1070 | indexes=GetCacheViewVirtualIndexQueue(source->view); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1071 | destination_pixels=GetCacheViewAuthenticPixels(destination->view, |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1072 | destination->extent.x,y,destination->extent.width,1,exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1073 | if (destination_pixels == (PixelPacket *) NULL) |
| 1074 | { |
| 1075 | status=MagickFalse; |
| 1076 | continue; |
| 1077 | } |
| 1078 | destination_indexes=GetCacheViewAuthenticIndexQueue(destination->view); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1079 | if (transfer(source,destination,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1080 | status=MagickFalse; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1081 | sync=SyncCacheViewAuthenticPixels(destination->view,exception); |
| 1082 | if (sync == MagickFalse) |
| 1083 | { |
| 1084 | InheritException(destination->exception,GetCacheViewException( |
| 1085 | source->view)); |
| 1086 | status=MagickFalse; |
| 1087 | } |
| 1088 | if (source_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 1089 | { |
| 1090 | MagickBooleanType |
| 1091 | proceed; |
| 1092 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 1093 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1094 | #pragma omp critical (MagickCore_TransferImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1095 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1096 | proceed=SetImageProgress(source_image,source->description,progress++, |
| 1097 | source->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1098 | if (proceed == MagickFalse) |
| 1099 | status=MagickFalse; |
| 1100 | } |
| 1101 | } |
| 1102 | return(status); |
| 1103 | } |
| 1104 | |
| 1105 | /* |
| 1106 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1107 | % % |
| 1108 | % % |
| 1109 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1110 | % U p d a t e I m a g e V i e w I t e r a t o r % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1111 | % % |
| 1112 | % % |
| 1113 | % % |
| 1114 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1115 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 1116 | % UpdateImageViewIterator() iterates over the image view in parallel and calls |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1117 | % your update method for each scanline of the view. The pixel extent is |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1118 | % confined to the image canvas-- that is no negative offsets or widths or |
| 1119 | % heights that exceed the image dimension are permitted. Updates to pixels |
| 1120 | % in your callback are automagically synced back to the image. |
| 1121 | % |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 1122 | % The callback signature is: |
| 1123 | % |
| 1124 | % MagickBooleanType UpdateImageViewMethod(ImageView *source, |
| 1125 | % const ssize_t y,const int thread_id,void *context) |
| 1126 | % |
cristy | 5873947 | 2010-06-26 20:27:18 +0000 | [diff] [blame] | 1127 | % Use this pragma if the view is not single threaded: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1128 | % |
| 1129 | % #pragma omp critical |
| 1130 | % |
| 1131 | % to define a section of code in your callback update method that must be |
| 1132 | % executed by a single thread at a time. |
| 1133 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1134 | % The format of the UpdateImageViewIterator method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1135 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1136 | % MagickBooleanType UpdateImageViewIterator(ImageView *source, |
| 1137 | % UpdateImageViewMethod update,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1138 | % |
| 1139 | % A description of each parameter follows: |
| 1140 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 1141 | % o source: the source image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1142 | % |
| 1143 | % o update: the update callback method. |
| 1144 | % |
| 1145 | % o context: the user defined context. |
| 1146 | % |
| 1147 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1148 | MagickExport MagickBooleanType UpdateImageViewIterator(ImageView *source, |
| 1149 | UpdateImageViewMethod update,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1150 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1151 | ExceptionInfo |
| 1152 | *exception; |
| 1153 | |
| 1154 | Image |
| 1155 | *source_image; |
| 1156 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1157 | MagickBooleanType |
| 1158 | status; |
| 1159 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 1160 | MagickOffsetType |
| 1161 | progress; |
| 1162 | |
| 1163 | ssize_t |
| 1164 | y; |
| 1165 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1166 | assert(source != (ImageView *) NULL); |
| 1167 | assert(source->signature == MagickSignature); |
| 1168 | if (update == (UpdateImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1169 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1170 | source_image=source->image; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1171 | if (SetImageStorageClass(source_image,DirectClass) == MagickFalse) |
| 1172 | return(MagickFalse); |
| 1173 | status=MagickTrue; |
| 1174 | progress=0; |
| 1175 | exception=source->exception; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 1176 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 309f613 | 2010-06-07 13:19:01 +0000 | [diff] [blame] | 1177 | #pragma omp parallel for schedule(static,1) shared(progress,status) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1178 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1179 | for (y=source->extent.y; y < (ssize_t) source->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1180 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 1181 | const int |
| 1182 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 1183 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1184 | register IndexPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 1185 | *restrict indexes; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1186 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1187 | register PixelPacket |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 1188 | *restrict pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1189 | |
| 1190 | if (status == MagickFalse) |
| 1191 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1192 | pixels=GetCacheViewAuthenticPixels(source->view,source->extent.x,y, |
| 1193 | source->extent.width,1,exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1194 | if (pixels == (PixelPacket *) NULL) |
| 1195 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 1196 | InheritException(source->exception,GetCacheViewException(source->view)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1197 | status=MagickFalse; |
| 1198 | continue; |
| 1199 | } |
| 1200 | indexes=GetCacheViewAuthenticIndexQueue(source->view); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1201 | if (update(source,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1202 | status=MagickFalse; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1203 | if (SyncCacheViewAuthenticPixels(source->view,exception) == MagickFalse) |
| 1204 | { |
| 1205 | InheritException(source->exception,GetCacheViewException(source->view)); |
| 1206 | status=MagickFalse; |
| 1207 | } |
| 1208 | if (source_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 1209 | { |
| 1210 | MagickBooleanType |
| 1211 | proceed; |
| 1212 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 1213 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1214 | #pragma omp critical (MagickCore_UpdateImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1215 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1216 | proceed=SetImageProgress(source_image,source->description,progress++, |
| 1217 | source->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1218 | if (proceed == MagickFalse) |
| 1219 | status=MagickFalse; |
| 1220 | } |
| 1221 | } |
| 1222 | return(status); |
| 1223 | } |