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