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