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 | 1454be7 | 2011-12-19 01:52:48 +0000 | [diff] [blame^] | 25 | % Copyright 1999-2012 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 | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 48 | #include "MagickCore/studio.h" |
| 49 | #include "MagickCore/MagickCore.h" |
| 50 | #include "MagickCore/exception-private.h" |
| 51 | #include "MagickCore/monitor-private.h" |
| 52 | #include "MagickCore/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 | Image |
| 219 | *destination_image, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 220 | *source_image; |
| 221 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 222 | MagickBooleanType |
| 223 | status; |
| 224 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 225 | MagickOffsetType |
| 226 | progress; |
| 227 | |
| 228 | ssize_t |
| 229 | y; |
| 230 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 231 | assert(source != (ImageView *) NULL); |
| 232 | assert(source->signature == MagickSignature); |
| 233 | if (transfer == (DuplexTransferImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 234 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 235 | source_image=source->image; |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 236 | destination_image=destination->image; |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 237 | status=SetImageStorageClass(destination_image,DirectClass, |
| 238 | destination->exception); |
| 239 | if (status == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 240 | return(MagickFalse); |
| 241 | status=MagickTrue; |
| 242 | progress=0; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 243 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 09d8117 | 2010-10-21 16:15:05 +0000 | [diff] [blame] | 244 | #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 245 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 246 | for (y=source->extent.y; y < (ssize_t) source->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 247 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 248 | const int |
| 249 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 250 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 251 | MagickBooleanType |
| 252 | sync; |
| 253 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 254 | register const Quantum |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 255 | *restrict duplex_pixels, |
| 256 | *restrict pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 257 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 258 | register Quantum |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 259 | *restrict destination_pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 260 | |
| 261 | if (status == MagickFalse) |
| 262 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 263 | pixels=GetCacheViewVirtualPixels(source->view,source->extent.x,y, |
| 264 | source->extent.width,1,source->exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 265 | if (pixels == (const Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 266 | { |
| 267 | status=MagickFalse; |
| 268 | continue; |
| 269 | } |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 270 | duplex_pixels=GetCacheViewVirtualPixels(duplex->view,duplex->extent.x,y, |
| 271 | duplex->extent.width,1,duplex->exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 272 | if (duplex_pixels == (const Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 273 | { |
| 274 | status=MagickFalse; |
| 275 | continue; |
| 276 | } |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 277 | destination_pixels=GetCacheViewAuthenticPixels(destination->view, |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 278 | destination->extent.x,y,destination->extent.width,1, |
| 279 | destination->exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 280 | if (destination_pixels == (Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 281 | { |
| 282 | status=MagickFalse; |
| 283 | continue; |
| 284 | } |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 285 | if (transfer(source,duplex,destination,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 286 | status=MagickFalse; |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 287 | sync=SyncCacheViewAuthenticPixels(destination->view,destination->exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 288 | if (sync == MagickFalse) |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 289 | status=MagickFalse; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 290 | if (source_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 291 | { |
| 292 | MagickBooleanType |
| 293 | proceed; |
| 294 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 295 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 296 | #pragma omp critical (MagickCore_DuplexTransferImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 297 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 298 | proceed=SetImageProgress(source_image,source->description,progress++, |
| 299 | source->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 300 | if (proceed == MagickFalse) |
| 301 | status=MagickFalse; |
| 302 | } |
| 303 | } |
| 304 | return(status); |
| 305 | } |
| 306 | |
| 307 | /* |
| 308 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 309 | % % |
| 310 | % % |
| 311 | % % |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 312 | % G e t I m a g e V i e w A u t h e n t i c M e t a c o n t e n t % |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 313 | % % |
| 314 | % % |
| 315 | % % |
| 316 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 317 | % |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 318 | % GetImageViewAuthenticMetacontent() returns the image view authentic |
| 319 | % meta-content. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 320 | % |
| 321 | % The format of the GetImageViewAuthenticPixels method is: |
| 322 | % |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 323 | % void *GetImageViewAuthenticMetacontent( |
| 324 | % const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 325 | % |
| 326 | % A description of each parameter follows: |
| 327 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 328 | % o image_view: the image view. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 329 | % |
| 330 | */ |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 331 | MagickExport void *GetImageViewAuthenticMetacontent( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 332 | const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 333 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 334 | assert(image_view != (ImageView *) NULL); |
| 335 | assert(image_view->signature == MagickSignature); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 336 | return(GetCacheViewAuthenticMetacontent(image_view->view)); |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | /* |
| 340 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 341 | % % |
| 342 | % % |
| 343 | % % |
| 344 | % 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 % |
| 345 | % % |
| 346 | % % |
| 347 | % % |
| 348 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 349 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 350 | % GetImageViewAuthenticPixels() returns the image view authentic pixels. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 351 | % |
| 352 | % The format of the GetImageViewAuthenticPixels method is: |
| 353 | % |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 354 | % Quantum *GetImageViewAuthenticPixels(const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 355 | % |
| 356 | % A description of each parameter follows: |
| 357 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 358 | % o image_view: the image view. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 359 | % |
| 360 | */ |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 361 | MagickExport Quantum *GetImageViewAuthenticPixels( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 362 | const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 363 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 364 | assert(image_view != (ImageView *) NULL); |
| 365 | assert(image_view->signature == MagickSignature); |
| 366 | return(GetCacheViewAuthenticPixelQueue(image_view->view)); |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 367 | } |
| 368 | |
| 369 | /* |
| 370 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 371 | % % |
| 372 | % % |
| 373 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 374 | % 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] | 375 | % % |
| 376 | % % |
| 377 | % % |
| 378 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 379 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 380 | % GetImageViewException() returns the severity, reason, and description of any |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 381 | % error that occurs when utilizing a image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 382 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 383 | % The format of the GetImageViewException method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 384 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 385 | % char *GetImageViewException(const PixelImage *image_view, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 386 | % ExceptionType *severity) |
| 387 | % |
| 388 | % A description of each parameter follows: |
| 389 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 390 | % o image_view: the pixel image_view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 391 | % |
| 392 | % o severity: the severity of the error is returned here. |
| 393 | % |
| 394 | */ |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 395 | MagickExport char *GetImageViewException(const ImageView *image_view, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 396 | ExceptionType *severity) |
| 397 | { |
| 398 | char |
| 399 | *description; |
| 400 | |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 401 | assert(image_view != (const ImageView *) NULL); |
| 402 | assert(image_view->signature == MagickSignature); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 403 | assert(severity != (ExceptionType *) NULL); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 404 | *severity=image_view->exception->severity; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 405 | description=(char *) AcquireQuantumMemory(2UL*MaxTextExtent, |
| 406 | sizeof(*description)); |
| 407 | if (description == (char *) NULL) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 408 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 409 | *description='\0'; |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 410 | if (image_view->exception->reason != (char *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 411 | (void) CopyMagickString(description,GetLocaleExceptionMessage( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 412 | image_view->exception->severity,image_view->exception->reason), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 413 | MaxTextExtent); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 414 | if (image_view->exception->description != (char *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 415 | { |
| 416 | (void) ConcatenateMagickString(description," (",MaxTextExtent); |
| 417 | (void) ConcatenateMagickString(description,GetLocaleExceptionMessage( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 418 | image_view->exception->severity,image_view->exception->description), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 419 | MaxTextExtent); |
| 420 | (void) ConcatenateMagickString(description,")",MaxTextExtent); |
| 421 | } |
| 422 | return(description); |
| 423 | } |
| 424 | |
| 425 | /* |
| 426 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 427 | % % |
| 428 | % % |
| 429 | % % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 430 | % 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] | 431 | % % |
| 432 | % % |
| 433 | % % |
| 434 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 435 | % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 436 | % GetImageViewExtent() returns the image view extent. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 437 | % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 438 | % The format of the GetImageViewExtent method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 439 | % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 440 | % RectangleInfo GetImageViewExtent(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 441 | % |
| 442 | % A description of each parameter follows: |
| 443 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 444 | % o image_view: the image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 445 | % |
| 446 | */ |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 447 | MagickExport RectangleInfo GetImageViewExtent(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 448 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 449 | assert(image_view != (ImageView *) NULL); |
| 450 | assert(image_view->signature == MagickSignature); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 451 | return(image_view->extent); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | /* |
| 455 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 456 | % % |
| 457 | % % |
| 458 | % % |
| 459 | % G e t I m a g e V i e w I m a g e % |
| 460 | % % |
| 461 | % % |
| 462 | % % |
| 463 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 464 | % |
| 465 | % GetImageViewImage() returns the image associated with the image view. |
| 466 | % |
| 467 | % The format of the GetImageViewImage method is: |
| 468 | % |
| 469 | % MagickCore *GetImageViewImage(const ImageView *image_view) |
| 470 | % |
| 471 | % A description of each parameter follows: |
| 472 | % |
| 473 | % o image_view: the image view. |
| 474 | % |
| 475 | */ |
| 476 | MagickExport Image *GetImageViewImage(const ImageView *image_view) |
| 477 | { |
| 478 | assert(image_view != (ImageView *) NULL); |
| 479 | assert(image_view->signature == MagickSignature); |
| 480 | return(image_view->image); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 481 | } |
| 482 | |
| 483 | /* |
| 484 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 485 | % % |
| 486 | % % |
| 487 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 488 | % 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] | 489 | % % |
| 490 | % % |
| 491 | % % |
| 492 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 493 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 494 | % GetImageViewIterator() iterates over the image view in parallel and calls |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 495 | % your get method for each scanline of the view. The pixel extent is |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 496 | % not confined to the image canvas-- that is you can include negative offsets |
| 497 | % or widths or heights that exceed the image dimension. Any updates to |
| 498 | % the pixels in your callback are ignored. |
| 499 | % |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 500 | % The callback signature is: |
| 501 | % |
| 502 | % MagickBooleanType GetImageViewMethod(const ImageView *source, |
| 503 | % const ssize_t y,const int thread_id,void *context) |
| 504 | % |
cristy | 5873947 | 2010-06-26 20:27:18 +0000 | [diff] [blame] | 505 | % Use this pragma if the view is not single threaded: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 506 | % |
| 507 | % #pragma omp critical |
| 508 | % |
| 509 | % to define a section of code in your callback get method that must be |
| 510 | % executed by a single thread at a time. |
| 511 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 512 | % The format of the GetImageViewIterator method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 513 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 514 | % MagickBooleanType GetImageViewIterator(ImageView *source, |
| 515 | % GetImageViewMethod get,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 516 | % |
| 517 | % A description of each parameter follows: |
| 518 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 519 | % o source: the source image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 520 | % |
| 521 | % o get: the get callback method. |
| 522 | % |
| 523 | % o context: the user defined context. |
| 524 | % |
| 525 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 526 | MagickExport MagickBooleanType GetImageViewIterator(ImageView *source, |
| 527 | GetImageViewMethod get,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 528 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 529 | Image |
| 530 | *source_image; |
| 531 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 532 | MagickBooleanType |
| 533 | status; |
| 534 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 535 | MagickOffsetType |
| 536 | progress; |
| 537 | |
| 538 | ssize_t |
| 539 | y; |
| 540 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 541 | assert(source != (ImageView *) NULL); |
| 542 | assert(source->signature == MagickSignature); |
| 543 | if (get == (GetImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 544 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 545 | source_image=source->image; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 546 | status=MagickTrue; |
| 547 | progress=0; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 548 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 09d8117 | 2010-10-21 16:15:05 +0000 | [diff] [blame] | 549 | #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 550 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 551 | for (y=source->extent.y; y < (ssize_t) source->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 552 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 553 | const int |
| 554 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 555 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 556 | register const Quantum |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 557 | *pixels; |
| 558 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 559 | if (status == MagickFalse) |
| 560 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 561 | pixels=GetCacheViewVirtualPixels(source->view,source->extent.x,y, |
| 562 | source->extent.width,1,source->exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 563 | if (pixels == (const Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 564 | { |
| 565 | status=MagickFalse; |
| 566 | continue; |
| 567 | } |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 568 | if (get(source,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 569 | status=MagickFalse; |
| 570 | if (source_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 571 | { |
| 572 | MagickBooleanType |
| 573 | proceed; |
| 574 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 575 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 576 | #pragma omp critical (MagickCore_GetImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 577 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 578 | proceed=SetImageProgress(source_image,source->description,progress++, |
| 579 | source->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 580 | if (proceed == MagickFalse) |
| 581 | status=MagickFalse; |
| 582 | } |
| 583 | } |
| 584 | return(status); |
| 585 | } |
| 586 | |
| 587 | /* |
| 588 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 589 | % % |
| 590 | % % |
| 591 | % % |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 592 | % G e t I m a g e V i e w V i r t u a l M e t a c o n t e n t % |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 593 | % % |
| 594 | % % |
| 595 | % % |
| 596 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 597 | % |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 598 | % GetImageViewVirtualMetacontent() returns the image view virtual |
| 599 | % meta-content. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 600 | % |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 601 | % The format of the GetImageViewVirtualMetacontent method is: |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 602 | % |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 603 | % const void *GetImageViewVirtualMetacontent( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 604 | % const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 605 | % |
| 606 | % A description of each parameter follows: |
| 607 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 608 | % o image_view: the image view. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 609 | % |
| 610 | */ |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 611 | MagickExport const void *GetImageViewVirtualMetacontent( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 612 | const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 613 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 614 | assert(image_view != (ImageView *) NULL); |
| 615 | assert(image_view->signature == MagickSignature); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 616 | return(GetCacheViewVirtualMetacontent(image_view->view)); |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | /* |
| 620 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 621 | % % |
| 622 | % % |
| 623 | % % |
| 624 | % 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 % |
| 625 | % % |
| 626 | % % |
| 627 | % % |
| 628 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 629 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 630 | % GetImageViewVirtualPixels() returns the image view virtual pixels. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 631 | % |
| 632 | % The format of the GetImageViewVirtualPixels method is: |
| 633 | % |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 634 | % const Quantum *GetImageViewVirtualPixels(const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 635 | % |
| 636 | % A description of each parameter follows: |
| 637 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 638 | % o image_view: the image view. |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 639 | % |
| 640 | */ |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 641 | MagickExport const Quantum *GetImageViewVirtualPixels( |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 642 | const ImageView *image_view) |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 643 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 644 | assert(image_view != (ImageView *) NULL); |
| 645 | assert(image_view->signature == MagickSignature); |
| 646 | return(GetCacheViewVirtualPixelQueue(image_view->view)); |
cristy | cc34c49 | 2010-06-26 23:49:12 +0000 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | /* |
| 650 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 651 | % % |
| 652 | % % |
| 653 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 654 | % I s I m a g e V i e w % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 655 | % % |
| 656 | % % |
| 657 | % % |
| 658 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 659 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 660 | % IsImageView() returns MagickTrue if the the parameter is verified as a image |
| 661 | % view object. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 662 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 663 | % The format of the IsImageView method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 664 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 665 | % MagickBooleanType IsImageView(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 666 | % |
| 667 | % A description of each parameter follows: |
| 668 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 669 | % o image_view: the image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 670 | % |
| 671 | */ |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 672 | MagickExport MagickBooleanType IsImageView(const ImageView *image_view) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 673 | { |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 674 | if (image_view == (const ImageView *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 675 | return(MagickFalse); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 676 | if (image_view->signature != MagickSignature) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 677 | return(MagickFalse); |
| 678 | return(MagickTrue); |
| 679 | } |
| 680 | |
| 681 | /* |
| 682 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 683 | % % |
| 684 | % % |
| 685 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 686 | % N e w I m a g e V i e w % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 687 | % % |
| 688 | % % |
| 689 | % % |
| 690 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 691 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 692 | % NewImageView() returns a image view required for all other methods in the |
| 693 | % Image View API. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 694 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 695 | % The format of the NewImageView method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 696 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 697 | % ImageView *NewImageView(MagickCore *wand) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 698 | % |
| 699 | % A description of each parameter follows: |
| 700 | % |
| 701 | % o wand: the wand. |
| 702 | % |
| 703 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 704 | MagickExport ImageView *NewImageView(Image *image) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 705 | { |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 706 | ImageView |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 707 | *image_view; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 708 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 709 | assert(image != (Image *) NULL); |
| 710 | assert(image->signature == MagickSignature); |
cristy | 73bd4a5 | 2010-10-05 11:24:23 +0000 | [diff] [blame] | 711 | image_view=(ImageView *) AcquireMagickMemory(sizeof(*image_view)); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 712 | if (image_view == (ImageView *) NULL) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 713 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 714 | (void) ResetMagickMemory(image_view,0,sizeof(*image_view)); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 715 | image_view->description=ConstantString("ImageView"); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 716 | image_view->image=image; |
| 717 | image_view->view=AcquireCacheView(image_view->image); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 718 | image_view->extent.width=image->columns; |
| 719 | image_view->extent.height=image->rows; |
| 720 | image_view->extent.x=0; |
| 721 | image_view->extent.y=0; |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 722 | image_view->number_threads=GetOpenMPMaximumThreads(); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 723 | image_view->exception=AcquireExceptionInfo(); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 724 | image_view->debug=IsEventLogging(); |
| 725 | image_view->signature=MagickSignature; |
| 726 | return(image_view); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 727 | } |
| 728 | |
| 729 | /* |
| 730 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 731 | % % |
| 732 | % % |
| 733 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 734 | % 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] | 735 | % % |
| 736 | % % |
| 737 | % % |
| 738 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 739 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 740 | % NewImageViewRegion() returns a image view required for all other methods |
| 741 | % in the Image View API. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 742 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 743 | % The format of the NewImageViewRegion method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 744 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 745 | % ImageView *NewImageViewRegion(MagickCore *wand,const ssize_t x, |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 746 | % const ssize_t y,const size_t width,const size_t height) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 747 | % |
| 748 | % A description of each parameter follows: |
| 749 | % |
| 750 | % o wand: the magick wand. |
| 751 | % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 752 | % 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] | 753 | % pixel_wands view. |
| 754 | % |
| 755 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 756 | MagickExport ImageView *NewImageViewRegion(Image *image,const ssize_t x, |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 757 | const ssize_t y,const size_t width,const size_t height) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 758 | { |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 759 | ImageView |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 760 | *image_view; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 761 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 762 | assert(image != (Image *) NULL); |
| 763 | assert(image->signature == MagickSignature); |
cristy | 73bd4a5 | 2010-10-05 11:24:23 +0000 | [diff] [blame] | 764 | image_view=(ImageView *) AcquireMagickMemory(sizeof(*image_view)); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 765 | if (image_view == (ImageView *) NULL) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 766 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 767 | (void) ResetMagickMemory(image_view,0,sizeof(*image_view)); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 768 | image_view->description=ConstantString("ImageView"); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 769 | image_view->view=AcquireCacheView(image_view->image); |
| 770 | image_view->image=image; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 771 | image_view->extent.width=width; |
| 772 | image_view->extent.height=height; |
| 773 | image_view->extent.x=x; |
| 774 | image_view->extent.y=y; |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 775 | image_view->number_threads=GetOpenMPMaximumThreads(); |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 776 | image_view->exception=AcquireExceptionInfo(); |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 777 | image_view->debug=IsEventLogging(); |
| 778 | image_view->signature=MagickSignature; |
| 779 | return(image_view); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 780 | } |
| 781 | |
| 782 | /* |
| 783 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 784 | % % |
| 785 | % % |
| 786 | % % |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 787 | % S e t I m a g e V i e w D e s c r i p t i o n % |
| 788 | % % |
| 789 | % % |
| 790 | % % |
| 791 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 792 | % |
| 793 | % SetImageViewDescription() associates a description with an image view. |
| 794 | % |
| 795 | % The format of the SetImageViewDescription method is: |
| 796 | % |
| 797 | % void SetImageViewDescription(ImageView *image_view, |
| 798 | % const char *description) |
| 799 | % |
| 800 | % A description of each parameter follows: |
| 801 | % |
| 802 | % o image_view: the image view. |
| 803 | % |
| 804 | % o description: the image view description. |
| 805 | % |
| 806 | */ |
| 807 | MagickExport void SetImageViewDescription(ImageView *image_view, |
| 808 | const char *description) |
| 809 | { |
| 810 | assert(image_view != (ImageView *) NULL); |
| 811 | assert(image_view->signature == MagickSignature); |
| 812 | image_view->description=ConstantString(description); |
| 813 | } |
| 814 | |
| 815 | /* |
| 816 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 817 | % % |
| 818 | % % |
| 819 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 820 | % 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] | 821 | % % |
| 822 | % % |
| 823 | % % |
| 824 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 825 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 826 | % SetImageViewIterator() iterates over the image view in parallel and calls |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 827 | % your set method for each scanline of the view. The pixel extent is |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 828 | % confined to the image canvas-- that is no negative offsets or widths or |
| 829 | % heights that exceed the image dimension. The pixels are initiallly |
| 830 | % undefined and any settings you make in the callback method are automagically |
| 831 | % synced back to your image. |
| 832 | % |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 833 | % The callback signature is: |
| 834 | % |
| 835 | % MagickBooleanType SetImageViewMethod(ImageView *destination, |
| 836 | % const ssize_t y,const int thread_id,void *context) |
| 837 | % |
cristy | 5873947 | 2010-06-26 20:27:18 +0000 | [diff] [blame] | 838 | % Use this pragma if the view is not single threaded: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 839 | % |
| 840 | % #pragma omp critical |
| 841 | % |
| 842 | % to define a section of code in your callback set method that must be |
| 843 | % executed by a single thread at a time. |
| 844 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 845 | % The format of the SetImageViewIterator method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 846 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 847 | % MagickBooleanType SetImageViewIterator(ImageView *destination, |
| 848 | % SetImageViewMethod set,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 849 | % |
| 850 | % A description of each parameter follows: |
| 851 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 852 | % o destination: the image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 853 | % |
| 854 | % o set: the set callback method. |
| 855 | % |
| 856 | % o context: the user defined context. |
| 857 | % |
| 858 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 859 | MagickExport MagickBooleanType SetImageViewIterator(ImageView *destination, |
| 860 | SetImageViewMethod set,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 861 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 862 | Image |
| 863 | *destination_image; |
| 864 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 865 | MagickBooleanType |
| 866 | status; |
| 867 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 868 | MagickOffsetType |
| 869 | progress; |
| 870 | |
| 871 | ssize_t |
| 872 | y; |
| 873 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 874 | assert(destination != (ImageView *) NULL); |
| 875 | assert(destination->signature == MagickSignature); |
| 876 | if (set == (SetImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 877 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 878 | destination_image=destination->image; |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 879 | status=SetImageStorageClass(destination_image,DirectClass, |
| 880 | destination->exception); |
| 881 | if (status == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 882 | return(MagickFalse); |
| 883 | status=MagickTrue; |
| 884 | progress=0; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 885 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 09d8117 | 2010-10-21 16:15:05 +0000 | [diff] [blame] | 886 | #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(destination->number_threads) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 887 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 888 | for (y=destination->extent.y; y < (ssize_t) destination->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 889 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 890 | const int |
| 891 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 892 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 893 | MagickBooleanType |
| 894 | sync; |
| 895 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 896 | register Quantum |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 897 | *restrict pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 898 | |
| 899 | if (status == MagickFalse) |
| 900 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 901 | pixels=GetCacheViewAuthenticPixels(destination->view,destination->extent.x, |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 902 | y,destination->extent.width,1,destination->exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 903 | if (pixels == (Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 904 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 905 | status=MagickFalse; |
| 906 | continue; |
| 907 | } |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 908 | if (set(destination,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 909 | status=MagickFalse; |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 910 | sync=SyncCacheViewAuthenticPixels(destination->view,destination->exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 911 | if (sync == MagickFalse) |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 912 | status=MagickFalse; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 913 | if (destination_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 914 | { |
| 915 | MagickBooleanType |
| 916 | proceed; |
| 917 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 918 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 919 | #pragma omp critical (MagickCore_SetImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 920 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 921 | proceed=SetImageProgress(destination_image,destination->description, |
| 922 | progress++,destination->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 923 | if (proceed == MagickFalse) |
| 924 | status=MagickFalse; |
| 925 | } |
| 926 | } |
| 927 | return(status); |
| 928 | } |
| 929 | |
| 930 | /* |
| 931 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 932 | % % |
| 933 | % % |
| 934 | % % |
cristy | 09d8117 | 2010-10-21 16:15:05 +0000 | [diff] [blame] | 935 | % S e t I m a g e V i e w T h r e a d s % |
| 936 | % % |
| 937 | % % |
| 938 | % % |
| 939 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 940 | % |
| 941 | % SetImageViewThreads() sets the number of threads in a thread team. |
| 942 | % |
| 943 | % The format of the SetImageViewDescription method is: |
| 944 | % |
| 945 | % void SetImageViewThreads(ImageView *image_view, |
| 946 | % const size_t number_threads) |
| 947 | % |
| 948 | % A description of each parameter follows: |
| 949 | % |
| 950 | % o image_view: the image view. |
| 951 | % |
| 952 | % o number_threads: the number of threads in a thread team. |
| 953 | % |
| 954 | */ |
| 955 | MagickExport void SetImageViewThreads(ImageView *image_view, |
| 956 | const size_t number_threads) |
| 957 | { |
| 958 | assert(image_view != (ImageView *) NULL); |
| 959 | assert(image_view->signature == MagickSignature); |
| 960 | image_view->number_threads=number_threads; |
| 961 | if (number_threads > GetOpenMPMaximumThreads()) |
| 962 | image_view->number_threads=GetOpenMPMaximumThreads(); |
| 963 | } |
| 964 | |
| 965 | /* |
| 966 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 967 | % % |
| 968 | % % |
| 969 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 970 | % 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] | 971 | % % |
| 972 | % % |
| 973 | % % |
| 974 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 975 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 976 | % TransferImageViewIterator() iterates over two image views in parallel and |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 977 | % calls your transfer method for each scanline of the view. The source pixel |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 978 | % extent is not confined to the image canvas-- that is you can include |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 979 | % negative offsets or widths or heights that exceed the image dimension. |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 980 | % However, the destination image view is confined to the image canvas-- that |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 981 | % is no negative offsets or widths or heights that exceed the image dimension |
| 982 | % are permitted. |
| 983 | % |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 984 | % The callback signature is: |
| 985 | % |
| 986 | % MagickBooleanType TransferImageViewMethod(const ImageView *source, |
| 987 | % ImageView *destination,const ssize_t y,const int thread_id, |
| 988 | % void *context) |
| 989 | % |
cristy | 5873947 | 2010-06-26 20:27:18 +0000 | [diff] [blame] | 990 | % Use this pragma if the view is not single threaded: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 991 | % |
| 992 | % #pragma omp critical |
| 993 | % |
| 994 | % to define a section of code in your callback transfer method that must be |
| 995 | % executed by a single thread at a time. |
| 996 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 997 | % The format of the TransferImageViewIterator method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 998 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 999 | % MagickBooleanType TransferImageViewIterator(ImageView *source, |
| 1000 | % ImageView *destination,TransferImageViewMethod transfer,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1001 | % |
| 1002 | % A description of each parameter follows: |
| 1003 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 1004 | % o source: the source image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1005 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 1006 | % o destination: the destination image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1007 | % |
| 1008 | % o transfer: the transfer callback method. |
| 1009 | % |
| 1010 | % o context: the user defined context. |
| 1011 | % |
| 1012 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1013 | MagickExport MagickBooleanType TransferImageViewIterator(ImageView *source, |
| 1014 | ImageView *destination,TransferImageViewMethod transfer,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1015 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1016 | Image |
| 1017 | *destination_image, |
| 1018 | *source_image; |
| 1019 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1020 | MagickBooleanType |
| 1021 | status; |
| 1022 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 1023 | MagickOffsetType |
| 1024 | progress; |
| 1025 | |
| 1026 | ssize_t |
| 1027 | y; |
| 1028 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1029 | assert(source != (ImageView *) NULL); |
| 1030 | assert(source->signature == MagickSignature); |
| 1031 | if (transfer == (TransferImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1032 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1033 | source_image=source->image; |
| 1034 | destination_image=destination->image; |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 1035 | status=SetImageStorageClass(destination_image,DirectClass, |
| 1036 | destination->exception); |
| 1037 | if (status == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1038 | return(MagickFalse); |
| 1039 | status=MagickTrue; |
| 1040 | progress=0; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 1041 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 09d8117 | 2010-10-21 16:15:05 +0000 | [diff] [blame] | 1042 | #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1043 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1044 | for (y=source->extent.y; y < (ssize_t) source->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1045 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 1046 | const int |
| 1047 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 1048 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1049 | MagickBooleanType |
| 1050 | sync; |
| 1051 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1052 | register const Quantum |
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 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1055 | register Quantum |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 1056 | *restrict destination_pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1057 | |
| 1058 | if (status == MagickFalse) |
| 1059 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1060 | pixels=GetCacheViewVirtualPixels(source->view,source->extent.x,y, |
| 1061 | source->extent.width,1,source->exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1062 | if (pixels == (const Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1063 | { |
| 1064 | status=MagickFalse; |
| 1065 | continue; |
| 1066 | } |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1067 | destination_pixels=GetCacheViewAuthenticPixels(destination->view, |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 1068 | destination->extent.x,y,destination->extent.width,1, |
| 1069 | destination->exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1070 | if (destination_pixels == (Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1071 | { |
| 1072 | status=MagickFalse; |
| 1073 | continue; |
| 1074 | } |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1075 | if (transfer(source,destination,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1076 | status=MagickFalse; |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 1077 | sync=SyncCacheViewAuthenticPixels(destination->view,destination->exception); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1078 | if (sync == MagickFalse) |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 1079 | status=MagickFalse; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1080 | if (source_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 1081 | { |
| 1082 | MagickBooleanType |
| 1083 | proceed; |
| 1084 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 1085 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1086 | #pragma omp critical (MagickCore_TransferImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1087 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1088 | proceed=SetImageProgress(source_image,source->description,progress++, |
| 1089 | source->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1090 | if (proceed == MagickFalse) |
| 1091 | status=MagickFalse; |
| 1092 | } |
| 1093 | } |
| 1094 | return(status); |
| 1095 | } |
| 1096 | |
| 1097 | /* |
| 1098 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1099 | % % |
| 1100 | % % |
| 1101 | % % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1102 | % 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] | 1103 | % % |
| 1104 | % % |
| 1105 | % % |
| 1106 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1107 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 1108 | % UpdateImageViewIterator() iterates over the image view in parallel and calls |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1109 | % your update method for each scanline of the view. The pixel extent is |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1110 | % confined to the image canvas-- that is no negative offsets or widths or |
| 1111 | % heights that exceed the image dimension are permitted. Updates to pixels |
| 1112 | % in your callback are automagically synced back to the image. |
| 1113 | % |
cristy | d6dfc0d | 2010-06-27 19:30:49 +0000 | [diff] [blame] | 1114 | % The callback signature is: |
| 1115 | % |
| 1116 | % MagickBooleanType UpdateImageViewMethod(ImageView *source, |
| 1117 | % const ssize_t y,const int thread_id,void *context) |
| 1118 | % |
cristy | 5873947 | 2010-06-26 20:27:18 +0000 | [diff] [blame] | 1119 | % Use this pragma if the view is not single threaded: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1120 | % |
| 1121 | % #pragma omp critical |
| 1122 | % |
| 1123 | % to define a section of code in your callback update method that must be |
| 1124 | % executed by a single thread at a time. |
| 1125 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1126 | % The format of the UpdateImageViewIterator method is: |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1127 | % |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1128 | % MagickBooleanType UpdateImageViewIterator(ImageView *source, |
| 1129 | % UpdateImageViewMethod update,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1130 | % |
| 1131 | % A description of each parameter follows: |
| 1132 | % |
cristy | 73b7d4c | 2010-06-27 00:31:00 +0000 | [diff] [blame] | 1133 | % o source: the source image view. |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1134 | % |
| 1135 | % o update: the update callback method. |
| 1136 | % |
| 1137 | % o context: the user defined context. |
| 1138 | % |
| 1139 | */ |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1140 | MagickExport MagickBooleanType UpdateImageViewIterator(ImageView *source, |
| 1141 | UpdateImageViewMethod update,void *context) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1142 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1143 | Image |
| 1144 | *source_image; |
| 1145 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1146 | MagickBooleanType |
| 1147 | status; |
| 1148 | |
cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 1149 | MagickOffsetType |
| 1150 | progress; |
| 1151 | |
| 1152 | ssize_t |
| 1153 | y; |
| 1154 | |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1155 | assert(source != (ImageView *) NULL); |
| 1156 | assert(source->signature == MagickSignature); |
| 1157 | if (update == (UpdateImageViewMethod) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1158 | return(MagickFalse); |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1159 | source_image=source->image; |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 1160 | status=SetImageStorageClass(source_image,DirectClass,source->exception); |
| 1161 | if (status == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1162 | return(MagickFalse); |
| 1163 | status=MagickTrue; |
| 1164 | progress=0; |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 1165 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 09d8117 | 2010-10-21 16:15:05 +0000 | [diff] [blame] | 1166 | #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1167 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1168 | for (y=source->extent.y; y < (ssize_t) source->extent.height; y++) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1169 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 1170 | const int |
| 1171 | id = GetOpenMPThreadId(); |
cristy | ad74005 | 2010-07-03 01:38:03 +0000 | [diff] [blame] | 1172 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1173 | register Quantum |
cristy | c47d1f8 | 2009-11-26 01:44:43 +0000 | [diff] [blame] | 1174 | *restrict pixels; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1175 | |
| 1176 | if (status == MagickFalse) |
| 1177 | continue; |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1178 | pixels=GetCacheViewAuthenticPixels(source->view,source->extent.x,y, |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 1179 | source->extent.width,1,source->exception); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1180 | if (pixels == (Quantum *) NULL) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1181 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1182 | status=MagickFalse; |
| 1183 | continue; |
| 1184 | } |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1185 | if (update(source,y,id,context) == MagickFalse) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1186 | status=MagickFalse; |
cristy | 7c3af95 | 2011-10-20 16:04:16 +0000 | [diff] [blame] | 1187 | status=SyncCacheViewAuthenticPixels(source->view,source->exception); |
| 1188 | if (status == MagickFalse) |
| 1189 | status=MagickFalse; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1190 | if (source_image->progress_monitor != (MagickProgressMonitor) NULL) |
| 1191 | { |
| 1192 | MagickBooleanType |
| 1193 | proceed; |
| 1194 | |
cristy | b5d5f72 | 2009-11-04 03:03:49 +0000 | [diff] [blame] | 1195 | #if defined(MAGICKCORE_OPENMP_SUPPORT) |
cristy | 7eb1b7a | 2010-06-26 15:47:49 +0000 | [diff] [blame] | 1196 | #pragma omp critical (MagickCore_UpdateImageViewIterator) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1197 | #endif |
cristy | c3ebda2 | 2010-06-27 17:11:57 +0000 | [diff] [blame] | 1198 | proceed=SetImageProgress(source_image,source->description,progress++, |
| 1199 | source->extent.height); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1200 | if (proceed == MagickFalse) |
| 1201 | status=MagickFalse; |
| 1202 | } |
| 1203 | } |
| 1204 | return(status); |
| 1205 | } |