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-2012 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->matte_color) == MagickFalse) &&
234 (IsGrayColorspace(frame_image->colorspace) != MagickFalse))
235 (void) SetImageColorspace(frame_image,RGBColorspace,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) && defined(NoBenefitFromParallelism)
387 #pragma omp parallel for schedule(static,4) shared(progress,status) \
388 dynamic_number_threads(image,image->columns,image->rows,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++)
451 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
452 SetPixelRed(frame_image,GetPixelRed(image,p),q);
453 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
454 SetPixelGreen(frame_image,GetPixelGreen(image,p),q);
455 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
456 SetPixelBlue(frame_image,GetPixelBlue(image,p),q);
457 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
458 SetPixelBlack(frame_image,GetPixelBlack(image,p),q);
459 if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
460 SetPixelAlpha(frame_image,GetPixelAlpha(image,p),q);
461 p+=GetPixelChannels(image);
462 q+=GetPixelChannels(frame_image);
465 for (x=0; x < (ssize_t) frame_info->inner_bevel; x++)
467 SetPixelInfoPixel(frame_image,&highlight,q);
468 q+=GetPixelChannels(frame_image);
470 width=frame_info->width-frame_info->x-image->columns-bevel_width;
471 for (x=0; x < (ssize_t) width; x++)
473 SetPixelInfoPixel(frame_image,&matte,q);
474 q+=GetPixelChannels(frame_image);
476 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
478 SetPixelInfoPixel(frame_image,&shadow,q);
479 q+=GetPixelChannels(frame_image);
481 if (SyncCacheViewAuthenticPixels(frame_view,exception) == MagickFalse)
483 if (image->progress_monitor != (MagickProgressMonitor) NULL)
488 #if defined(MAGICKCORE_OPENMP_SUPPORT) && defined(NoBenefitFromParallelism)
489 #pragma omp critical (MagickCore_FrameImage)
491 proceed=SetImageProgress(image,FrameImageTag,progress++,image->rows);
492 if (proceed == MagickFalse)
496 height=(size_t) (frame_info->inner_bevel+frame_info->height-
497 frame_info->y-image->rows-bevel_width+frame_info->outer_bevel);
507 Draw bottom of ornamental border.
509 q=QueueCacheViewAuthenticPixels(frame_view,0,(ssize_t) (frame_image->rows-
510 height),frame_image->columns,height,exception);
511 if (q != (Quantum *) NULL)
514 Draw bottom of ornamental border.
516 for (y=frame_info->inner_bevel-1; y >= 0; y--)
518 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
520 SetPixelInfoPixel(frame_image,&highlight,q);
521 q+=GetPixelChannels(frame_image);
523 for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
525 SetPixelInfoPixel(frame_image,&matte,q);
526 q+=GetPixelChannels(frame_image);
528 for (x=0; x < y; x++)
530 SetPixelInfoPixel(frame_image,&shadow,q);
531 q+=GetPixelChannels(frame_image);
533 for ( ; x < (ssize_t) (image->columns+2*frame_info->inner_bevel); x++)
535 if (x >= (ssize_t) (image->columns+2*frame_info->inner_bevel-y))
536 SetPixelInfoPixel(frame_image,&highlight,q);
538 SetPixelInfoPixel(frame_image,&accentuate,q);
539 q+=GetPixelChannels(frame_image);
541 width=frame_info->width-frame_info->x-image->columns-bevel_width;
542 for (x=0; x < (ssize_t) width; x++)
544 SetPixelInfoPixel(frame_image,&matte,q);
545 q+=GetPixelChannels(frame_image);
547 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
549 SetPixelInfoPixel(frame_image,&shadow,q);
550 q+=GetPixelChannels(frame_image);
553 height=frame_info->height-frame_info->y-image->rows-bevel_width;
554 for (y=0; y < (ssize_t) height; y++)
556 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
558 SetPixelInfoPixel(frame_image,&highlight,q);
559 q+=GetPixelChannels(frame_image);
561 width=frame_image->columns-2*frame_info->outer_bevel;
562 for (x=0; x < (ssize_t) width; x++)
564 SetPixelInfoPixel(frame_image,&matte,q);
565 q+=GetPixelChannels(frame_image);
567 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
569 SetPixelInfoPixel(frame_image,&shadow,q);
570 q+=GetPixelChannels(frame_image);
573 for (y=frame_info->outer_bevel-1; y >= 0; y--)
575 for (x=0; x < y; x++)
577 SetPixelInfoPixel(frame_image,&highlight,q);
578 q+=GetPixelChannels(frame_image);
580 for ( ; x < (ssize_t) frame_image->columns; x++)
582 if (x >= (ssize_t) (frame_image->columns-y))
583 SetPixelInfoPixel(frame_image,&shadow,q);
585 SetPixelInfoPixel(frame_image,&trough,q);
586 q+=GetPixelChannels(frame_image);
589 (void) SyncCacheViewAuthenticPixels(frame_view,exception);
592 frame_view=DestroyCacheView(frame_view);
593 image_view=DestroyCacheView(image_view);
594 if ((compose != CopyCompositeOp) && ((compose != OverCompositeOp) ||
595 (image->alpha_trait == BlendPixelTrait)))
597 x=(ssize_t) (frame_info->outer_bevel+(frame_info->x-bevel_width)+
598 frame_info->inner_bevel);
599 y=(ssize_t) (frame_info->outer_bevel+(frame_info->y-bevel_width)+
600 frame_info->inner_bevel);
601 (void) CompositeImage(frame_image,image,compose,MagickTrue,x,y,
608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
612 % R a i s e I m a g e %
616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
618 % RaiseImage() creates a simulated three-dimensional button-like effect
619 % by lightening and darkening the edges of the image. Members width and
620 % height of raise_info define the width of the vertical and horizontal
621 % edge of the effect.
623 % The format of the RaiseImage method is:
625 % MagickBooleanType RaiseImage(const Image *image,
626 % const RectangleInfo *raise_info,const MagickBooleanType raise,
627 % ExceptionInfo *exception)
629 % A description of each parameter follows:
631 % o image: the image.
633 % o raise_info: Define the width and height of the raise area.
635 % o raise: A value other than zero creates a 3-D raise effect,
636 % otherwise it has a lowered effect.
638 % o exception: return any errors or warnings in this structure.
641 MagickExport MagickBooleanType RaiseImage(Image *image,
642 const RectangleInfo *raise_info,const MagickBooleanType raise,
643 ExceptionInfo *exception)
645 #define AccentuateFactor ScaleCharToQuantum(135)
646 #define HighlightFactor ScaleCharToQuantum(190)
647 #define ShadowFactor ScaleCharToQuantum(190)
648 #define RaiseImageTag "Raise/Image"
649 #define TroughFactor ScaleCharToQuantum(135)
667 assert(image != (Image *) NULL);
668 assert(image->signature == MagickSignature);
669 if (image->debug != MagickFalse)
670 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
671 assert(raise_info != (RectangleInfo *) NULL);
672 if ((image->columns <= (raise_info->width << 1)) ||
673 (image->rows <= (raise_info->height << 1)))
674 ThrowBinaryException(OptionError,"ImageSizeMustExceedBevelWidth",
676 foreground=QuantumRange;
677 background=(Quantum) 0;
678 if (raise == MagickFalse)
680 foreground=(Quantum) 0;
681 background=QuantumRange;
683 if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
690 image_view=AcquireAuthenticCacheView(image,exception);
691 #if defined(MAGICKCORE_OPENMP_SUPPORT) && defined(NoBenefitFromParallelism)
692 #pragma omp parallel for schedule(static,4) shared(progress,status) \
693 dynamic_number_threads(image,image->columns,image->rows,1)
695 for (y=0; y < (ssize_t) raise_info->height; y++)
704 if (status == MagickFalse)
706 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
707 if (q == (Quantum *) NULL)
712 for (x=0; x < y; x++)
714 if (GetPixelMask(image,q) != 0)
716 q+=GetPixelChannels(image);
719 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
727 channel=GetPixelChannelChannel(image,i);
728 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++)
751 channel=GetPixelChannelChannel(image,i);
752 traits=GetPixelChannelTraits(image,channel);
753 if ((traits & UpdatePixelTrait) == 0)
755 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*AccentuateFactor+
756 (double) foreground*(QuantumRange-AccentuateFactor)));
758 q+=GetPixelChannels(image);
760 for ( ; x < (ssize_t) image->columns; x++)
762 if (GetPixelMask(image,q) != 0)
764 q+=GetPixelChannels(image);
767 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
775 channel=GetPixelChannelChannel(image,i);
776 traits=GetPixelChannelTraits(image,channel);
777 if ((traits & UpdatePixelTrait) == 0)
779 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
780 background*(QuantumRange-ShadowFactor)));
782 q+=GetPixelChannels(image);
784 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
786 if (image->progress_monitor != (MagickProgressMonitor) NULL)
791 #if defined(MAGICKCORE_OPENMP_SUPPORT) && defined(NoBenefitFromParallelism)
792 #pragma omp critical (MagickCore_RaiseImage)
794 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
795 if (proceed == MagickFalse)
799 #if defined(MAGICKCORE_OPENMP_SUPPORT) && defined(NoBenefitFromParallelism)
800 #pragma omp parallel for schedule(static,4) shared(progress,status) \
801 dynamic_number_threads(image,image->columns,image->rows,1)
803 for (y=(ssize_t) raise_info->height; y < (ssize_t) (image->rows-raise_info->height); y++)
812 if (status == MagickFalse)
814 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
815 if (q == (Quantum *) NULL)
820 for (x=0; x < (ssize_t) raise_info->width; x++)
822 if (GetPixelMask(image,q) != 0)
824 q+=GetPixelChannels(image);
827 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
835 channel=GetPixelChannelChannel(image,i);
836 traits=GetPixelChannelTraits(image,channel);
837 if ((traits & UpdatePixelTrait) == 0)
839 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
840 foreground*(QuantumRange-HighlightFactor)));
842 q+=GetPixelChannels(image);
844 for ( ; x < (ssize_t) (image->columns-raise_info->width); x++)
845 q+=GetPixelChannels(image);
846 for ( ; x < (ssize_t) image->columns; x++)
848 if (GetPixelMask(image,q) != 0)
850 q+=GetPixelChannels(image);
853 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
861 channel=GetPixelChannelChannel(image,i);
862 traits=GetPixelChannelTraits(image,channel);
863 if ((traits & UpdatePixelTrait) == 0)
865 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
866 background*(QuantumRange-ShadowFactor)));
868 q+=GetPixelChannels(image);
870 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
872 if (image->progress_monitor != (MagickProgressMonitor) NULL)
877 #if defined(MAGICKCORE_OPENMP_SUPPORT) && defined(NoBenefitFromParallelism)
878 #pragma omp critical (MagickCore_RaiseImage)
880 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
881 if (proceed == MagickFalse)
885 #if defined(MAGICKCORE_OPENMP_SUPPORT) && defined(NoBenefitFromParallelism)
886 #pragma omp parallel for schedule(static,4) shared(progress,status) \
887 dynamic_number_threads(image,image->columns,image->rows,1)
889 for (y=(ssize_t) (image->rows-raise_info->height); y < (ssize_t) image->rows; y++)
898 if (status == MagickFalse)
900 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
901 if (q == (Quantum *) NULL)
906 for (x=0; x < (ssize_t) (image->rows-y); x++)
908 if (GetPixelMask(image,q) != 0)
910 q+=GetPixelChannels(image);
913 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
921 channel=GetPixelChannelChannel(image,i);
922 traits=GetPixelChannelTraits(image,channel);
923 if ((traits & UpdatePixelTrait) == 0)
925 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
926 foreground*(QuantumRange-HighlightFactor)));
928 q+=GetPixelChannels(image);
930 for ( ; x < (ssize_t) (image->columns-(image->rows-y)); x++)
932 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
940 channel=GetPixelChannelChannel(image,i);
941 traits=GetPixelChannelTraits(image,channel);
942 if ((traits & UpdatePixelTrait) == 0)
944 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*TroughFactor+
945 (double) background*(QuantumRange-TroughFactor)));
947 q+=GetPixelChannels(image);
949 for ( ; x < (ssize_t) image->columns; x++)
951 if (GetPixelMask(image,q) != 0)
953 q+=GetPixelChannels(image);
956 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
964 channel=GetPixelChannelChannel(image,i);
965 traits=GetPixelChannelTraits(image,channel);
966 if ((traits & UpdatePixelTrait) == 0)
968 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
969 background*(QuantumRange-ShadowFactor)));
971 q+=GetPixelChannels(image);
973 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
975 if (image->progress_monitor != (MagickProgressMonitor) NULL)
980 #if defined(MAGICKCORE_OPENMP_SUPPORT) && defined(NoBenefitFromParallelism)
981 #pragma omp critical (MagickCore_RaiseImage)
983 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
984 if (proceed == MagickFalse)
988 image_view=DestroyCacheView(image_view);