2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % DDDD EEEEE CCCC OOO RRRR AAA TTTTT EEEEE %
7 % D D E C O O R R A A T E %
8 % D D EEE C O O RRRR AAAAA T EEE %
9 % D D E C O O R R A A T E %
10 % DDDD EEEEE CCCC OOO R R A A T EEEEE %
13 % MagickCore Image Decoration Methods %
20 % Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % http://www.imagemagick.org/script/license.php %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 #include "MagickCore/studio.h"
44 #include "MagickCore/cache-view.h"
45 #include "MagickCore/color-private.h"
46 #include "MagickCore/colorspace-private.h"
47 #include "MagickCore/composite.h"
48 #include "MagickCore/decorate.h"
49 #include "MagickCore/exception.h"
50 #include "MagickCore/exception-private.h"
51 #include "MagickCore/image.h"
52 #include "MagickCore/memory_.h"
53 #include "MagickCore/monitor.h"
54 #include "MagickCore/monitor-private.h"
55 #include "MagickCore/pixel-accessor.h"
56 #include "MagickCore/quantum.h"
57 #include "MagickCore/quantum-private.h"
58 #include "MagickCore/resource_.h"
59 #include "MagickCore/thread-private.h"
60 #include "MagickCore/transform.h"
65 #define AccentuateModulate ScaleCharToQuantum(80)
66 #define HighlightModulate ScaleCharToQuantum(125)
67 #define ShadowModulate ScaleCharToQuantum(135)
68 #define DepthModulate ScaleCharToQuantum(185)
69 #define TroughModulate ScaleCharToQuantum(110)
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 % B o r d e r I m a g e %
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 % BorderImage() surrounds the image with a border of the color defined by
83 % the bordercolor member of the image structure. The width and height
84 % of the border are defined by the corresponding members of the border_info
87 % The format of the BorderImage method is:
89 % Image *BorderImage(const Image *image,const RectangleInfo *border_info,
90 % const CompositeOperator compose,ExceptionInfo *exception)
92 % A description of each parameter follows:
96 % o border_info: define the width and height of the border.
98 % o compose: the composite operator.
100 % o exception: return any errors or warnings in this structure.
103 MagickExport Image *BorderImage(const Image *image,
104 const RectangleInfo *border_info,const CompositeOperator compose,
105 ExceptionInfo *exception)
114 assert(image != (const Image *) NULL);
115 assert(image->signature == MagickSignature);
116 if (image->debug != MagickFalse)
117 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
118 assert(border_info != (RectangleInfo *) NULL);
119 frame_info.width=image->columns+(border_info->width << 1);
120 frame_info.height=image->rows+(border_info->height << 1);
121 frame_info.x=(ssize_t) border_info->width;
122 frame_info.y=(ssize_t) border_info->height;
123 frame_info.inner_bevel=0;
124 frame_info.outer_bevel=0;
125 clone_image=CloneImage(image,0,0,MagickTrue,exception);
126 if (clone_image == (Image *) NULL)
127 return((Image *) NULL);
128 clone_image->matte_color=image->border_color;
129 border_image=FrameImage(clone_image,&frame_info,compose,exception);
130 clone_image=DestroyImage(clone_image);
131 if (border_image != (Image *) NULL)
132 border_image->matte_color=image->matte_color;
133 return(border_image);
137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141 % F r a m e I m a g e %
145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147 % FrameImage() adds a simulated three-dimensional border around the image.
148 % The color of the border is defined by the matte_color member of image.
149 % Members width and height of frame_info specify the border width of the
150 % vertical and horizontal sides of the frame. Members inner and outer
151 % indicate the width of the inner and outer shadows of the frame.
153 % The format of the FrameImage method is:
155 % Image *FrameImage(const Image *image,const FrameInfo *frame_info,
156 % const CompositeOperator compose,ExceptionInfo *exception)
158 % A description of each parameter follows:
160 % o image: the image.
162 % o frame_info: Define the width and height of the frame and its bevels.
164 % o compose: the composite operator.
166 % o exception: return any errors or warnings in this structure.
169 MagickExport Image *FrameImage(const Image *image,const FrameInfo *frame_info,
170 const CompositeOperator compose,ExceptionInfo *exception)
172 #define FrameImageTag "Frame/Image"
207 Check frame geometry.
209 assert(image != (Image *) NULL);
210 assert(image->signature == MagickSignature);
211 if (image->debug != MagickFalse)
212 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
213 assert(frame_info != (FrameInfo *) NULL);
214 if ((frame_info->outer_bevel < 0) || (frame_info->inner_bevel < 0))
215 ThrowImageException(OptionError,"FrameIsLessThanImageSize");
216 bevel_width=(size_t) (frame_info->outer_bevel+frame_info->inner_bevel);
217 width=frame_info->width-frame_info->x-bevel_width;
218 height=frame_info->height-frame_info->y-bevel_width;
219 if ((width < image->columns) || (height < image->rows))
220 ThrowImageException(OptionError,"FrameIsLessThanImageSize");
222 Initialize framed image attributes.
224 frame_image=CloneImage(image,frame_info->width,frame_info->height,MagickTrue,
226 if (frame_image == (Image *) NULL)
227 return((Image *) NULL);
228 if (SetImageStorageClass(frame_image,DirectClass,exception) == MagickFalse)
230 frame_image=DestroyImage(frame_image);
231 return((Image *) NULL);
233 if ((frame_image->matte_color.alpha_trait == BlendPixelTrait) &&
234 (frame_image->alpha_trait != BlendPixelTrait))
235 (void) SetImageAlpha(frame_image,OpaqueAlpha,exception);
236 frame_image->page=image->page;
237 if ((image->page.width != 0) && (image->page.height != 0))
239 frame_image->page.width+=frame_image->columns-image->columns;
240 frame_image->page.height+=frame_image->rows-image->rows;
243 Initialize 3D effects color.
245 interior=image->border_color;
246 matte=image->matte_color;
248 accentuate.red=(double) (QuantumScale*((QuantumRange-
249 AccentuateModulate)*matte.red+(QuantumRange*AccentuateModulate)));
250 accentuate.green=(double) (QuantumScale*((QuantumRange-
251 AccentuateModulate)*matte.green+(QuantumRange*AccentuateModulate)));
252 accentuate.blue=(double) (QuantumScale*((QuantumRange-
253 AccentuateModulate)*matte.blue+(QuantumRange*AccentuateModulate)));
254 accentuate.black=(double) (QuantumScale*((QuantumRange-
255 AccentuateModulate)*matte.black+(QuantumRange*AccentuateModulate)));
256 accentuate.alpha=matte.alpha;
258 highlight.red=(double) (QuantumScale*((QuantumRange-
259 HighlightModulate)*matte.red+(QuantumRange*HighlightModulate)));
260 highlight.green=(double) (QuantumScale*((QuantumRange-
261 HighlightModulate)*matte.green+(QuantumRange*HighlightModulate)));
262 highlight.blue=(double) (QuantumScale*((QuantumRange-
263 HighlightModulate)*matte.blue+(QuantumRange*HighlightModulate)));
264 highlight.black=(double) (QuantumScale*((QuantumRange-
265 HighlightModulate)*matte.black+(QuantumRange*HighlightModulate)));
266 highlight.alpha=matte.alpha;
268 shadow.red=QuantumScale*matte.red*ShadowModulate;
269 shadow.green=QuantumScale*matte.green*ShadowModulate;
270 shadow.blue=QuantumScale*matte.blue*ShadowModulate;
271 shadow.black=QuantumScale*matte.black*ShadowModulate;
272 shadow.alpha=matte.alpha;
274 trough.red=QuantumScale*matte.red*TroughModulate;
275 trough.green=QuantumScale*matte.green*TroughModulate;
276 trough.blue=QuantumScale*matte.blue*TroughModulate;
277 trough.black=QuantumScale*matte.black*TroughModulate;
278 trough.alpha=matte.alpha;
281 image_view=AcquireVirtualCacheView(image,exception);
282 frame_view=AcquireAuthenticCacheView(frame_image,exception);
283 height=(size_t) (frame_info->outer_bevel+(frame_info->y-bevel_width)+
284 frame_info->inner_bevel);
294 Draw top of ornamental border.
296 q=QueueCacheViewAuthenticPixels(frame_view,0,0,frame_image->columns,
298 if (q != (Quantum *) NULL)
301 Draw top of ornamental border.
303 for (y=0; y < (ssize_t) frame_info->outer_bevel; y++)
305 for (x=0; x < (ssize_t) (frame_image->columns-y); x++)
308 SetPixelInfoPixel(frame_image,&highlight,q);
310 SetPixelInfoPixel(frame_image,&accentuate,q);
311 q+=GetPixelChannels(frame_image);
313 for ( ; x < (ssize_t) frame_image->columns; x++)
315 SetPixelInfoPixel(frame_image,&shadow,q);
316 q+=GetPixelChannels(frame_image);
319 for (y=0; y < (ssize_t) (frame_info->y-bevel_width); y++)
321 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
323 SetPixelInfoPixel(frame_image,&highlight,q);
324 q+=GetPixelChannels(frame_image);
326 width=frame_image->columns-2*frame_info->outer_bevel;
327 for (x=0; x < (ssize_t) width; x++)
329 SetPixelInfoPixel(frame_image,&matte,q);
330 q+=GetPixelChannels(frame_image);
332 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
334 SetPixelInfoPixel(frame_image,&shadow,q);
335 q+=GetPixelChannels(frame_image);
338 for (y=0; y < (ssize_t) frame_info->inner_bevel; y++)
340 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
342 SetPixelInfoPixel(frame_image,&highlight,q);
343 q+=GetPixelChannels(frame_image);
345 for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
347 SetPixelInfoPixel(frame_image,&matte,q);
348 q+=GetPixelChannels(frame_image);
350 width=image->columns+((size_t) frame_info->inner_bevel << 1)-
352 for (x=0; x < (ssize_t) width; x++)
355 SetPixelInfoPixel(frame_image,&shadow,q);
357 SetPixelInfoPixel(frame_image,&trough,q);
358 q+=GetPixelChannels(frame_image);
360 for ( ; x < (ssize_t) (image->columns+2*frame_info->inner_bevel); x++)
362 SetPixelInfoPixel(frame_image,&highlight,q);
363 q+=GetPixelChannels(frame_image);
365 width=frame_info->width-frame_info->x-image->columns-bevel_width;
366 for (x=0; x < (ssize_t) width; x++)
368 SetPixelInfoPixel(frame_image,&matte,q);
369 q+=GetPixelChannels(frame_image);
371 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
373 SetPixelInfoPixel(frame_image,&shadow,q);
374 q+=GetPixelChannels(frame_image);
377 (void) SyncCacheViewAuthenticPixels(frame_view,exception);
381 Draw sides of ornamental border.
383 #if defined(MAGICKCORE_OPENMP_SUPPORT)
384 #pragma omp parallel for schedule(static,4) shared(progress,status) \
385 magick_threads(image,frame_image,1,1)
387 for (y=0; y < (ssize_t) image->rows; y++)
399 Initialize scanline with matte color.
401 if (status == MagickFalse)
403 q=QueueCacheViewAuthenticPixels(frame_view,0,frame_info->y+y,
404 frame_image->columns,1,exception);
405 if (q == (Quantum *) NULL)
410 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
412 SetPixelInfoPixel(frame_image,&highlight,q);
413 q+=GetPixelChannels(frame_image);
415 for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
417 SetPixelInfoPixel(frame_image,&matte,q);
418 q+=GetPixelChannels(frame_image);
420 for (x=0; x < (ssize_t) frame_info->inner_bevel; x++)
422 SetPixelInfoPixel(frame_image,&shadow,q);
423 q+=GetPixelChannels(frame_image);
426 Set frame interior to interior color.
428 if ((compose != CopyCompositeOp) && ((compose != OverCompositeOp) ||
429 (image->alpha_trait == BlendPixelTrait)))
430 for (x=0; x < (ssize_t) image->columns; x++)
432 SetPixelInfoPixel(frame_image,&interior,q);
433 q+=GetPixelChannels(frame_image);
437 register const Quantum
440 p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
441 if (p == (const Quantum *) NULL)
446 for (x=0; x < (ssize_t) image->columns; x++)
451 if (GetPixelMask(image,q) != 0)
453 p+=GetPixelChannels(image);
454 q+=GetPixelChannels(frame_image);
457 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
459 PixelChannel channel=GetPixelChannelChannel(image,i);
460 PixelTrait traits=GetPixelChannelTraits(image,channel);
461 if ((traits & (CopyPixelTrait | UpdatePixelTrait)) == 0)
465 p+=GetPixelChannels(image);
466 q+=GetPixelChannels(frame_image);
469 for (x=0; x < (ssize_t) frame_info->inner_bevel; x++)
471 SetPixelInfoPixel(frame_image,&highlight,q);
472 q+=GetPixelChannels(frame_image);
474 width=frame_info->width-frame_info->x-image->columns-bevel_width;
475 for (x=0; x < (ssize_t) width; x++)
477 SetPixelInfoPixel(frame_image,&matte,q);
478 q+=GetPixelChannels(frame_image);
480 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
482 SetPixelInfoPixel(frame_image,&shadow,q);
483 q+=GetPixelChannels(frame_image);
485 if (SyncCacheViewAuthenticPixels(frame_view,exception) == MagickFalse)
487 if (image->progress_monitor != (MagickProgressMonitor) NULL)
492 #if defined(MAGICKCORE_OPENMP_SUPPORT)
493 #pragma omp critical (MagickCore_FrameImage)
495 proceed=SetImageProgress(image,FrameImageTag,progress++,image->rows);
496 if (proceed == MagickFalse)
500 height=(size_t) (frame_info->inner_bevel+frame_info->height-
501 frame_info->y-image->rows-bevel_width+frame_info->outer_bevel);
511 Draw bottom of ornamental border.
513 q=QueueCacheViewAuthenticPixels(frame_view,0,(ssize_t) (frame_image->rows-
514 height),frame_image->columns,height,exception);
515 if (q != (Quantum *) NULL)
518 Draw bottom of ornamental border.
520 for (y=frame_info->inner_bevel-1; y >= 0; y--)
522 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
524 SetPixelInfoPixel(frame_image,&highlight,q);
525 q+=GetPixelChannels(frame_image);
527 for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
529 SetPixelInfoPixel(frame_image,&matte,q);
530 q+=GetPixelChannels(frame_image);
532 for (x=0; x < y; x++)
534 SetPixelInfoPixel(frame_image,&shadow,q);
535 q+=GetPixelChannels(frame_image);
537 for ( ; x < (ssize_t) (image->columns+2*frame_info->inner_bevel); x++)
539 if (x >= (ssize_t) (image->columns+2*frame_info->inner_bevel-y))
540 SetPixelInfoPixel(frame_image,&highlight,q);
542 SetPixelInfoPixel(frame_image,&accentuate,q);
543 q+=GetPixelChannels(frame_image);
545 width=frame_info->width-frame_info->x-image->columns-bevel_width;
546 for (x=0; x < (ssize_t) width; x++)
548 SetPixelInfoPixel(frame_image,&matte,q);
549 q+=GetPixelChannels(frame_image);
551 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
553 SetPixelInfoPixel(frame_image,&shadow,q);
554 q+=GetPixelChannels(frame_image);
557 height=frame_info->height-frame_info->y-image->rows-bevel_width;
558 for (y=0; y < (ssize_t) height; y++)
560 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
562 SetPixelInfoPixel(frame_image,&highlight,q);
563 q+=GetPixelChannels(frame_image);
565 width=frame_image->columns-2*frame_info->outer_bevel;
566 for (x=0; x < (ssize_t) width; x++)
568 SetPixelInfoPixel(frame_image,&matte,q);
569 q+=GetPixelChannels(frame_image);
571 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
573 SetPixelInfoPixel(frame_image,&shadow,q);
574 q+=GetPixelChannels(frame_image);
577 for (y=frame_info->outer_bevel-1; y >= 0; y--)
579 for (x=0; x < y; x++)
581 SetPixelInfoPixel(frame_image,&highlight,q);
582 q+=GetPixelChannels(frame_image);
584 for ( ; x < (ssize_t) frame_image->columns; x++)
586 if (x >= (ssize_t) (frame_image->columns-y))
587 SetPixelInfoPixel(frame_image,&shadow,q);
589 SetPixelInfoPixel(frame_image,&trough,q);
590 q+=GetPixelChannels(frame_image);
593 (void) SyncCacheViewAuthenticPixels(frame_view,exception);
596 frame_view=DestroyCacheView(frame_view);
597 image_view=DestroyCacheView(image_view);
598 if ((compose != CopyCompositeOp) && ((compose != OverCompositeOp) ||
599 (image->alpha_trait == BlendPixelTrait)))
601 x=(ssize_t) (frame_info->outer_bevel+(frame_info->x-bevel_width)+
602 frame_info->inner_bevel);
603 y=(ssize_t) (frame_info->outer_bevel+(frame_info->y-bevel_width)+
604 frame_info->inner_bevel);
605 (void) CompositeImage(frame_image,image,compose,MagickTrue,x,y,
608 if (status == MagickFalse)
609 frame_image=DestroyImage(frame_image);
614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
618 % R a i s e I m a g e %
622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
624 % RaiseImage() creates a simulated three-dimensional button-like effect
625 % by lightening and darkening the edges of the image. Members width and
626 % height of raise_info define the width of the vertical and horizontal
627 % edge of the effect.
629 % The format of the RaiseImage method is:
631 % MagickBooleanType RaiseImage(const Image *image,
632 % const RectangleInfo *raise_info,const MagickBooleanType raise,
633 % ExceptionInfo *exception)
635 % A description of each parameter follows:
637 % o image: the image.
639 % o raise_info: Define the width and height of the raise area.
641 % o raise: A value other than zero creates a 3-D raise effect,
642 % otherwise it has a lowered effect.
644 % o exception: return any errors or warnings in this structure.
647 MagickExport MagickBooleanType RaiseImage(Image *image,
648 const RectangleInfo *raise_info,const MagickBooleanType raise,
649 ExceptionInfo *exception)
651 #define AccentuateFactor ScaleCharToQuantum(135)
652 #define HighlightFactor ScaleCharToQuantum(190)
653 #define ShadowFactor ScaleCharToQuantum(190)
654 #define RaiseImageTag "Raise/Image"
655 #define TroughFactor ScaleCharToQuantum(135)
673 assert(image != (Image *) NULL);
674 assert(image->signature == MagickSignature);
675 if (image->debug != MagickFalse)
676 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
677 assert(raise_info != (RectangleInfo *) NULL);
678 if ((image->columns <= (raise_info->width << 1)) ||
679 (image->rows <= (raise_info->height << 1)))
680 ThrowBinaryException(OptionError,"ImageSizeMustExceedBevelWidth",
682 foreground=QuantumRange;
683 background=(Quantum) 0;
684 if (raise == MagickFalse)
686 foreground=(Quantum) 0;
687 background=QuantumRange;
689 if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
696 image_view=AcquireAuthenticCacheView(image,exception);
697 #if defined(MAGICKCORE_OPENMP_SUPPORT)
698 #pragma omp parallel for schedule(static,4) shared(progress,status) \
699 magick_threads(image,image,1,1)
701 for (y=0; y < (ssize_t) raise_info->height; y++)
710 if (status == MagickFalse)
712 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
713 if (q == (Quantum *) NULL)
718 for (x=0; x < y; x++)
720 if (GetPixelMask(image,q) != 0)
722 q+=GetPixelChannels(image);
725 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
727 PixelChannel channel=GetPixelChannelChannel(image,i);
728 PixelTrait traits=GetPixelChannelTraits(image,channel);
729 if ((traits & UpdatePixelTrait) == 0)
731 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
732 foreground*(QuantumRange-HighlightFactor)));
734 q+=GetPixelChannels(image);
736 for ( ; x < (ssize_t) (image->columns-y); x++)
738 if (GetPixelMask(image,q) != 0)
740 q+=GetPixelChannels(image);
743 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
745 PixelChannel channel=GetPixelChannelChannel(image,i);
746 PixelTrait traits=GetPixelChannelTraits(image,channel);
747 if ((traits & UpdatePixelTrait) == 0)
749 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*AccentuateFactor+
750 (double) foreground*(QuantumRange-AccentuateFactor)));
752 q+=GetPixelChannels(image);
754 for ( ; x < (ssize_t) image->columns; x++)
756 if (GetPixelMask(image,q) != 0)
758 q+=GetPixelChannels(image);
761 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
763 PixelChannel channel=GetPixelChannelChannel(image,i);
764 PixelTrait traits=GetPixelChannelTraits(image,channel);
765 if ((traits & UpdatePixelTrait) == 0)
767 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
768 background*(QuantumRange-ShadowFactor)));
770 q+=GetPixelChannels(image);
772 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
774 if (image->progress_monitor != (MagickProgressMonitor) NULL)
779 #if defined(MAGICKCORE_OPENMP_SUPPORT)
780 #pragma omp critical (MagickCore_RaiseImage)
782 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
783 if (proceed == MagickFalse)
787 #if defined(MAGICKCORE_OPENMP_SUPPORT)
788 #pragma omp parallel for schedule(static,4) shared(progress,status) \
789 magick_threads(image,image,1,1)
791 for (y=(ssize_t) raise_info->height; y < (ssize_t) (image->rows-raise_info->height); y++)
800 if (status == MagickFalse)
802 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
803 if (q == (Quantum *) NULL)
808 for (x=0; x < (ssize_t) raise_info->width; x++)
810 if (GetPixelMask(image,q) != 0)
812 q+=GetPixelChannels(image);
815 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
817 PixelChannel channel=GetPixelChannelChannel(image,i);
818 PixelTrait traits=GetPixelChannelTraits(image,channel);
819 if ((traits & UpdatePixelTrait) == 0)
821 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
822 foreground*(QuantumRange-HighlightFactor)));
824 q+=GetPixelChannels(image);
826 for ( ; x < (ssize_t) (image->columns-raise_info->width); x++)
827 q+=GetPixelChannels(image);
828 for ( ; x < (ssize_t) image->columns; x++)
830 if (GetPixelMask(image,q) != 0)
832 q+=GetPixelChannels(image);
835 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
837 PixelChannel channel=GetPixelChannelChannel(image,i);
838 PixelTrait traits=GetPixelChannelTraits(image,channel);
839 if ((traits & UpdatePixelTrait) == 0)
841 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
842 background*(QuantumRange-ShadowFactor)));
844 q+=GetPixelChannels(image);
846 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
848 if (image->progress_monitor != (MagickProgressMonitor) NULL)
853 #if defined(MAGICKCORE_OPENMP_SUPPORT)
854 #pragma omp critical (MagickCore_RaiseImage)
856 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
857 if (proceed == MagickFalse)
861 #if defined(MAGICKCORE_OPENMP_SUPPORT)
862 #pragma omp parallel for schedule(static,4) shared(progress,status) \
863 magick_threads(image,image,1,1)
865 for (y=(ssize_t) (image->rows-raise_info->height); y < (ssize_t) image->rows; y++)
874 if (status == MagickFalse)
876 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
877 if (q == (Quantum *) NULL)
882 for (x=0; x < (ssize_t) (image->rows-y); x++)
884 if (GetPixelMask(image,q) != 0)
886 q+=GetPixelChannels(image);
889 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
891 PixelChannel channel=GetPixelChannelChannel(image,i);
892 PixelTrait traits=GetPixelChannelTraits(image,channel);
893 if ((traits & UpdatePixelTrait) == 0)
895 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
896 foreground*(QuantumRange-HighlightFactor)));
898 q+=GetPixelChannels(image);
900 for ( ; x < (ssize_t) (image->columns-(image->rows-y)); x++)
902 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
904 PixelChannel channel=GetPixelChannelChannel(image,i);
905 PixelTrait traits=GetPixelChannelTraits(image,channel);
906 if ((traits & UpdatePixelTrait) == 0)
908 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*TroughFactor+
909 (double) background*(QuantumRange-TroughFactor)));
911 q+=GetPixelChannels(image);
913 for ( ; x < (ssize_t) image->columns; x++)
915 if (GetPixelMask(image,q) != 0)
917 q+=GetPixelChannels(image);
920 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
922 PixelChannel channel=GetPixelChannelChannel(image,i);
923 PixelTrait traits=GetPixelChannelTraits(image,channel);
924 if ((traits & UpdatePixelTrait) == 0)
926 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
927 background*(QuantumRange-ShadowFactor)));
929 q+=GetPixelChannels(image);
931 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
933 if (image->progress_monitor != (MagickProgressMonitor) NULL)
938 #if defined(MAGICKCORE_OPENMP_SUPPORT)
939 #pragma omp critical (MagickCore_RaiseImage)
941 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
942 if (proceed == MagickFalse)
946 image_view=DestroyCacheView(image_view);