2 Copyright 1999-2015 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 GetPixelInfoLuma(const PixelInfo *restrict pixel)
204 if (pixel->colorspace == GRAYColorspace)
206 if (pixel->colorspace == sRGBColorspace)
207 return(0.212656f*pixel->red+0.715158f*pixel->green+0.072186f*pixel->blue);
208 red=EncodePixelGamma(pixel->red);
209 green=EncodePixelGamma(pixel->green);
210 blue=EncodePixelGamma(pixel->blue);
211 return(0.212656f*red+0.715158f*green+0.072186f*blue);
214 static inline MagickRealType GetPixelInfoLuminance(
215 const PixelInfo *restrict pixel)
222 if (pixel->colorspace == GRAYColorspace)
224 if (pixel->colorspace != sRGBColorspace)
225 return(0.212656f*pixel->red+0.715158f*pixel->green+0.072186f*pixel->blue);
226 red=DecodePixelGamma(pixel->red);
227 green=DecodePixelGamma(pixel->green);
228 blue=DecodePixelGamma(pixel->blue);
229 return(0.212656f*red+0.715158f*green+0.072186f*blue);
232 static inline Quantum GetPixelL(const Image *restrict image,
233 const Quantum *restrict pixel)
235 return(pixel[image->channel_map[LPixelChannel].offset]);
238 static inline MagickRealType GetPixelLuma(const Image *restrict image,
239 const Quantum *restrict pixel)
241 if (image->colorspace == GRAYColorspace)
242 return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]);
243 return(0.212656f*pixel[image->channel_map[RedPixelChannel].offset]+
244 0.715158f*pixel[image->channel_map[GreenPixelChannel].offset]+
245 0.072186f*pixel[image->channel_map[BluePixelChannel].offset]); /* Rec709 */
248 static inline MagickRealType GetPixelLuminance(const Image *restrict image,
249 const Quantum *restrict pixel)
256 if (image->colorspace == GRAYColorspace)
257 return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]);
258 if (image->colorspace != sRGBColorspace)
259 return(0.212656f*pixel[image->channel_map[RedPixelChannel].offset]+
260 0.715158f*pixel[image->channel_map[GreenPixelChannel].offset]+
261 0.072186f*pixel[image->channel_map[BluePixelChannel].offset]);
262 red=DecodePixelGamma((MagickRealType)
263 pixel[image->channel_map[RedPixelChannel].offset]);
264 green=DecodePixelGamma((MagickRealType)
265 pixel[image->channel_map[GreenPixelChannel].offset]);
266 blue=DecodePixelGamma((MagickRealType)
267 pixel[image->channel_map[BluePixelChannel].offset]);
268 return(0.212656f*red+0.715158f*green+0.072186f*blue); /* Rec709 */
271 static inline Quantum GetPixelMagenta(const Image *restrict image,
272 const Quantum *restrict pixel)
274 return(pixel[image->channel_map[MagentaPixelChannel].offset]);
277 static inline PixelTrait GetPixelMagentaTraits(const Image *restrict image)
279 return(image->channel_map[MagentaPixelChannel].traits);
282 static inline Quantum GetPixelReadMask(const Image *restrict image,
283 const Quantum *restrict pixel)
285 if (image->channel_map[ReadMaskPixelChannel].traits == UndefinedPixelTrait)
286 return((Quantum) QuantumRange);
287 return(pixel[image->channel_map[ReadMaskPixelChannel].offset]);
290 static inline Quantum GetPixelWriteMask(const Image *restrict image,
291 const Quantum *restrict pixel)
293 if (image->channel_map[WriteMaskPixelChannel].traits == UndefinedPixelTrait)
294 return((Quantum) QuantumRange);
295 return(pixel[image->channel_map[WriteMaskPixelChannel].offset]);
298 static inline PixelTrait GetPixelReadMaskTraits(const Image *restrict image)
300 return(image->channel_map[ReadMaskPixelChannel].traits);
303 static inline size_t GetPixelMetaChannels(const Image *restrict image)
305 return(image->number_meta_channels);
308 static inline size_t GetPixelMetacontentExtent(const Image *restrict image)
310 return(image->metacontent_extent);
313 static inline Quantum GetPixelOpacity(const Image *restrict image,
314 const Quantum *restrict pixel)
316 if (image->channel_map[AlphaPixelChannel].traits != BlendPixelTrait)
317 return(QuantumRange-OpaqueAlpha);
318 return(QuantumRange-pixel[image->channel_map[AlphaPixelChannel].offset]);
321 static inline Quantum GetPixelRed(const Image *restrict image,
322 const Quantum *restrict pixel)
324 return(pixel[image->channel_map[RedPixelChannel].offset]);
327 static inline PixelTrait GetPixelRedTraits(const Image *restrict image)
329 return(image->channel_map[RedPixelChannel].traits);
332 static inline void GetPixelInfoPixel(const Image *restrict image,
333 const Quantum *restrict pixel,PixelInfo *restrict pixel_info)
335 pixel_info->colorspace=image->colorspace;
336 pixel_info->fuzz=image->fuzz;
337 pixel_info->red=(MagickRealType)
338 pixel[image->channel_map[RedPixelChannel].offset];
339 pixel_info->green=(MagickRealType)
340 pixel[image->channel_map[GreenPixelChannel].offset];
341 pixel_info->blue=(MagickRealType)
342 pixel[image->channel_map[BluePixelChannel].offset];
343 pixel_info->black=0.0f;
344 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
345 pixel_info->black=(MagickRealType)
346 pixel[image->channel_map[BlackPixelChannel].offset];
347 pixel_info->alpha=(MagickRealType) OpaqueAlpha;
348 pixel_info->alpha_trait=UndefinedPixelTrait;
349 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
351 pixel_info->alpha=(MagickRealType)
352 pixel[image->channel_map[AlphaPixelChannel].offset];
353 pixel_info->alpha_trait=BlendPixelTrait;
355 pixel_info->index=0.0f;
356 if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait)
357 pixel_info->index=(MagickRealType)
358 pixel[image->channel_map[IndexPixelChannel].offset];
361 static inline PixelTrait GetPixelTraits(const Image *restrict image,
362 const PixelChannel channel)
364 return(image->channel_map[channel].traits);
367 static inline Quantum GetPixelY(const Image *restrict image,
368 const Quantum *restrict pixel)
370 return(pixel[image->channel_map[YPixelChannel].offset]);
373 static inline PixelTrait GetPixelYTraits(const Image *restrict image)
375 return(image->channel_map[YPixelChannel].traits);
378 static inline Quantum GetPixelYellow(const Image *restrict image,
379 const Quantum *restrict pixel)
381 return(pixel[image->channel_map[YellowPixelChannel].offset]);
384 static inline PixelTrait GetPixelYellowTraits(const Image *restrict image)
386 return(image->channel_map[YellowPixelChannel].traits);
389 static inline MagickRealType AbsolutePixelValue(const MagickRealType x)
391 return(x < 0.0f ? -x : x);
394 static inline MagickBooleanType IsPixelAtDepth(const Quantum pixel,
395 const QuantumAny range)
400 #if !defined(MAGICKCORE_HDRI_SUPPORT)
401 quantum=(Quantum) (((MagickRealType) QuantumRange*((QuantumAny)
402 (((MagickRealType) range*pixel)/QuantumRange+0.5)))/range+0.5);
404 quantum=(Quantum) (((MagickRealType) QuantumRange*((QuantumAny)
405 (((MagickRealType) range*pixel)/QuantumRange+0.5)))/range);
407 return(pixel == quantum ? MagickTrue : MagickFalse);
410 static inline MagickBooleanType IsPixelEquivalent(const Image *restrict image,
411 const Quantum *restrict p,const PixelInfo *restrict q)
418 red=(MagickRealType) p[image->channel_map[RedPixelChannel].offset];
419 green=(MagickRealType) p[image->channel_map[GreenPixelChannel].offset];
420 blue=(MagickRealType) p[image->channel_map[BluePixelChannel].offset];
421 if ((AbsolutePixelValue(red-q->red) < MagickEpsilon) &&
422 (AbsolutePixelValue(green-q->green) < MagickEpsilon) &&
423 (AbsolutePixelValue(blue-q->blue) < MagickEpsilon))
428 static inline MagickBooleanType IsPixelGray(const Image *restrict image,
429 const Quantum *restrict pixel)
436 red=(MagickRealType) pixel[image->channel_map[RedPixelChannel].offset];
437 green=(MagickRealType) pixel[image->channel_map[GreenPixelChannel].offset];
438 blue=(MagickRealType) pixel[image->channel_map[BluePixelChannel].offset];
439 if ((AbsolutePixelValue(red-green) < MagickEpsilon) &&
440 (AbsolutePixelValue(green-blue) < MagickEpsilon))
445 static inline MagickBooleanType IsPixelInfoEquivalent(
446 const PixelInfo *restrict p,const PixelInfo *restrict q)
448 if ((p->alpha_trait != UndefinedPixelTrait) &&
449 (q->alpha_trait == UndefinedPixelTrait) &&
450 (AbsolutePixelValue(p->alpha-OpaqueAlpha) >= MagickEpsilon))
452 if ((q->alpha_trait != UndefinedPixelTrait) &&
453 (p->alpha_trait == UndefinedPixelTrait) &&
454 (AbsolutePixelValue(q->alpha-OpaqueAlpha)) >= MagickEpsilon)
456 if ((p->alpha_trait != UndefinedPixelTrait) &&
457 (q->alpha_trait != UndefinedPixelTrait))
459 if (AbsolutePixelValue(p->alpha-q->alpha) >= MagickEpsilon)
461 if (AbsolutePixelValue(p->alpha-TransparentAlpha) < MagickEpsilon)
464 if (AbsolutePixelValue(p->red-q->red) >= MagickEpsilon)
466 if (AbsolutePixelValue(p->green-q->green) >= MagickEpsilon)
468 if (AbsolutePixelValue(p->blue-q->blue) >= MagickEpsilon)
470 if ((p->colorspace == CMYKColorspace) &&
471 (AbsolutePixelValue(p->black-q->black) >= MagickEpsilon))
476 static inline MagickBooleanType IsPixelMonochrome(const Image *restrict image,
477 const Quantum *restrict pixel)
484 red=(MagickRealType) pixel[image->channel_map[RedPixelChannel].offset];
485 if ((AbsolutePixelValue(red) >= MagickEpsilon) ||
486 (AbsolutePixelValue(red-QuantumRange) >= MagickEpsilon))
488 green=(MagickRealType) pixel[image->channel_map[GreenPixelChannel].offset];
489 blue=(MagickRealType) pixel[image->channel_map[BluePixelChannel].offset];
490 if ((AbsolutePixelValue(red-green) < MagickEpsilon) &&
491 (AbsolutePixelValue(green-blue) < MagickEpsilon))
496 static inline MagickBooleanType IsPixelInfoGray(
497 const PixelInfo *restrict pixel_info)
499 if ((pixel_info->colorspace != GRAYColorspace) &&
500 (pixel_info->colorspace != RGBColorspace))
502 if ((AbsolutePixelValue(pixel_info->red-pixel_info->green) < MagickEpsilon) &&
503 (AbsolutePixelValue(pixel_info->green-pixel_info->blue) < MagickEpsilon))
508 static inline MagickBooleanType IsPixelInfoMonochrome(
509 const PixelInfo *restrict pixel_info)
511 if ((pixel_info->colorspace != GRAYColorspace) &&
512 (pixel_info->colorspace != RGBColorspace))
514 if ((AbsolutePixelValue(pixel_info->red) >= MagickEpsilon) ||
515 (AbsolutePixelValue(pixel_info->red-QuantumRange) >= MagickEpsilon))
517 if ((AbsolutePixelValue(pixel_info->red-pixel_info->green) < MagickEpsilon) &&
518 (AbsolutePixelValue(pixel_info->green-pixel_info->blue) < MagickEpsilon))
523 static inline void SetPixela(const Image *restrict image,
524 const Quantum a,Quantum *restrict pixel)
526 if (image->channel_map[aPixelChannel].traits != UndefinedPixelTrait)
527 pixel[image->channel_map[aPixelChannel].offset]=a;
530 static inline void SetPixelAlpha(const Image *restrict image,
531 const Quantum alpha,Quantum *restrict pixel)
533 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
534 pixel[image->channel_map[AlphaPixelChannel].offset]=alpha;
537 static inline void SetPixelAlphaTraits(Image *image,const PixelTrait traits)
539 image->channel_map[AlphaPixelChannel].traits=traits;
542 static inline void SetPixelb(const Image *restrict image,
543 const Quantum b,Quantum *restrict pixel)
545 if (image->channel_map[bPixelChannel].traits != UndefinedPixelTrait)
546 pixel[image->channel_map[bPixelChannel].offset]=b;
549 static inline void SetPixelBackgoundColor(const Image *restrict image,
550 Quantum *restrict pixel)
555 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
557 pixel[image->channel_map[RedPixelChannel].offset]=
558 ClampToQuantum(image->background_color.red);
559 pixel[image->channel_map[GreenPixelChannel].offset]=
560 ClampToQuantum(image->background_color.green);
561 pixel[image->channel_map[BluePixelChannel].offset]=
562 ClampToQuantum(image->background_color.blue);
563 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
564 pixel[image->channel_map[BlackPixelChannel].offset]=
565 ClampToQuantum(image->background_color.black);
566 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
567 pixel[image->channel_map[AlphaPixelChannel].offset]=
568 image->background_color.alpha_trait == UndefinedPixelTrait ? OpaqueAlpha :
569 ClampToQuantum(image->background_color.alpha);
572 static inline void SetPixelBlack(const Image *restrict image,
573 const Quantum black,Quantum *restrict pixel)
575 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
576 pixel[image->channel_map[BlackPixelChannel].offset]=black;
579 static inline void SetPixelBlackTraits(Image *image,const PixelTrait traits)
581 image->channel_map[BlackPixelChannel].traits=traits;
584 static inline void SetPixelBlue(const Image *restrict image,const Quantum blue,
585 Quantum *restrict pixel)
587 pixel[image->channel_map[BluePixelChannel].offset]=blue;
590 static inline void SetPixelBlueTraits(Image *image,const PixelTrait traits)
592 image->channel_map[BluePixelChannel].traits=traits;
595 static inline void SetPixelCb(const Image *restrict image,const Quantum cb,
596 Quantum *restrict pixel)
598 pixel[image->channel_map[CbPixelChannel].offset]=cb;
601 static inline void SetPixelCbTraits(Image *image,const PixelTrait traits)
603 image->channel_map[CbPixelChannel].traits=traits;
606 static inline void SetPixelChannel(const Image *restrict image,
607 const PixelChannel channel,const Quantum quantum,Quantum *restrict pixel)
609 if (image->channel_map[channel].traits != UndefinedPixelTrait)
610 pixel[image->channel_map[channel].offset]=quantum;
613 static inline void SetPixelChannelAttributes(const Image *restrict image,
614 const PixelChannel channel,const PixelTrait traits,const ssize_t offset)
616 image->channel_map[offset].channel=channel;
617 image->channel_map[channel].offset=offset;
618 image->channel_map[channel].traits=traits;
621 static inline void SetPixelChannelChannel(const Image *restrict image,
622 const PixelChannel channel,const ssize_t offset)
624 image->channel_map[offset].channel=channel;
625 image->channel_map[channel].offset=offset;
628 static inline void SetPixelChannels(Image *image,const size_t number_channels)
630 image->number_channels=number_channels;
633 static inline void SetPixelChannelTraits(Image *image,
634 const PixelChannel channel,const PixelTrait traits)
636 image->channel_map[channel].traits=traits;
639 static inline void SetPixelCr(const Image *restrict image,const Quantum cr,
640 Quantum *restrict pixel)
642 pixel[image->channel_map[CrPixelChannel].offset]=cr;
645 static inline void SetPixelCrTraits(Image *image,const PixelTrait traits)
647 image->channel_map[CrPixelChannel].traits=traits;
650 static inline void SetPixelCyan(const Image *restrict image,const Quantum cyan,
651 Quantum *restrict pixel)
653 pixel[image->channel_map[CyanPixelChannel].offset]=cyan;
656 static inline void SetPixelGray(const Image *restrict image,const Quantum gray,
657 Quantum *restrict pixel)
659 pixel[image->channel_map[GrayPixelChannel].offset]=gray;
662 static inline void SetPixelGrayTraits(Image *image,const PixelTrait traits)
664 image->channel_map[GrayPixelChannel].traits=traits;
667 static inline void SetPixelGreen(const Image *restrict image,
668 const Quantum green,Quantum *restrict pixel)
670 pixel[image->channel_map[GreenPixelChannel].offset]=green;
673 static inline void SetPixelGreenTraits(Image *image,const PixelTrait traits)
675 image->channel_map[GreenPixelChannel].traits=traits;
678 static inline void SetPixelIndex(const Image *restrict image,
679 const Quantum index,Quantum *restrict pixel)
681 if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait)
682 pixel[image->channel_map[IndexPixelChannel].offset]=index;
685 static inline void SetPixelIndexTraits(Image *image,const PixelTrait traits)
687 image->channel_map[IndexPixelChannel].traits=traits;
690 static inline void SetPixelViaPixelInfo(const Image *restrict image,
691 const PixelInfo *restrict pixel_info,Quantum *restrict pixel)
693 pixel[image->channel_map[RedPixelChannel].offset]=
694 ClampToQuantum(pixel_info->red);
695 pixel[image->channel_map[GreenPixelChannel].offset]=
696 ClampToQuantum(pixel_info->green);
697 pixel[image->channel_map[BluePixelChannel].offset]=
698 ClampToQuantum(pixel_info->blue);
699 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
700 pixel[image->channel_map[BlackPixelChannel].offset]=
701 ClampToQuantum(pixel_info->black);
702 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
703 pixel[image->channel_map[AlphaPixelChannel].offset]=
704 pixel_info->alpha_trait == UndefinedPixelTrait ? OpaqueAlpha :
705 ClampToQuantum(pixel_info->alpha);
708 static inline void SetPixelL(const Image *restrict image,const Quantum L,
709 Quantum *restrict pixel)
711 if (image->channel_map[LPixelChannel].traits != UndefinedPixelTrait)
712 pixel[image->channel_map[LPixelChannel].offset]=L;
715 static inline void SetPixelMagenta(const Image *restrict image,
716 const Quantum magenta,Quantum *restrict pixel)
718 pixel[image->channel_map[MagentaPixelChannel].offset]=magenta;
721 static inline void SetPixelMagentaTraits(Image *image,const PixelTrait traits)
723 image->channel_map[MagentaPixelChannel].traits=traits;
726 static inline void SetPixelReadMask(const Image *restrict image,
727 const Quantum mask,Quantum *restrict pixel)
729 if (image->channel_map[ReadMaskPixelChannel].traits != UndefinedPixelTrait)
730 pixel[image->channel_map[ReadMaskPixelChannel].offset]=mask;
733 static inline void SetPixelWriteMask(const Image *restrict image,
734 const Quantum mask,Quantum *restrict pixel)
736 if (image->channel_map[WriteMaskPixelChannel].traits != UndefinedPixelTrait)
737 pixel[image->channel_map[WriteMaskPixelChannel].offset]=mask;
740 static inline void SetPixelMetacontentExtent(Image *image,const size_t extent)
742 image->metacontent_extent=extent;
745 static inline void SetPixelOpacity(const Image *restrict image,
746 const Quantum alpha,Quantum *restrict pixel)
748 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
749 pixel[image->channel_map[AlphaPixelChannel].offset]=QuantumRange-alpha;
752 static inline void SetPixelRed(const Image *restrict image,const Quantum red,
753 Quantum *restrict pixel)
755 pixel[image->channel_map[RedPixelChannel].offset]=red;
758 static inline void SetPixelRedTraits(Image *image,const PixelTrait traits)
760 image->channel_map[RedPixelChannel].traits=traits;
763 static inline void SetPixelYellow(const Image *restrict image,
764 const Quantum yellow,Quantum *restrict pixel)
766 pixel[image->channel_map[YellowPixelChannel].offset]=yellow;
769 static inline void SetPixelYellowTraits(Image *image,const PixelTrait traits)
771 image->channel_map[YellowPixelChannel].traits=traits;
774 static inline void SetPixelY(const Image *restrict image,const Quantum y,
775 Quantum *restrict pixel)
777 pixel[image->channel_map[YPixelChannel].offset]=y;
780 static inline void SetPixelYTraits(Image *image,const PixelTrait traits)
782 image->channel_map[YPixelChannel].traits=traits;
785 #if defined(__cplusplus) || defined(c_plusplus)