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-2014 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 ((IsPixelInfoGray(&frame_image->border_color) == MagickFalse) &&
234 (IsGrayColorspace(frame_image->colorspace) != MagickFalse))
235 (void) SetImageColorspace(frame_image,sRGBColorspace,exception);
236 if ((frame_image->matte_color.alpha_trait == BlendPixelTrait) &&
237 (frame_image->alpha_trait != BlendPixelTrait))
238 (void) SetImageAlpha(frame_image,OpaqueAlpha,exception);
239 frame_image->page=image->page;
240 if ((image->page.width != 0) && (image->page.height != 0))
242 frame_image->page.width+=frame_image->columns-image->columns;
243 frame_image->page.height+=frame_image->rows-image->rows;
246 Initialize 3D effects color.
248 interior=image->border_color;
249 matte=image->matte_color;
251 accentuate.red=(double) (QuantumScale*((QuantumRange-
252 AccentuateModulate)*matte.red+(QuantumRange*AccentuateModulate)));
253 accentuate.green=(double) (QuantumScale*((QuantumRange-
254 AccentuateModulate)*matte.green+(QuantumRange*AccentuateModulate)));
255 accentuate.blue=(double) (QuantumScale*((QuantumRange-
256 AccentuateModulate)*matte.blue+(QuantumRange*AccentuateModulate)));
257 accentuate.black=(double) (QuantumScale*((QuantumRange-
258 AccentuateModulate)*matte.black+(QuantumRange*AccentuateModulate)));
259 accentuate.alpha=matte.alpha;
261 highlight.red=(double) (QuantumScale*((QuantumRange-
262 HighlightModulate)*matte.red+(QuantumRange*HighlightModulate)));
263 highlight.green=(double) (QuantumScale*((QuantumRange-
264 HighlightModulate)*matte.green+(QuantumRange*HighlightModulate)));
265 highlight.blue=(double) (QuantumScale*((QuantumRange-
266 HighlightModulate)*matte.blue+(QuantumRange*HighlightModulate)));
267 highlight.black=(double) (QuantumScale*((QuantumRange-
268 HighlightModulate)*matte.black+(QuantumRange*HighlightModulate)));
269 highlight.alpha=matte.alpha;
271 shadow.red=QuantumScale*matte.red*ShadowModulate;
272 shadow.green=QuantumScale*matte.green*ShadowModulate;
273 shadow.blue=QuantumScale*matte.blue*ShadowModulate;
274 shadow.black=QuantumScale*matte.black*ShadowModulate;
275 shadow.alpha=matte.alpha;
277 trough.red=QuantumScale*matte.red*TroughModulate;
278 trough.green=QuantumScale*matte.green*TroughModulate;
279 trough.blue=QuantumScale*matte.blue*TroughModulate;
280 trough.black=QuantumScale*matte.black*TroughModulate;
281 trough.alpha=matte.alpha;
284 image_view=AcquireVirtualCacheView(image,exception);
285 frame_view=AcquireAuthenticCacheView(frame_image,exception);
286 height=(size_t) (frame_info->outer_bevel+(frame_info->y-bevel_width)+
287 frame_info->inner_bevel);
297 Draw top of ornamental border.
299 q=QueueCacheViewAuthenticPixels(frame_view,0,0,frame_image->columns,
301 if (q != (Quantum *) NULL)
304 Draw top of ornamental border.
306 for (y=0; y < (ssize_t) frame_info->outer_bevel; y++)
308 for (x=0; x < (ssize_t) (frame_image->columns-y); x++)
311 SetPixelInfoPixel(frame_image,&highlight,q);
313 SetPixelInfoPixel(frame_image,&accentuate,q);
314 q+=GetPixelChannels(frame_image);
316 for ( ; x < (ssize_t) frame_image->columns; x++)
318 SetPixelInfoPixel(frame_image,&shadow,q);
319 q+=GetPixelChannels(frame_image);
322 for (y=0; y < (ssize_t) (frame_info->y-bevel_width); y++)
324 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
326 SetPixelInfoPixel(frame_image,&highlight,q);
327 q+=GetPixelChannels(frame_image);
329 width=frame_image->columns-2*frame_info->outer_bevel;
330 for (x=0; x < (ssize_t) width; x++)
332 SetPixelInfoPixel(frame_image,&matte,q);
333 q+=GetPixelChannels(frame_image);
335 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
337 SetPixelInfoPixel(frame_image,&shadow,q);
338 q+=GetPixelChannels(frame_image);
341 for (y=0; y < (ssize_t) frame_info->inner_bevel; y++)
343 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
345 SetPixelInfoPixel(frame_image,&highlight,q);
346 q+=GetPixelChannels(frame_image);
348 for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
350 SetPixelInfoPixel(frame_image,&matte,q);
351 q+=GetPixelChannels(frame_image);
353 width=image->columns+((size_t) frame_info->inner_bevel << 1)-
355 for (x=0; x < (ssize_t) width; x++)
358 SetPixelInfoPixel(frame_image,&shadow,q);
360 SetPixelInfoPixel(frame_image,&trough,q);
361 q+=GetPixelChannels(frame_image);
363 for ( ; x < (ssize_t) (image->columns+2*frame_info->inner_bevel); x++)
365 SetPixelInfoPixel(frame_image,&highlight,q);
366 q+=GetPixelChannels(frame_image);
368 width=frame_info->width-frame_info->x-image->columns-bevel_width;
369 for (x=0; x < (ssize_t) width; x++)
371 SetPixelInfoPixel(frame_image,&matte,q);
372 q+=GetPixelChannels(frame_image);
374 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
376 SetPixelInfoPixel(frame_image,&shadow,q);
377 q+=GetPixelChannels(frame_image);
380 (void) SyncCacheViewAuthenticPixels(frame_view,exception);
384 Draw sides of ornamental border.
386 #if defined(MAGICKCORE_OPENMP_SUPPORT)
387 #pragma omp parallel for schedule(static,4) shared(progress,status) \
388 magick_threads(image,frame_image,1,1)
390 for (y=0; y < (ssize_t) image->rows; y++)
402 Initialize scanline with matte color.
404 if (status == MagickFalse)
406 q=QueueCacheViewAuthenticPixels(frame_view,0,frame_info->y+y,
407 frame_image->columns,1,exception);
408 if (q == (Quantum *) NULL)
413 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
415 SetPixelInfoPixel(frame_image,&highlight,q);
416 q+=GetPixelChannels(frame_image);
418 for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
420 SetPixelInfoPixel(frame_image,&matte,q);
421 q+=GetPixelChannels(frame_image);
423 for (x=0; x < (ssize_t) frame_info->inner_bevel; x++)
425 SetPixelInfoPixel(frame_image,&shadow,q);
426 q+=GetPixelChannels(frame_image);
429 Set frame interior to interior color.
431 if ((compose != CopyCompositeOp) && ((compose != OverCompositeOp) ||
432 (image->alpha_trait == BlendPixelTrait)))
433 for (x=0; x < (ssize_t) image->columns; x++)
435 SetPixelInfoPixel(frame_image,&interior,q);
436 q+=GetPixelChannels(frame_image);
440 register const Quantum
443 p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
444 if (p == (const Quantum *) NULL)
449 for (x=0; x < (ssize_t) image->columns; x++)
454 if (GetPixelReadMask(image,q) == 0)
456 SetPixelBackgoundColor(frame_image,q);
457 p+=GetPixelChannels(image);
458 q+=GetPixelChannels(frame_image);
461 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
463 PixelChannel channel=GetPixelChannelChannel(image,i);
464 PixelTrait traits=GetPixelChannelTraits(image,channel);
465 PixelTrait frame_traits=GetPixelChannelTraits(frame_image,channel);
466 if ((traits == UndefinedPixelTrait) ||
467 (frame_traits == UndefinedPixelTrait))
469 SetPixelChannel(frame_image,channel,p[i],q);
471 SetPixelRed(frame_image,GetPixelRed(image,p),q);
472 SetPixelGreen(frame_image,GetPixelGreen(image,p),q);
473 SetPixelBlue(frame_image,GetPixelBlue(image,p),q);
474 SetPixelAlpha(frame_image,GetPixelAlpha(image,p),q);
475 p+=GetPixelChannels(image);
476 q+=GetPixelChannels(frame_image);
479 for (x=0; x < (ssize_t) frame_info->inner_bevel; x++)
481 SetPixelInfoPixel(frame_image,&highlight,q);
482 q+=GetPixelChannels(frame_image);
484 width=frame_info->width-frame_info->x-image->columns-bevel_width;
485 for (x=0; x < (ssize_t) width; x++)
487 SetPixelInfoPixel(frame_image,&matte,q);
488 q+=GetPixelChannels(frame_image);
490 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
492 SetPixelInfoPixel(frame_image,&shadow,q);
493 q+=GetPixelChannels(frame_image);
495 if (SyncCacheViewAuthenticPixels(frame_view,exception) == MagickFalse)
497 if (image->progress_monitor != (MagickProgressMonitor) NULL)
502 #if defined(MAGICKCORE_OPENMP_SUPPORT)
503 #pragma omp critical (MagickCore_FrameImage)
505 proceed=SetImageProgress(image,FrameImageTag,progress++,image->rows);
506 if (proceed == MagickFalse)
510 height=(size_t) (frame_info->inner_bevel+frame_info->height-
511 frame_info->y-image->rows-bevel_width+frame_info->outer_bevel);
521 Draw bottom of ornamental border.
523 q=QueueCacheViewAuthenticPixels(frame_view,0,(ssize_t) (frame_image->rows-
524 height),frame_image->columns,height,exception);
525 if (q != (Quantum *) NULL)
528 Draw bottom of ornamental border.
530 for (y=frame_info->inner_bevel-1; y >= 0; y--)
532 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
534 SetPixelInfoPixel(frame_image,&highlight,q);
535 q+=GetPixelChannels(frame_image);
537 for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
539 SetPixelInfoPixel(frame_image,&matte,q);
540 q+=GetPixelChannels(frame_image);
542 for (x=0; x < y; x++)
544 SetPixelInfoPixel(frame_image,&shadow,q);
545 q+=GetPixelChannels(frame_image);
547 for ( ; x < (ssize_t) (image->columns+2*frame_info->inner_bevel); x++)
549 if (x >= (ssize_t) (image->columns+2*frame_info->inner_bevel-y))
550 SetPixelInfoPixel(frame_image,&highlight,q);
552 SetPixelInfoPixel(frame_image,&accentuate,q);
553 q+=GetPixelChannels(frame_image);
555 width=frame_info->width-frame_info->x-image->columns-bevel_width;
556 for (x=0; x < (ssize_t) width; x++)
558 SetPixelInfoPixel(frame_image,&matte,q);
559 q+=GetPixelChannels(frame_image);
561 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
563 SetPixelInfoPixel(frame_image,&shadow,q);
564 q+=GetPixelChannels(frame_image);
567 height=frame_info->height-frame_info->y-image->rows-bevel_width;
568 for (y=0; y < (ssize_t) height; y++)
570 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
572 SetPixelInfoPixel(frame_image,&highlight,q);
573 q+=GetPixelChannels(frame_image);
575 width=frame_image->columns-2*frame_info->outer_bevel;
576 for (x=0; x < (ssize_t) width; x++)
578 SetPixelInfoPixel(frame_image,&matte,q);
579 q+=GetPixelChannels(frame_image);
581 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
583 SetPixelInfoPixel(frame_image,&shadow,q);
584 q+=GetPixelChannels(frame_image);
587 for (y=frame_info->outer_bevel-1; y >= 0; y--)
589 for (x=0; x < y; x++)
591 SetPixelInfoPixel(frame_image,&highlight,q);
592 q+=GetPixelChannels(frame_image);
594 for ( ; x < (ssize_t) frame_image->columns; x++)
596 if (x >= (ssize_t) (frame_image->columns-y))
597 SetPixelInfoPixel(frame_image,&shadow,q);
599 SetPixelInfoPixel(frame_image,&trough,q);
600 q+=GetPixelChannels(frame_image);
603 (void) SyncCacheViewAuthenticPixels(frame_view,exception);
606 frame_view=DestroyCacheView(frame_view);
607 image_view=DestroyCacheView(image_view);
608 if ((compose != CopyCompositeOp) && ((compose != OverCompositeOp) ||
609 (image->alpha_trait == BlendPixelTrait)))
611 x=(ssize_t) (frame_info->outer_bevel+(frame_info->x-bevel_width)+
612 frame_info->inner_bevel);
613 y=(ssize_t) (frame_info->outer_bevel+(frame_info->y-bevel_width)+
614 frame_info->inner_bevel);
615 (void) CompositeImage(frame_image,image,compose,MagickTrue,x,y,
618 if (status == MagickFalse)
619 frame_image=DestroyImage(frame_image);
624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
628 % R a i s e I m a g e %
632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
634 % RaiseImage() creates a simulated three-dimensional button-like effect
635 % by lightening and darkening the edges of the image. Members width and
636 % height of raise_info define the width of the vertical and horizontal
637 % edge of the effect.
639 % The format of the RaiseImage method is:
641 % MagickBooleanType RaiseImage(const Image *image,
642 % const RectangleInfo *raise_info,const MagickBooleanType raise,
643 % ExceptionInfo *exception)
645 % A description of each parameter follows:
647 % o image: the image.
649 % o raise_info: Define the width and height of the raise area.
651 % o raise: A value other than zero creates a 3-D raise effect,
652 % otherwise it has a lowered effect.
654 % o exception: return any errors or warnings in this structure.
657 MagickExport MagickBooleanType RaiseImage(Image *image,
658 const RectangleInfo *raise_info,const MagickBooleanType raise,
659 ExceptionInfo *exception)
661 #define AccentuateFactor ScaleCharToQuantum(135)
662 #define HighlightFactor ScaleCharToQuantum(190)
663 #define ShadowFactor ScaleCharToQuantum(190)
664 #define RaiseImageTag "Raise/Image"
665 #define TroughFactor ScaleCharToQuantum(135)
683 assert(image != (Image *) NULL);
684 assert(image->signature == MagickSignature);
685 if (image->debug != MagickFalse)
686 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
687 assert(raise_info != (RectangleInfo *) NULL);
688 if ((image->columns <= (raise_info->width << 1)) ||
689 (image->rows <= (raise_info->height << 1)))
690 ThrowBinaryException(OptionError,"ImageSizeMustExceedBevelWidth",
692 foreground=QuantumRange;
693 background=(Quantum) 0;
694 if (raise == MagickFalse)
696 foreground=(Quantum) 0;
697 background=QuantumRange;
699 if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
706 image_view=AcquireAuthenticCacheView(image,exception);
707 #if defined(MAGICKCORE_OPENMP_SUPPORT)
708 #pragma omp parallel for schedule(static,4) shared(progress,status) \
709 magick_threads(image,image,1,1)
711 for (y=0; y < (ssize_t) raise_info->height; y++)
720 if (status == MagickFalse)
722 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
723 if (q == (Quantum *) NULL)
728 for (x=0; x < y; x++)
730 if (GetPixelReadMask(image,q) == 0)
732 q+=GetPixelChannels(image);
735 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
737 PixelChannel channel=GetPixelChannelChannel(image,i);
738 PixelTrait traits=GetPixelChannelTraits(image,channel);
739 if ((traits & UpdatePixelTrait) == 0)
741 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
742 foreground*(QuantumRange-HighlightFactor)));
744 q+=GetPixelChannels(image);
746 for ( ; x < (ssize_t) (image->columns-y); x++)
748 if (GetPixelReadMask(image,q) == 0)
750 q+=GetPixelChannels(image);
753 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
755 PixelChannel channel=GetPixelChannelChannel(image,i);
756 PixelTrait traits=GetPixelChannelTraits(image,channel);
757 if ((traits & UpdatePixelTrait) == 0)
759 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*AccentuateFactor+
760 (double) foreground*(QuantumRange-AccentuateFactor)));
762 q+=GetPixelChannels(image);
764 for ( ; x < (ssize_t) image->columns; x++)
766 if (GetPixelReadMask(image,q) == 0)
768 q+=GetPixelChannels(image);
771 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
773 PixelChannel channel=GetPixelChannelChannel(image,i);
774 PixelTrait traits=GetPixelChannelTraits(image,channel);
775 if ((traits & UpdatePixelTrait) == 0)
777 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
778 background*(QuantumRange-ShadowFactor)));
780 q+=GetPixelChannels(image);
782 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
784 if (image->progress_monitor != (MagickProgressMonitor) NULL)
789 #if defined(MAGICKCORE_OPENMP_SUPPORT)
790 #pragma omp critical (MagickCore_RaiseImage)
792 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
793 if (proceed == MagickFalse)
797 #if defined(MAGICKCORE_OPENMP_SUPPORT)
798 #pragma omp parallel for schedule(static,4) shared(progress,status) \
799 magick_threads(image,image,1,1)
801 for (y=(ssize_t) raise_info->height; y < (ssize_t) (image->rows-raise_info->height); y++)
810 if (status == MagickFalse)
812 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
813 if (q == (Quantum *) NULL)
818 for (x=0; x < (ssize_t) raise_info->width; x++)
820 if (GetPixelReadMask(image,q) == 0)
822 q+=GetPixelChannels(image);
825 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
827 PixelChannel channel=GetPixelChannelChannel(image,i);
828 PixelTrait traits=GetPixelChannelTraits(image,channel);
829 if ((traits & UpdatePixelTrait) == 0)
831 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
832 foreground*(QuantumRange-HighlightFactor)));
834 q+=GetPixelChannels(image);
836 for ( ; x < (ssize_t) (image->columns-raise_info->width); x++)
837 q+=GetPixelChannels(image);
838 for ( ; x < (ssize_t) image->columns; x++)
840 if (GetPixelReadMask(image,q) == 0)
842 q+=GetPixelChannels(image);
845 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
847 PixelChannel channel=GetPixelChannelChannel(image,i);
848 PixelTrait traits=GetPixelChannelTraits(image,channel);
849 if ((traits & UpdatePixelTrait) == 0)
851 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
852 background*(QuantumRange-ShadowFactor)));
854 q+=GetPixelChannels(image);
856 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
858 if (image->progress_monitor != (MagickProgressMonitor) NULL)
863 #if defined(MAGICKCORE_OPENMP_SUPPORT)
864 #pragma omp critical (MagickCore_RaiseImage)
866 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
867 if (proceed == MagickFalse)
871 #if defined(MAGICKCORE_OPENMP_SUPPORT)
872 #pragma omp parallel for schedule(static,4) shared(progress,status) \
873 magick_threads(image,image,1,1)
875 for (y=(ssize_t) (image->rows-raise_info->height); y < (ssize_t) image->rows; y++)
884 if (status == MagickFalse)
886 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
887 if (q == (Quantum *) NULL)
892 for (x=0; x < (ssize_t) (image->rows-y); x++)
894 if (GetPixelReadMask(image,q) == 0)
896 q+=GetPixelChannels(image);
899 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
901 PixelChannel channel=GetPixelChannelChannel(image,i);
902 PixelTrait traits=GetPixelChannelTraits(image,channel);
903 if ((traits & UpdatePixelTrait) == 0)
905 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
906 foreground*(QuantumRange-HighlightFactor)));
908 q+=GetPixelChannels(image);
910 for ( ; x < (ssize_t) (image->columns-(image->rows-y)); x++)
912 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
914 PixelChannel channel=GetPixelChannelChannel(image,i);
915 PixelTrait traits=GetPixelChannelTraits(image,channel);
916 if ((traits & UpdatePixelTrait) == 0)
918 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*TroughFactor+
919 (double) background*(QuantumRange-TroughFactor)));
921 q+=GetPixelChannels(image);
923 for ( ; x < (ssize_t) image->columns; x++)
925 if (GetPixelReadMask(image,q) == 0)
927 q+=GetPixelChannels(image);
930 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
932 PixelChannel channel=GetPixelChannelChannel(image,i);
933 PixelTrait traits=GetPixelChannelTraits(image,channel);
934 if ((traits & UpdatePixelTrait) == 0)
936 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
937 background*(QuantumRange-ShadowFactor)));
939 q+=GetPixelChannels(image);
941 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
943 if (image->progress_monitor != (MagickProgressMonitor) NULL)
948 #if defined(MAGICKCORE_OPENMP_SUPPORT)
949 #pragma omp critical (MagickCore_RaiseImage)
951 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
952 if (proceed == MagickFalse)
956 image_view=DestroyCacheView(image_view);