2 Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 http://www.imagemagick.org/script/license.php
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
16 MagickCore pixel accessor methods.
18 #ifndef _MAGICKCORE_PIXEL_ACCESSOR_H
19 #define _MAGICKCORE_PIXEL_ACCESSOR_H
21 #include "MagickCore/cache.h"
22 #include "MagickCore/cache-view.h"
23 #include "MagickCore/color.h"
24 #include "MagickCore/colorspace.h"
25 #include "MagickCore/gem.h"
26 #include "MagickCore/image.h"
28 #if defined(__cplusplus) || defined(c_plusplus)
34 static inline Quantum GetPixela(const Image *restrict image,
35 const Quantum *restrict pixel)
37 return(pixel[image->channel_map[aPixelChannel].offset]);
40 static inline Quantum GetPixelAlpha(const Image *restrict image,
41 const Quantum *restrict pixel)
43 if (image->channel_map[AlphaPixelChannel].traits == UndefinedPixelTrait)
45 return(pixel[image->channel_map[AlphaPixelChannel].offset]);
48 static inline PixelTrait GetPixelAlphaTraits(const Image *restrict image)
50 return(image->channel_map[AlphaPixelChannel].traits);
53 static inline Quantum GetPixelb(const Image *restrict image,
54 const Quantum *restrict pixel)
56 return(pixel[image->channel_map[bPixelChannel].offset]);
59 static inline Quantum GetPixelBlack(const Image *restrict image,
60 const Quantum *restrict pixel)
62 if (image->channel_map[BlackPixelChannel].traits == UndefinedPixelTrait)
64 return(pixel[image->channel_map[BlackPixelChannel].offset]);
67 static inline PixelTrait GetPixelBlackTraits(const Image *restrict image)
69 return(image->channel_map[BlackPixelChannel].traits);
72 static inline Quantum GetPixelBlue(const Image *restrict image,
73 const Quantum *restrict pixel)
75 return(pixel[image->channel_map[BluePixelChannel].offset]);
78 static inline PixelTrait GetPixelBlueTraits(const Image *restrict image)
80 return(image->channel_map[BluePixelChannel].traits);
83 static inline Quantum GetPixelCb(const Image *restrict image,
84 const Quantum *restrict pixel)
86 return(pixel[image->channel_map[CbPixelChannel].offset]);
89 static inline PixelTrait GetPixelCbTraits(const Image *restrict image)
91 return(image->channel_map[CbPixelChannel].traits);
94 static inline Quantum GetPixelChannel(const Image *restrict image,
95 const PixelChannel channel,const Quantum *restrict pixel)
97 if (image->channel_map[channel].traits == UndefinedPixelTrait)
99 return(pixel[image->channel_map[channel].offset]);
102 static inline PixelChannel GetPixelChannelChannel(const Image *restrict image,
103 const ssize_t offset)
105 return(image->channel_map[offset].channel);
108 static inline ssize_t GetPixelChannelOffset(const Image *restrict image,
109 const PixelChannel channel)
111 return(image->channel_map[channel].offset);
114 static inline PixelTrait GetPixelChannelTraits(const Image *restrict image,
115 const PixelChannel channel)
117 return(image->channel_map[channel].traits);
120 static inline size_t GetPixelChannels(const Image *restrict image)
122 return(image->number_channels);
125 static inline Quantum GetPixelCr(const Image *restrict image,
126 const Quantum *restrict pixel)
128 return(pixel[image->channel_map[CrPixelChannel].offset]);
131 static inline PixelTrait GetPixelCrTraits(const Image *restrict image)
133 return(image->channel_map[CrPixelChannel].traits);
136 static inline Quantum GetPixelCyan(const Image *restrict image,
137 const Quantum *restrict pixel)
139 return(pixel[image->channel_map[CyanPixelChannel].offset]);
142 static inline PixelTrait GetPixelCyanTraits(const Image *restrict image)
144 return(image->channel_map[CyanPixelChannel].traits);
147 static inline Quantum GetPixelGray(const Image *restrict image,
148 const Quantum *restrict pixel)
150 return(pixel[image->channel_map[GrayPixelChannel].offset]);
153 static inline PixelTrait GetPixelGrayTraits(const Image *restrict image)
155 return(image->channel_map[GrayPixelChannel].traits);
158 static inline Quantum GetPixelGreen(const Image *restrict image,
159 const Quantum *restrict pixel)
161 return(pixel[image->channel_map[GreenPixelChannel].offset]);
164 static inline PixelTrait GetPixelGreenTraits(const Image *restrict image)
166 return(image->channel_map[GreenPixelChannel].traits);
169 static inline Quantum GetPixelIndex(const Image *restrict image,
170 const Quantum *restrict pixel)
172 if (image->channel_map[IndexPixelChannel].traits == UndefinedPixelTrait)
174 return(pixel[image->channel_map[IndexPixelChannel].offset]);
177 static inline PixelTrait GetPixelIndexTraits(const Image *restrict image)
179 return(image->channel_map[IndexPixelChannel].traits);
182 static inline MagickRealType GetPixelInfoChannel(
183 const PixelInfo *restrict pixel_info,const PixelChannel channel)
187 case RedPixelChannel: return(pixel_info->red);
188 case GreenPixelChannel: return(pixel_info->green);
189 case BluePixelChannel: return(pixel_info->blue);
190 case BlackPixelChannel: return(pixel_info->black);
191 case AlphaPixelChannel: return(pixel_info->alpha);
192 case IndexPixelChannel: return(pixel_info->index);
193 default: return((MagickRealType) 0.0);
197 static inline MagickRealType GetPixelInfoIntensity(
198 const PixelInfo *restrict pixel_info)
200 if (pixel_info->colorspace == GRAYColorspace)
201 return(pixel_info->red);
202 return(0.212656*pixel_info->red+0.715158*pixel_info->green+0.072186*
206 static inline MagickRealType GetPixelInfoLuma(const PixelInfo *restrict pixel)
213 if (pixel->colorspace == GRAYColorspace)
215 if (pixel->colorspace == sRGBColorspace)
216 return(0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue);
217 red=EncodePixelGamma(pixel->red);
218 green=EncodePixelGamma(pixel->green);
219 blue=EncodePixelGamma(pixel->blue);
220 return(0.212656*red+0.715158*green+0.072186*blue);
223 static inline MagickRealType GetPixelInfoLuminance(
224 const PixelInfo *restrict pixel)
231 if (pixel->colorspace == GRAYColorspace)
233 if (pixel->colorspace != sRGBColorspace)
234 return(0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue);
235 red=DecodePixelGamma(pixel->red);
236 green=DecodePixelGamma(pixel->green);
237 blue=DecodePixelGamma(pixel->blue);
238 return(0.212656*red+0.715158*green+0.072186*blue);
241 static inline Quantum GetPixelL(const Image *restrict image,
242 const Quantum *restrict pixel)
244 return(pixel[image->channel_map[LPixelChannel].offset]);
247 static inline MagickRealType GetPixelLuma(const Image *restrict image,
248 const Quantum *restrict pixel)
250 if (image->colorspace == GRAYColorspace)
251 return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]);
252 return(0.212656f*pixel[image->channel_map[RedPixelChannel].offset]+
253 0.715158f*pixel[image->channel_map[GreenPixelChannel].offset]+
254 0.072186f*pixel[image->channel_map[BluePixelChannel].offset]); /* Rec709 */
257 static inline MagickRealType GetPixelLuminance(const Image *restrict image,
258 const Quantum *restrict pixel)
265 if (image->colorspace == GRAYColorspace)
266 return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]);
267 if (image->colorspace != sRGBColorspace)
268 return(0.212656*pixel[image->channel_map[RedPixelChannel].offset]+
269 0.715158*pixel[image->channel_map[GreenPixelChannel].offset]+
270 0.072186*pixel[image->channel_map[BluePixelChannel].offset]);
271 red=DecodePixelGamma((MagickRealType)
272 pixel[image->channel_map[RedPixelChannel].offset]);
273 green=DecodePixelGamma((MagickRealType)
274 pixel[image->channel_map[GreenPixelChannel].offset]);
275 blue=DecodePixelGamma((MagickRealType)
276 pixel[image->channel_map[BluePixelChannel].offset]);
277 return(0.212656*red+0.715158*green+0.072186*blue); /* Rec709 */
280 static inline Quantum GetPixelMagenta(const Image *restrict image,
281 const Quantum *restrict pixel)
283 return(pixel[image->channel_map[MagentaPixelChannel].offset]);
286 static inline PixelTrait GetPixelMagentaTraits(const Image *restrict image)
288 return(image->channel_map[MagentaPixelChannel].traits);
291 static inline Quantum GetPixelReadMask(const Image *restrict image,
292 const Quantum *restrict pixel)
294 if (image->channel_map[ReadMaskPixelChannel].traits == UndefinedPixelTrait)
295 return((Quantum) QuantumRange);
296 return(pixel[image->channel_map[ReadMaskPixelChannel].offset]);
299 static inline Quantum GetPixelWriteMask(const Image *restrict image,
300 const Quantum *restrict pixel)
302 if (image->channel_map[WriteMaskPixelChannel].traits == UndefinedPixelTrait)
303 return((Quantum) QuantumRange);
304 return(pixel[image->channel_map[WriteMaskPixelChannel].offset]);
307 static inline PixelTrait GetPixelReadMaskTraits(const Image *restrict image)
309 return(image->channel_map[ReadMaskPixelChannel].traits);
312 static inline size_t GetPixelMetaChannels(const Image *restrict image)
314 return(image->number_meta_channels);
317 static inline size_t GetPixelMetacontentExtent(const Image *restrict image)
319 return(image->metacontent_extent);
322 static inline Quantum GetPixelOpacity(const Image *restrict image,
323 const Quantum *restrict pixel)
325 if (image->channel_map[AlphaPixelChannel].traits == UndefinedPixelTrait)
326 return(QuantumRange-OpaqueAlpha);
327 return(QuantumRange-pixel[image->channel_map[AlphaPixelChannel].offset]);
330 static inline Quantum GetPixelRed(const Image *restrict image,
331 const Quantum *restrict pixel)
333 return(pixel[image->channel_map[RedPixelChannel].offset]);
336 static inline PixelTrait GetPixelRedTraits(const Image *restrict image)
338 return(image->channel_map[RedPixelChannel].traits);
341 static inline void GetPixelInfoPixel(const Image *restrict image,
342 const Quantum *restrict pixel,PixelInfo *restrict pixel_info)
344 pixel_info->red=(MagickRealType)
345 pixel[image->channel_map[RedPixelChannel].offset];
346 pixel_info->green=(MagickRealType)
347 pixel[image->channel_map[GreenPixelChannel].offset];
348 pixel_info->blue=(MagickRealType)
349 pixel[image->channel_map[BluePixelChannel].offset];
350 pixel_info->black=0.0f;
351 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
352 pixel_info->black=(MagickRealType)
353 pixel[image->channel_map[BlackPixelChannel].offset];
354 pixel_info->alpha=(MagickRealType) OpaqueAlpha;
355 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
356 pixel_info->alpha=(MagickRealType)
357 pixel[image->channel_map[AlphaPixelChannel].offset];
358 pixel_info->index=0.0f;
359 if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait)
360 pixel_info->index=(MagickRealType)
361 pixel[image->channel_map[IndexPixelChannel].offset];
364 static inline PixelTrait GetPixelTraits(const Image *restrict image,
365 const PixelChannel channel)
367 return(image->channel_map[channel].traits);
370 static inline Quantum GetPixelY(const Image *restrict image,
371 const Quantum *restrict pixel)
373 return(pixel[image->channel_map[YPixelChannel].offset]);
376 static inline PixelTrait GetPixelYTraits(const Image *restrict image)
378 return(image->channel_map[YPixelChannel].traits);
381 static inline Quantum GetPixelYellow(const Image *restrict image,
382 const Quantum *restrict pixel)
384 return(pixel[image->channel_map[YellowPixelChannel].offset]);
387 static inline PixelTrait GetPixelYellowTraits(const Image *restrict image)
389 return(image->channel_map[YellowPixelChannel].traits);
392 static inline MagickRealType AbsolutePixelValue(const MagickRealType x)
394 return(x < 0.0f ? -x : x);
397 static inline MagickBooleanType IsPixelAtDepth(const Quantum pixel,
398 const QuantumAny range)
403 #if !defined(MAGICKCORE_HDRI_SUPPORT)
404 quantum=(Quantum) (((MagickRealType) QuantumRange*((QuantumAny)
405 (((MagickRealType) range*pixel)/QuantumRange+0.5)))/range+0.5);
407 quantum=(Quantum) (((MagickRealType) QuantumRange*((QuantumAny)
408 (((MagickRealType) range*pixel)/QuantumRange+0.5)))/range);
410 return(pixel == quantum ? MagickTrue : MagickFalse);
413 static inline MagickBooleanType IsPixelEquivalent(const Image *restrict image,
414 const Quantum *restrict p,const PixelInfo *restrict q)
421 red=(MagickRealType) p[image->channel_map[RedPixelChannel].offset];
422 green=(MagickRealType) p[image->channel_map[GreenPixelChannel].offset];
423 blue=(MagickRealType) p[image->channel_map[BluePixelChannel].offset];
424 if ((AbsolutePixelValue(red-q->red) < MagickEpsilon) &&
425 (AbsolutePixelValue(green-q->green) < MagickEpsilon) &&
426 (AbsolutePixelValue(blue-q->blue) < MagickEpsilon))
431 static inline MagickBooleanType IsPixelGray(const Image *restrict image,
432 const Quantum *restrict pixel)
439 red=(MagickRealType) pixel[image->channel_map[RedPixelChannel].offset];
440 green=(MagickRealType) pixel[image->channel_map[GreenPixelChannel].offset];
441 blue=(MagickRealType) pixel[image->channel_map[BluePixelChannel].offset];
442 if ((AbsolutePixelValue(red-green) < MagickEpsilon) &&
443 (AbsolutePixelValue(green-blue) < MagickEpsilon))
448 static inline MagickBooleanType IsPixelInfoEquivalent(
449 const PixelInfo *restrict p,const PixelInfo *restrict q)
451 if ((p->alpha_trait == BlendPixelTrait) &&
452 (q->alpha_trait != BlendPixelTrait) &&
453 (AbsolutePixelValue(p->alpha-OpaqueAlpha) >= MagickEpsilon))
455 if ((q->alpha_trait == BlendPixelTrait) &&
456 (p->alpha_trait != BlendPixelTrait) &&
457 (AbsolutePixelValue(q->alpha-OpaqueAlpha)) >= MagickEpsilon)
459 if ((p->alpha_trait == BlendPixelTrait) &&
460 (q->alpha_trait == BlendPixelTrait))
462 if (AbsolutePixelValue(p->alpha-q->alpha) >= MagickEpsilon)
464 if (AbsolutePixelValue(p->alpha-TransparentAlpha) < MagickEpsilon)
467 if (AbsolutePixelValue(p->red-q->red) >= MagickEpsilon)
469 if (AbsolutePixelValue(p->green-q->green) >= MagickEpsilon)
471 if (AbsolutePixelValue(p->blue-q->blue) >= MagickEpsilon)
473 if ((p->colorspace == CMYKColorspace) &&
474 (AbsolutePixelValue(p->black-q->black) >= MagickEpsilon))
479 static inline MagickBooleanType IsPixelMonochrome(const Image *restrict image,
480 const Quantum *restrict pixel)
487 red=(MagickRealType) pixel[image->channel_map[RedPixelChannel].offset];
488 if ((AbsolutePixelValue(red) >= MagickEpsilon) ||
489 (AbsolutePixelValue(red-QuantumRange) >= MagickEpsilon))
491 green=(MagickRealType) pixel[image->channel_map[GreenPixelChannel].offset];
492 blue=(MagickRealType) pixel[image->channel_map[BluePixelChannel].offset];
493 if ((AbsolutePixelValue(red-green) < MagickEpsilon) &&
494 (AbsolutePixelValue(green-blue) < MagickEpsilon))
499 static inline MagickBooleanType IsPixelInfoGray(
500 const PixelInfo *restrict pixel_info)
502 if ((pixel_info->colorspace != GRAYColorspace) &&
503 (pixel_info->colorspace != RGBColorspace))
505 if ((AbsolutePixelValue(pixel_info->red-pixel_info->green) < MagickEpsilon) &&
506 (AbsolutePixelValue(pixel_info->green-pixel_info->blue) < MagickEpsilon))
511 static inline MagickBooleanType IsPixelInfoMonochrome(
512 const PixelInfo *restrict pixel_info)
514 if ((pixel_info->colorspace != GRAYColorspace) &&
515 (pixel_info->colorspace != RGBColorspace))
517 if ((AbsolutePixelValue(pixel_info->red) >= MagickEpsilon) ||
518 (AbsolutePixelValue(pixel_info->red-QuantumRange) >= MagickEpsilon))
520 if ((AbsolutePixelValue(pixel_info->red-pixel_info->green) < MagickEpsilon) &&
521 (AbsolutePixelValue(pixel_info->green-pixel_info->blue) < MagickEpsilon))
526 static inline void SetPixela(const Image *restrict image,
527 const Quantum a,Quantum *restrict pixel)
529 if (image->channel_map[aPixelChannel].traits != UndefinedPixelTrait)
530 pixel[image->channel_map[aPixelChannel].offset]=a;
533 static inline void SetPixelAlpha(const Image *restrict image,
534 const Quantum alpha,Quantum *restrict pixel)
536 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
537 pixel[image->channel_map[AlphaPixelChannel].offset]=alpha;
540 static inline void SetPixelAlphaTraits(Image *image,const PixelTrait traits)
542 image->channel_map[AlphaPixelChannel].traits=traits;
545 static inline void SetPixelb(const Image *restrict image,
546 const Quantum b,Quantum *restrict pixel)
548 if (image->channel_map[bPixelChannel].traits != UndefinedPixelTrait)
549 pixel[image->channel_map[bPixelChannel].offset]=b;
552 static inline void SetPixelBackgoundColor(const Image *restrict image,
553 Quantum *restrict pixel)
558 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
560 pixel[image->channel_map[RedPixelChannel].offset]=
561 ClampToQuantum(image->background_color.red);
562 pixel[image->channel_map[GreenPixelChannel].offset]=
563 ClampToQuantum(image->background_color.green);
564 pixel[image->channel_map[BluePixelChannel].offset]=
565 ClampToQuantum(image->background_color.blue);
566 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
567 pixel[image->channel_map[BlackPixelChannel].offset]=
568 ClampToQuantum(image->background_color.black);
569 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
570 pixel[image->channel_map[AlphaPixelChannel].offset]=
571 image->background_color.alpha_trait != BlendPixelTrait ? OpaqueAlpha :
572 ClampToQuantum(image->background_color.alpha);
575 static inline void SetPixelBlack(const Image *restrict image,
576 const Quantum black,Quantum *restrict pixel)
578 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
579 pixel[image->channel_map[BlackPixelChannel].offset]=black;
582 static inline void SetPixelBlackTraits(Image *image,const PixelTrait traits)
584 image->channel_map[BlackPixelChannel].traits=traits;
587 static inline void SetPixelBlue(const Image *restrict image,const Quantum blue,
588 Quantum *restrict pixel)
590 pixel[image->channel_map[BluePixelChannel].offset]=blue;
593 static inline void SetPixelBlueTraits(Image *image,const PixelTrait traits)
595 image->channel_map[BluePixelChannel].traits=traits;
598 static inline void SetPixelCb(const Image *restrict image,const Quantum cb,
599 Quantum *restrict pixel)
601 pixel[image->channel_map[CbPixelChannel].offset]=cb;
604 static inline void SetPixelCbTraits(Image *image,const PixelTrait traits)
606 image->channel_map[CbPixelChannel].traits=traits;
609 static inline void SetPixelChannel(const Image *restrict image,
610 const PixelChannel channel,const Quantum quantum,Quantum *restrict pixel)
612 if (image->channel_map[channel].traits != UndefinedPixelTrait)
613 pixel[image->channel_map[channel].offset]=quantum;
616 static inline void SetPixelChannelAttributes(const Image *restrict image,
617 const PixelChannel channel,const PixelTrait traits,const ssize_t offset)
619 image->channel_map[offset].channel=channel;
620 image->channel_map[channel].offset=offset;
621 image->channel_map[channel].traits=traits;
624 static inline void SetPixelChannelChannel(const Image *restrict image,
625 const PixelChannel channel,const ssize_t offset)
627 image->channel_map[offset].channel=channel;
628 image->channel_map[channel].offset=offset;
631 static inline void SetPixelChannels(Image *image,const size_t number_channels)
633 image->number_channels=number_channels;
636 static inline void SetPixelChannelTraits(Image *image,
637 const PixelChannel channel,const PixelTrait traits)
639 image->channel_map[channel].traits=traits;
642 static inline void SetPixelCr(const Image *restrict image,const Quantum cr,
643 Quantum *restrict pixel)
645 pixel[image->channel_map[CrPixelChannel].offset]=cr;
648 static inline void SetPixelCrTraits(Image *image,const PixelTrait traits)
650 image->channel_map[CrPixelChannel].traits=traits;
653 static inline void SetPixelCyan(const Image *restrict image,const Quantum cyan,
654 Quantum *restrict pixel)
656 pixel[image->channel_map[CyanPixelChannel].offset]=cyan;
659 static inline void SetPixelGray(const Image *restrict image,const Quantum gray,
660 Quantum *restrict pixel)
662 pixel[image->channel_map[GrayPixelChannel].offset]=gray;
665 static inline void SetPixelGrayTraits(Image *image,const PixelTrait traits)
667 image->channel_map[GrayPixelChannel].traits=traits;
670 static inline void SetPixelGreen(const Image *restrict image,
671 const Quantum green,Quantum *restrict pixel)
673 pixel[image->channel_map[GreenPixelChannel].offset]=green;
676 static inline void SetPixelGreenTraits(Image *image,const PixelTrait traits)
678 image->channel_map[GreenPixelChannel].traits=traits;
681 static inline void SetPixelIndex(const Image *restrict image,
682 const Quantum index,Quantum *restrict pixel)
684 if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait)
685 pixel[image->channel_map[IndexPixelChannel].offset]=index;
688 static inline void SetPixelIndexTraits(Image *image,const PixelTrait traits)
690 image->channel_map[IndexPixelChannel].traits=traits;
693 static inline void SetPixelInfoPixel(const Image *restrict image,
694 const PixelInfo *restrict pixel_info,Quantum *restrict pixel)
696 pixel[image->channel_map[RedPixelChannel].offset]=
697 ClampToQuantum(pixel_info->red);
698 pixel[image->channel_map[GreenPixelChannel].offset]=
699 ClampToQuantum(pixel_info->green);
700 pixel[image->channel_map[BluePixelChannel].offset]=
701 ClampToQuantum(pixel_info->blue);
702 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
703 pixel[image->channel_map[BlackPixelChannel].offset]=
704 ClampToQuantum(pixel_info->black);
705 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
706 pixel[image->channel_map[AlphaPixelChannel].offset]=
707 pixel_info->alpha_trait != BlendPixelTrait ? OpaqueAlpha :
708 ClampToQuantum(pixel_info->alpha);
711 static inline void SetPixelL(const Image *restrict image,const Quantum L,
712 Quantum *restrict pixel)
714 if (image->channel_map[LPixelChannel].traits != UndefinedPixelTrait)
715 pixel[image->channel_map[LPixelChannel].offset]=L;
718 static inline void SetPixelMagenta(const Image *restrict image,
719 const Quantum magenta,Quantum *restrict pixel)
721 pixel[image->channel_map[MagentaPixelChannel].offset]=magenta;
724 static inline void SetPixelMagentaTraits(Image *image,const PixelTrait traits)
726 image->channel_map[MagentaPixelChannel].traits=traits;
729 static inline void SetPixelReadMask(const Image *restrict image,
730 const Quantum mask,Quantum *restrict pixel)
732 if (image->channel_map[ReadMaskPixelChannel].traits != UndefinedPixelTrait)
733 pixel[image->channel_map[ReadMaskPixelChannel].offset]=mask;
736 static inline void SetPixelWriteMask(const Image *restrict image,
737 const Quantum mask,Quantum *restrict pixel)
739 if (image->channel_map[WriteMaskPixelChannel].traits != UndefinedPixelTrait)
740 pixel[image->channel_map[WriteMaskPixelChannel].offset]=mask;
743 static inline void SetPixelMetacontentExtent(Image *image,const size_t extent)
745 image->metacontent_extent=extent;
748 static inline void SetPixelOpacity(const Image *restrict image,
749 const Quantum alpha,Quantum *restrict pixel)
751 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
752 pixel[image->channel_map[AlphaPixelChannel].offset]=QuantumRange-alpha;
755 static inline void SetPixelRed(const Image *restrict image,const Quantum red,
756 Quantum *restrict pixel)
758 pixel[image->channel_map[RedPixelChannel].offset]=red;
761 static inline void SetPixelRedTraits(Image *image,const PixelTrait traits)
763 image->channel_map[RedPixelChannel].traits=traits;
766 static inline void SetPixelYellow(const Image *restrict image,
767 const Quantum yellow,Quantum *restrict pixel)
769 pixel[image->channel_map[YellowPixelChannel].offset]=yellow;
772 static inline void SetPixelYellowTraits(Image *image,const PixelTrait traits)
774 image->channel_map[YellowPixelChannel].traits=traits;
777 static inline void SetPixelY(const Image *restrict image,const Quantum y,
778 Quantum *restrict pixel)
780 pixel[image->channel_map[YPixelChannel].offset]=y;
783 static inline void SetPixelYTraits(Image *image,const PixelTrait traits)
785 image->channel_map[YPixelChannel].traits=traits;
788 #if defined(__cplusplus) || defined(c_plusplus)