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 if ((traits & (CopyPixelTrait | UpdatePixelTrait)) == 0)
469 p+=GetPixelChannels(image);
470 q+=GetPixelChannels(frame_image);
473 for (x=0; x < (ssize_t) frame_info->inner_bevel; x++)
475 SetPixelInfoPixel(frame_image,&highlight,q);
476 q+=GetPixelChannels(frame_image);
478 width=frame_info->width-frame_info->x-image->columns-bevel_width;
479 for (x=0; x < (ssize_t) width; x++)
481 SetPixelInfoPixel(frame_image,&matte,q);
482 q+=GetPixelChannels(frame_image);
484 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
486 SetPixelInfoPixel(frame_image,&shadow,q);
487 q+=GetPixelChannels(frame_image);
489 if (SyncCacheViewAuthenticPixels(frame_view,exception) == MagickFalse)
491 if (image->progress_monitor != (MagickProgressMonitor) NULL)
496 #if defined(MAGICKCORE_OPENMP_SUPPORT)
497 #pragma omp critical (MagickCore_FrameImage)
499 proceed=SetImageProgress(image,FrameImageTag,progress++,image->rows);
500 if (proceed == MagickFalse)
504 height=(size_t) (frame_info->inner_bevel+frame_info->height-
505 frame_info->y-image->rows-bevel_width+frame_info->outer_bevel);
515 Draw bottom of ornamental border.
517 q=QueueCacheViewAuthenticPixels(frame_view,0,(ssize_t) (frame_image->rows-
518 height),frame_image->columns,height,exception);
519 if (q != (Quantum *) NULL)
522 Draw bottom of ornamental border.
524 for (y=frame_info->inner_bevel-1; y >= 0; y--)
526 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
528 SetPixelInfoPixel(frame_image,&highlight,q);
529 q+=GetPixelChannels(frame_image);
531 for (x=0; x < (ssize_t) (frame_info->x-bevel_width); x++)
533 SetPixelInfoPixel(frame_image,&matte,q);
534 q+=GetPixelChannels(frame_image);
536 for (x=0; x < y; x++)
538 SetPixelInfoPixel(frame_image,&shadow,q);
539 q+=GetPixelChannels(frame_image);
541 for ( ; x < (ssize_t) (image->columns+2*frame_info->inner_bevel); x++)
543 if (x >= (ssize_t) (image->columns+2*frame_info->inner_bevel-y))
544 SetPixelInfoPixel(frame_image,&highlight,q);
546 SetPixelInfoPixel(frame_image,&accentuate,q);
547 q+=GetPixelChannels(frame_image);
549 width=frame_info->width-frame_info->x-image->columns-bevel_width;
550 for (x=0; x < (ssize_t) width; x++)
552 SetPixelInfoPixel(frame_image,&matte,q);
553 q+=GetPixelChannels(frame_image);
555 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
557 SetPixelInfoPixel(frame_image,&shadow,q);
558 q+=GetPixelChannels(frame_image);
561 height=frame_info->height-frame_info->y-image->rows-bevel_width;
562 for (y=0; y < (ssize_t) height; y++)
564 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
566 SetPixelInfoPixel(frame_image,&highlight,q);
567 q+=GetPixelChannels(frame_image);
569 width=frame_image->columns-2*frame_info->outer_bevel;
570 for (x=0; x < (ssize_t) width; x++)
572 SetPixelInfoPixel(frame_image,&matte,q);
573 q+=GetPixelChannels(frame_image);
575 for (x=0; x < (ssize_t) frame_info->outer_bevel; x++)
577 SetPixelInfoPixel(frame_image,&shadow,q);
578 q+=GetPixelChannels(frame_image);
581 for (y=frame_info->outer_bevel-1; y >= 0; y--)
583 for (x=0; x < y; x++)
585 SetPixelInfoPixel(frame_image,&highlight,q);
586 q+=GetPixelChannels(frame_image);
588 for ( ; x < (ssize_t) frame_image->columns; x++)
590 if (x >= (ssize_t) (frame_image->columns-y))
591 SetPixelInfoPixel(frame_image,&shadow,q);
593 SetPixelInfoPixel(frame_image,&trough,q);
594 q+=GetPixelChannels(frame_image);
597 (void) SyncCacheViewAuthenticPixels(frame_view,exception);
600 frame_view=DestroyCacheView(frame_view);
601 image_view=DestroyCacheView(image_view);
602 if ((compose != CopyCompositeOp) && ((compose != OverCompositeOp) ||
603 (image->alpha_trait == BlendPixelTrait)))
605 x=(ssize_t) (frame_info->outer_bevel+(frame_info->x-bevel_width)+
606 frame_info->inner_bevel);
607 y=(ssize_t) (frame_info->outer_bevel+(frame_info->y-bevel_width)+
608 frame_info->inner_bevel);
609 (void) CompositeImage(frame_image,image,compose,MagickTrue,x,y,
612 if (status == MagickFalse)
613 frame_image=DestroyImage(frame_image);
618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
622 % R a i s e I m a g e %
626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
628 % RaiseImage() creates a simulated three-dimensional button-like effect
629 % by lightening and darkening the edges of the image. Members width and
630 % height of raise_info define the width of the vertical and horizontal
631 % edge of the effect.
633 % The format of the RaiseImage method is:
635 % MagickBooleanType RaiseImage(const Image *image,
636 % const RectangleInfo *raise_info,const MagickBooleanType raise,
637 % ExceptionInfo *exception)
639 % A description of each parameter follows:
641 % o image: the image.
643 % o raise_info: Define the width and height of the raise area.
645 % o raise: A value other than zero creates a 3-D raise effect,
646 % otherwise it has a lowered effect.
648 % o exception: return any errors or warnings in this structure.
651 MagickExport MagickBooleanType RaiseImage(Image *image,
652 const RectangleInfo *raise_info,const MagickBooleanType raise,
653 ExceptionInfo *exception)
655 #define AccentuateFactor ScaleCharToQuantum(135)
656 #define HighlightFactor ScaleCharToQuantum(190)
657 #define ShadowFactor ScaleCharToQuantum(190)
658 #define RaiseImageTag "Raise/Image"
659 #define TroughFactor ScaleCharToQuantum(135)
677 assert(image != (Image *) NULL);
678 assert(image->signature == MagickSignature);
679 if (image->debug != MagickFalse)
680 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
681 assert(raise_info != (RectangleInfo *) NULL);
682 if ((image->columns <= (raise_info->width << 1)) ||
683 (image->rows <= (raise_info->height << 1)))
684 ThrowBinaryException(OptionError,"ImageSizeMustExceedBevelWidth",
686 foreground=QuantumRange;
687 background=(Quantum) 0;
688 if (raise == MagickFalse)
690 foreground=(Quantum) 0;
691 background=QuantumRange;
693 if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
700 image_view=AcquireAuthenticCacheView(image,exception);
701 #if defined(MAGICKCORE_OPENMP_SUPPORT)
702 #pragma omp parallel for schedule(static,4) shared(progress,status) \
703 magick_threads(image,image,1,1)
705 for (y=0; y < (ssize_t) raise_info->height; y++)
714 if (status == MagickFalse)
716 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
717 if (q == (Quantum *) NULL)
722 for (x=0; x < y; x++)
724 if (GetPixelReadMask(image,q) == 0)
726 q+=GetPixelChannels(image);
729 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
731 PixelChannel channel=GetPixelChannelChannel(image,i);
732 PixelTrait traits=GetPixelChannelTraits(image,channel);
733 if ((traits & UpdatePixelTrait) == 0)
735 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
736 foreground*(QuantumRange-HighlightFactor)));
738 q+=GetPixelChannels(image);
740 for ( ; x < (ssize_t) (image->columns-y); x++)
742 if (GetPixelReadMask(image,q) == 0)
744 q+=GetPixelChannels(image);
747 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
749 PixelChannel channel=GetPixelChannelChannel(image,i);
750 PixelTrait traits=GetPixelChannelTraits(image,channel);
751 if ((traits & UpdatePixelTrait) == 0)
753 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*AccentuateFactor+
754 (double) foreground*(QuantumRange-AccentuateFactor)));
756 q+=GetPixelChannels(image);
758 for ( ; x < (ssize_t) image->columns; x++)
760 if (GetPixelReadMask(image,q) == 0)
762 q+=GetPixelChannels(image);
765 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
767 PixelChannel channel=GetPixelChannelChannel(image,i);
768 PixelTrait traits=GetPixelChannelTraits(image,channel);
769 if ((traits & UpdatePixelTrait) == 0)
771 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
772 background*(QuantumRange-ShadowFactor)));
774 q+=GetPixelChannels(image);
776 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
778 if (image->progress_monitor != (MagickProgressMonitor) NULL)
783 #if defined(MAGICKCORE_OPENMP_SUPPORT)
784 #pragma omp critical (MagickCore_RaiseImage)
786 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
787 if (proceed == MagickFalse)
791 #if defined(MAGICKCORE_OPENMP_SUPPORT)
792 #pragma omp parallel for schedule(static,4) shared(progress,status) \
793 magick_threads(image,image,1,1)
795 for (y=(ssize_t) raise_info->height; y < (ssize_t) (image->rows-raise_info->height); y++)
804 if (status == MagickFalse)
806 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
807 if (q == (Quantum *) NULL)
812 for (x=0; x < (ssize_t) raise_info->width; x++)
814 if (GetPixelReadMask(image,q) == 0)
816 q+=GetPixelChannels(image);
819 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
821 PixelChannel channel=GetPixelChannelChannel(image,i);
822 PixelTrait traits=GetPixelChannelTraits(image,channel);
823 if ((traits & UpdatePixelTrait) == 0)
825 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
826 foreground*(QuantumRange-HighlightFactor)));
828 q+=GetPixelChannels(image);
830 for ( ; x < (ssize_t) (image->columns-raise_info->width); x++)
831 q+=GetPixelChannels(image);
832 for ( ; x < (ssize_t) image->columns; x++)
834 if (GetPixelReadMask(image,q) == 0)
836 q+=GetPixelChannels(image);
839 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
841 PixelChannel channel=GetPixelChannelChannel(image,i);
842 PixelTrait traits=GetPixelChannelTraits(image,channel);
843 if ((traits & UpdatePixelTrait) == 0)
845 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
846 background*(QuantumRange-ShadowFactor)));
848 q+=GetPixelChannels(image);
850 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
852 if (image->progress_monitor != (MagickProgressMonitor) NULL)
857 #if defined(MAGICKCORE_OPENMP_SUPPORT)
858 #pragma omp critical (MagickCore_RaiseImage)
860 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
861 if (proceed == MagickFalse)
865 #if defined(MAGICKCORE_OPENMP_SUPPORT)
866 #pragma omp parallel for schedule(static,4) shared(progress,status) \
867 magick_threads(image,image,1,1)
869 for (y=(ssize_t) (image->rows-raise_info->height); y < (ssize_t) image->rows; y++)
878 if (status == MagickFalse)
880 q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
881 if (q == (Quantum *) NULL)
886 for (x=0; x < (ssize_t) (image->rows-y); x++)
888 if (GetPixelReadMask(image,q) == 0)
890 q+=GetPixelChannels(image);
893 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
895 PixelChannel channel=GetPixelChannelChannel(image,i);
896 PixelTrait traits=GetPixelChannelTraits(image,channel);
897 if ((traits & UpdatePixelTrait) == 0)
899 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*HighlightFactor+(double)
900 foreground*(QuantumRange-HighlightFactor)));
902 q+=GetPixelChannels(image);
904 for ( ; x < (ssize_t) (image->columns-(image->rows-y)); x++)
906 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
908 PixelChannel channel=GetPixelChannelChannel(image,i);
909 PixelTrait traits=GetPixelChannelTraits(image,channel);
910 if ((traits & UpdatePixelTrait) == 0)
912 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*TroughFactor+
913 (double) background*(QuantumRange-TroughFactor)));
915 q+=GetPixelChannels(image);
917 for ( ; x < (ssize_t) image->columns; x++)
919 if (GetPixelReadMask(image,q) == 0)
921 q+=GetPixelChannels(image);
924 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
926 PixelChannel channel=GetPixelChannelChannel(image,i);
927 PixelTrait traits=GetPixelChannelTraits(image,channel);
928 if ((traits & UpdatePixelTrait) == 0)
930 q[i]=ClampToQuantum(QuantumScale*((double) q[i]*ShadowFactor+(double)
931 background*(QuantumRange-ShadowFactor)));
933 q+=GetPixelChannels(image);
935 if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
937 if (image->progress_monitor != (MagickProgressMonitor) NULL)
942 #if defined(MAGICKCORE_OPENMP_SUPPORT)
943 #pragma omp critical (MagickCore_RaiseImage)
945 proceed=SetImageProgress(image,RaiseImageTag,progress++,image->rows);
946 if (proceed == MagickFalse)
950 image_view=DestroyCacheView(image_view);