]> granicus.if.org Git - imagemagick/blob - MagickCore/pixel-accessor.h
(no commit message)
[imagemagick] / MagickCore / pixel-accessor.h
1 /*
2   Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
3   dedicated to making software imaging solutions freely available.
4
5   You may not use this file except in compliance with the License.
6   obtain a copy of the License at
7
8     http://www.imagemagick.org/script/license.php
9
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.
15
16   MagickCore pixel accessor methods.
17 */
18 #ifndef _MAGICKCORE_PIXEL_ACCESSOR_H
19 #define _MAGICKCORE_PIXEL_ACCESSOR_H
20
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24
25 #include <math.h>
26 #include <MagickCore/cache-view.h>
27 #include <MagickCore/color.h>
28 #include <MagickCore/image.h>
29
30 #undef index
31
32 static inline Quantum GetPixelAlpha(const Image *restrict image,
33   const Quantum *restrict pixel)
34 {
35   if (image->channel_map[AlphaPixelChannel].traits == UndefinedPixelTrait)
36     return(OpaqueAlpha);
37   return(pixel[image->channel_map[AlphaPixelChannel].offset]);
38 }
39
40 static inline PixelTrait GetPixelAlphaTraits(const Image *restrict image)
41 {
42   return(image->channel_map[AlphaPixelChannel].traits);
43 }
44
45 static inline Quantum GetPixelBlack(const Image *restrict image,
46   const Quantum *restrict pixel)
47 {
48   if (image->channel_map[BlackPixelChannel].traits == UndefinedPixelTrait)
49     return(0);
50   return(pixel[image->channel_map[BlackPixelChannel].offset]);
51 }
52
53 static inline PixelTrait GetPixelBlackTraits(const Image *restrict image)
54 {
55   return(image->channel_map[BlackPixelChannel].traits);
56 }
57
58 static inline Quantum GetPixelBlue(const Image *restrict image,
59   const Quantum *restrict pixel)
60 {
61   return(pixel[image->channel_map[BluePixelChannel].offset]);
62 }
63
64 static inline PixelTrait GetPixelBlueTraits(const Image *restrict image)
65 {
66   return(image->channel_map[BluePixelChannel].traits);
67 }
68
69 static inline Quantum GetPixelCb(const Image *restrict image,
70   const Quantum *restrict pixel)
71 {
72   return(pixel[image->channel_map[CbPixelChannel].offset]);
73 }
74
75 static inline PixelTrait GetPixelCbTraits(const Image *restrict image)
76 {
77   return(image->channel_map[CbPixelChannel].traits);
78 }
79
80 static inline Quantum GetPixelChannel(const Image *restrict image,
81   const PixelChannel channel,const Quantum *restrict pixel)
82 {
83   if (image->channel_map[channel].traits == UndefinedPixelTrait)
84     return(0);
85   return(pixel[image->channel_map[channel].offset]);
86 }
87
88 static inline PixelChannel GetPixelChannelMapChannel(
89   const Image *restrict image,const ssize_t offset)
90 {
91   return(image->channel_map[offset].channel);
92 }
93
94 static inline ssize_t GetPixelChannelMapOffset(const Image *restrict image,
95   const PixelChannel channel)
96 {
97   return(image->channel_map[channel].offset);
98 }
99
100 static inline PixelTrait GetPixelChannelMapTraits(const Image *restrict image,
101   const PixelChannel channel)
102 {
103   return(image->channel_map[channel].traits);
104 }
105
106 static inline size_t GetPixelChannels(const Image *restrict image)
107 {
108   return(image->number_channels);
109 }
110
111 static inline Quantum GetPixelCr(const Image *restrict image,
112   const Quantum *restrict pixel)
113 {
114   return(pixel[image->channel_map[CrPixelChannel].offset]);
115 }
116
117 static inline PixelTrait GetPixelCrTraits(const Image *restrict image)
118 {
119   return(image->channel_map[CrPixelChannel].traits);
120 }
121
122 static inline Quantum GetPixelCyan(const Image *restrict image,
123   const Quantum *restrict pixel)
124 {
125   return(pixel[image->channel_map[CyanPixelChannel].offset]);
126 }
127
128 static inline PixelTrait GetPixelCyanTraits(const Image *restrict image)
129 {
130   return(image->channel_map[CyanPixelChannel].traits);
131 }
132
133 static inline Quantum GetPixelGray(const Image *restrict image,
134   const Quantum *restrict pixel)
135 {
136   return(pixel[image->channel_map[GrayPixelChannel].offset]);
137 }
138
139 static inline PixelTrait GetPixelGrayTraits(const Image *restrict image)
140 {
141   return(image->channel_map[GrayPixelChannel].traits);
142 }
143
144 static inline Quantum GetPixelGreen(const Image *restrict image,
145   const Quantum *restrict pixel)
146 {
147   return(pixel[image->channel_map[GreenPixelChannel].offset]);
148 }
149
150 static inline PixelTrait GetPixelGreenTraits(const Image *restrict image)
151 {
152   return(image->channel_map[GreenPixelChannel].traits);
153 }
154
155 static inline Quantum GetPixelIndex(const Image *restrict image,
156   const Quantum *restrict pixel)
157 {
158   if (image->channel_map[IndexPixelChannel].traits == UndefinedPixelTrait)
159     return(0);
160   return(pixel[image->channel_map[IndexPixelChannel].offset]);
161 }
162
163 static inline PixelTrait GetPixelIndexTraits(const Image *restrict image)
164 {
165   return(image->channel_map[IndexPixelChannel].traits);
166 }
167
168 static inline Quantum GetPixelInfoIntensity(
169   const PixelInfo *restrict pixel_info)
170 {
171 #if !defined(MAGICKCORE_HDRI_SUPPORT)
172   return((Quantum) (0.299*pixel_info->red+0.587*pixel_info->green+0.114*
173     pixel_info->blue+0.5));
174 #else
175   return((Quantum) (0.299*pixel_info->red+0.587*pixel_info->green+0.114*
176     pixel_info->blue));
177 #endif
178 }
179
180 static inline Quantum GetPixelInfoLuminance(
181   const PixelInfo *restrict pixel_info)
182 {
183   Quantum
184     luminance;
185
186 #if !defined(MAGICKCORE_HDRI_SUPPORT)
187   luminance=(Quantum) (0.21267*pixel_info->red+0.71516*pixel_info->green+
188     0.07217*pixel_info->blue+0.5);
189 #else
190   luminance=(Quantum) (0.21267*pixel_info->red+0.71516*pixel_info->green+
191     0.07217*pixel_info->blue);
192 #endif
193   return((Quantum) luminance);
194 }
195
196 static inline Quantum GetPixelIntensity(const Image *restrict image,
197   const Quantum *restrict pixel)
198 {
199 #if !defined(MAGICKCORE_HDRI_SUPPORT)
200   if ((pixel[image->channel_map[RedPixelChannel].offset] ==
201        pixel[image->channel_map[GreenPixelChannel].offset]) &&
202       (pixel[image->channel_map[GreenPixelChannel].offset] ==
203        pixel[image->channel_map[BluePixelChannel].offset]))
204     return(pixel[image->channel_map[RedPixelChannel].offset]);
205   return((Quantum) (0.299*pixel[image->channel_map[RedPixelChannel].offset]+
206     0.587*pixel[image->channel_map[GreenPixelChannel].offset]+0.114*
207     pixel[image->channel_map[BluePixelChannel].offset]+0.5));
208 #else
209   {
210     double
211       alpha,
212       beta;
213
214     alpha=pixel[image->channel_map[RedPixelChannel].offset]-(double)
215       pixel[image->channel_map[GreenPixelChannel].offset];
216     beta=pixel[image->channel_map[GreenPixelChannel].offset]-(double)
217       pixel[image->channel_map[BluePixelChannel].offset];
218     if ((fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon))
219       return(pixel[image->channel_map[RedPixelChannel].offset]);
220     return((Quantum) (0.299*pixel[image->channel_map[RedPixelChannel].offset]+
221       0.587*pixel[image->channel_map[GreenPixelChannel].offset]+0.114*
222       pixel[image->channel_map[BluePixelChannel].offset]));
223   }
224 #endif
225 }
226
227 static inline Quantum GetPixelLuminance(const Image *restrict image,
228   const Quantum *restrict pixel)
229 {
230 #if !defined(MAGICKCORE_HDRI_SUPPORT)
231   return((Quantum) (0.21267*pixel[image->channel_map[RedPixelChannel].offset]+
232     0.71516*pixel[image->channel_map[GreenPixelChannel].offset]+0.07217*
233     pixel[image->channel_map[BluePixelChannel].offset]+0.5));
234 #else
235   return((Quantum) (0.21267*pixel[image->channel_map[RedPixelChannel].offset]+
236     0.71516*pixel[image->channel_map[GreenPixelChannel].offset]+0.07217*
237     pixel[image->channel_map[BluePixelChannel].offset]));
238 #endif
239 }
240
241 static inline Quantum GetPixelMagenta(const Image *restrict image,
242   const Quantum *restrict pixel)
243 {
244   return(pixel[image->channel_map[MagentaPixelChannel].offset]);
245 }
246
247 static inline PixelTrait GetPixelMagentaTraits(const Image *restrict image)
248 {
249   return(image->channel_map[MagentaPixelChannel].traits);
250 }
251
252 static inline size_t GetPixelMetaChannels(const Image *restrict image)
253 {
254   return(image->number_meta_channels);
255 }
256
257 static inline size_t GetPixelMetacontentExtent(const Image *restrict image)
258 {
259   return(image->metacontent_extent);
260 }
261
262 static inline Quantum GetPixelRed(const Image *restrict image,
263   const Quantum *restrict pixel)
264 {
265   return(pixel[image->channel_map[RedPixelChannel].offset]);
266 }
267
268 static inline PixelTrait GetPixelRedTraits(const Image *restrict image)
269 {
270   return(image->channel_map[RedPixelChannel].traits);
271 }
272
273 static inline void GetPixelInfoPixel(const Image *restrict image,
274   const Quantum *restrict pixel,PixelInfo *restrict pixel_info)
275 {
276   pixel_info->red=(MagickRealType)
277     pixel[image->channel_map[RedPixelChannel].offset];
278   pixel_info->green=(MagickRealType)
279     pixel[image->channel_map[GreenPixelChannel].offset];
280   pixel_info->blue=(MagickRealType)
281     pixel[image->channel_map[BluePixelChannel].offset];
282   pixel_info->black=0;
283   if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
284     pixel_info->black=(MagickRealType)
285       pixel[image->channel_map[BlackPixelChannel].offset];
286   pixel_info->alpha=OpaqueAlpha;
287   if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
288     pixel_info->alpha=(MagickRealType)
289       pixel[image->channel_map[AlphaPixelChannel].offset];
290   pixel_info->index=0;
291   if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait)
292     pixel_info->index=(MagickRealType)
293       pixel[image->channel_map[IndexPixelChannel].offset];
294 }
295
296 static inline PixelTrait GetPixelTraits(const Image *restrict image,
297   const PixelChannel channel)
298 {
299   return(image->channel_map[channel].traits);
300 }
301
302 static inline Quantum GetPixelY(const Image *restrict image,
303   const Quantum *restrict pixel)
304 {
305   return(pixel[image->channel_map[YPixelChannel].offset]);
306 }
307
308 static inline PixelTrait GetPixelYTraits(const Image *restrict image)
309 {
310   return(image->channel_map[YPixelChannel].traits);
311 }
312
313 static inline Quantum GetPixelYellow(const Image *restrict image,
314   const Quantum *restrict pixel)
315 {
316   return(pixel[image->channel_map[YellowPixelChannel].offset]);
317 }
318
319 static inline PixelTrait GetPixelYellowTraits(const Image *restrict image)
320 {
321   return(image->channel_map[YellowPixelChannel].traits);
322 }
323
324 static inline MagickBooleanType IsPixelEquivalent(const Image *restrict image,
325   const Quantum *restrict p,const PixelInfo *restrict q)
326 {
327   if (((double) p[image->channel_map[RedPixelChannel].offset] == q->red) &&
328       ((double) p[image->channel_map[GreenPixelChannel].offset] == q->green) &&
329       ((double) p[image->channel_map[BluePixelChannel].offset] == q->blue))
330     return(MagickTrue);
331   return(MagickFalse);
332 }
333
334 static inline MagickBooleanType IsPixelGray(const Image *restrict image,
335   const Quantum *restrict pixel)
336 {
337 #if !defined(MAGICKCORE_HDRI_SUPPORT)
338   if ((pixel[image->channel_map[RedPixelChannel].offset] ==
339        pixel[image->channel_map[GreenPixelChannel].offset]) &&
340       (pixel[image->channel_map[GreenPixelChannel].offset] ==
341        pixel[image->channel_map[BluePixelChannel].offset]))
342     return(MagickTrue);
343 #else
344   {
345     double
346       alpha,
347       beta;
348
349     alpha=pixel[image->channel_map[RedPixelChannel].offset]-(double)
350       pixel[image->channel_map[GreenPixelChannel].offset];
351     beta=pixel[image->channel_map[GreenPixelChannel].offset]-(double)
352       pixel[image->channel_map[BluePixelChannel].offset];
353     if ((fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon))
354       return(MagickTrue);
355   }
356 #endif
357   return(MagickFalse);
358 }
359
360 static inline MagickBooleanType IsPixelInfoEquivalent(
361   const PixelInfo *restrict p,const PixelInfo *restrict q)
362 {
363   if ((p->matte != MagickFalse) && (q->matte == MagickFalse) &&
364       (fabs(p->alpha-OpaqueAlpha) > 0.5))
365     return(MagickFalse);
366   if ((q->matte != MagickFalse) && (p->matte == MagickFalse) &&
367       (fabs(q->alpha-OpaqueAlpha)) > 0.5)
368     return(MagickFalse);
369   if ((p->matte != MagickFalse) && (q->matte != MagickFalse))
370     {
371       if (fabs(p->alpha-q->alpha) > 0.5)
372         return(MagickFalse);
373       if (fabs(p->alpha-TransparentAlpha) <= 0.5)
374         return(MagickTrue);
375     }
376   if (fabs(p->red-q->red) > 0.5)
377     return(MagickFalse);
378   if (fabs(p->green-q->green) > 0.5)
379     return(MagickFalse);
380   if (fabs(p->blue-q->blue) > 0.5)
381     return(MagickFalse);
382   if ((p->colorspace == CMYKColorspace) && (fabs(p->black-q->black) > 0.5))
383     return(MagickFalse);
384   return(MagickTrue);
385 }
386
387 static inline MagickBooleanType IsPixelMonochrome(const Image *restrict image,
388   const Quantum *restrict pixel)
389 {
390 #if !defined(MAGICKCORE_HDRI_SUPPORT)
391   if (((pixel[image->channel_map[RedPixelChannel].offset] == 0) ||
392       (pixel[image->channel_map[RedPixelChannel].offset] == (Quantum) QuantumRange)) &&
393       (pixel[image->channel_map[RedPixelChannel].offset] ==
394        pixel[image->channel_map[GreenPixelChannel].offset]) &&
395       (pixel[image->channel_map[GreenPixelChannel].offset] ==
396        pixel[image->channel_map[BluePixelChannel].offset]))
397     return(MagickTrue);
398 #else
399   {
400     double
401       alpha,
402       beta;
403
404     alpha=pixel[image->channel_map[RedPixelChannel].offset]-(double)
405       pixel[image->channel_map[GreenPixelChannel].offset];
406     beta=pixel[image->channel_map[GreenPixelChannel].offset]-(double)
407       pixel[image->channel_map[BluePixelChannel].offset];
408     if (((fabs(pixel[image->channel_map[RedPixelChannel].offset]) <= MagickEpsilon) ||
409          (fabs(pixel[image->channel_map[RedPixelChannel].offset]-QuantumRange) <= MagickEpsilon)) &&
410         (fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon))
411       return(MagickTrue);
412     }
413 #endif
414   return(MagickFalse);
415 }
416
417 static inline MagickBooleanType IsPixelInfoGray(
418   const PixelInfo *restrict pixel_info)
419 {
420 #if !defined(MAGICKCORE_HDRI_SUPPORT)
421   if ((pixel_info->red == pixel_info->green) &&
422       (pixel_info->green == pixel_info->blue))
423     return(MagickTrue);
424 #else
425   {
426     double
427       alpha,
428       beta;
429
430     alpha=pixel_info->red-(double) pixel_info->green;
431     beta=pixel_info->green-(double) pixel_info->blue;
432     if ((fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon))
433       return(MagickTrue);
434   }
435 #endif
436   return(MagickFalse);
437 }
438
439 static inline MagickBooleanType IsPixelInfoMonochrome(
440   const PixelInfo *restrict pixel_info)
441 {
442 #if !defined(MAGICKCORE_HDRI_SUPPORT)
443   if (((pixel_info->red == 0) || (pixel_info->red == (Quantum) QuantumRange)) &&
444       (pixel_info->red == pixel_info->green) &&
445       (pixel_info->green == pixel_info->blue))
446     return(MagickTrue);
447 #else
448   {
449     double
450       alpha,
451       beta;
452
453     alpha=pixel_info->red-(double) pixel_info->green;
454     beta=pixel_info->green-(double) pixel_info->blue;
455     if (((fabs(pixel_info->red) <= MagickEpsilon) ||
456          (fabs(pixel_info->red-QuantumRange) <= MagickEpsilon)) &&
457         (fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon))
458       return(MagickTrue);
459     }
460 #endif
461   return(MagickFalse);
462 }
463
464 static inline void SetPixelAlpha(const Image *restrict image,
465   const Quantum alpha,Quantum *restrict pixel)
466 {
467   if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
468     pixel[image->channel_map[AlphaPixelChannel].offset]=alpha;
469 }
470
471 static inline void SetPixelAlphaTraits(Image *image,const PixelTrait traits)
472 {
473   image->channel_map[AlphaPixelChannel].traits=traits;
474 }
475
476 static inline void SetPixelBlack(const Image *restrict image,
477   const Quantum black,Quantum *restrict pixel)
478 {
479   if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
480     pixel[image->channel_map[BlackPixelChannel].offset]=black;
481 }
482
483 static inline void SetPixelBlackTraits(Image *image,const PixelTrait traits)
484 {
485   image->channel_map[BlackPixelChannel].traits=traits;
486 }
487
488 static inline void SetPixelBlue(const Image *restrict image,const Quantum blue,
489   Quantum *restrict pixel)
490 {
491   pixel[image->channel_map[BluePixelChannel].offset]=blue;
492 }
493
494 static inline void SetPixelBlueTraits(Image *image,const PixelTrait traits)
495 {
496   image->channel_map[BluePixelChannel].traits=traits;
497 }
498
499 static inline void SetPixelCb(const Image *restrict image,const Quantum cb,
500   Quantum *restrict pixel)
501 {
502   pixel[image->channel_map[CbPixelChannel].offset]=cb;
503 }
504
505 static inline void SetPixelCbTraits(Image *image,const PixelTrait traits)
506 {
507   image->channel_map[CbPixelChannel].traits=traits;
508 }
509
510 static inline void SetPixelChannel(const Image *restrict image,
511   const PixelChannel channel,const Quantum quantum,Quantum *restrict pixel)
512 {
513   if (image->channel_map[channel].traits != UndefinedPixelTrait)
514     pixel[image->channel_map[channel].offset]=quantum;
515 }
516
517 static inline void SetPixelChannelMapChannel(const Image *restrict image,
518   const PixelChannel channel,const ssize_t offset)
519 {
520   image->channel_map[offset].channel=channel;
521   image->channel_map[channel].offset=offset;
522 }
523
524 static inline void SetPixelChannelMap(const Image *restrict image,
525   const PixelChannel channel,const PixelTrait traits,const ssize_t offset)
526 {
527   image->channel_map[offset].channel=channel;
528   image->channel_map[channel].offset=offset;
529   image->channel_map[channel].traits=traits;
530 }
531
532 static inline void SetPixelChannels(Image *image,const size_t number_channels)
533 {
534   image->number_channels=number_channels;
535 }
536
537 static inline void SetPixelChannelTraits(Image *image,
538   const PixelChannel channel,const PixelTrait traits)
539 {
540   image->channel_map[channel].traits=traits;
541 }
542
543 static inline void SetPixelChannelMapTraits(Image *image,
544   const PixelChannel channel,const PixelTrait traits)
545 {
546   image->channel_map[channel].traits=traits;
547 }
548
549 static inline void SetPixelCr(const Image *restrict image,const Quantum cr,
550   Quantum *restrict pixel)
551 {
552   pixel[image->channel_map[CrPixelChannel].offset]=cr;
553 }
554
555 static inline void SetPixelCrTraits(Image *image,const PixelTrait traits)
556 {
557   image->channel_map[CrPixelChannel].traits=traits;
558 }
559
560 static inline void SetPixelCyan(const Image *restrict image,const Quantum cyan,
561   Quantum *restrict pixel)
562 {
563   pixel[image->channel_map[CyanPixelChannel].offset]=cyan;
564 }
565
566 static inline void SetPixelGray(const Image *restrict image,const Quantum gray,
567   Quantum *restrict pixel)
568 {
569   pixel[image->channel_map[GrayPixelChannel].offset]=gray;
570 }
571
572 static inline void SetPixelGrayTraits(Image *image,const PixelTrait traits)
573 {
574   image->channel_map[GrayPixelChannel].traits=traits;
575 }
576
577 static inline void SetPixelGreen(const Image *restrict image,
578   const Quantum green,Quantum *restrict pixel)
579 {
580   pixel[image->channel_map[GreenPixelChannel].offset]=green;
581 }
582
583 static inline void SetPixelGreenTraits(Image *image,const PixelTrait traits)
584 {
585   image->channel_map[GreenPixelChannel].traits=traits;
586 }
587
588 static inline void SetPixelIndex(const Image *restrict image,
589   const Quantum index,Quantum *restrict pixel)
590 {
591   if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait)
592     pixel[image->channel_map[IndexPixelChannel].offset]=index;
593 }
594
595 static inline void SetPixelIndexTraits(Image *image,const PixelTrait traits)
596 {
597   image->channel_map[IndexPixelChannel].traits=traits;
598 }
599
600 static inline void SetPixelInfoPixel(const Image *restrict image,
601   const PixelInfo *restrict pixel_info,Quantum *restrict pixel)
602 {
603   pixel[image->channel_map[RedPixelChannel].offset]=
604     ClampToQuantum(pixel_info->red);
605   pixel[image->channel_map[GreenPixelChannel].offset]=
606     ClampToQuantum(pixel_info->green);
607   pixel[image->channel_map[BluePixelChannel].offset]=
608     ClampToQuantum(pixel_info->blue);
609   if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
610     pixel[image->channel_map[BlackPixelChannel].offset]=
611       ClampToQuantum(pixel_info->black);
612   if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
613     pixel[image->channel_map[AlphaPixelChannel].offset]=pixel_info->matte ==
614       MagickFalse ? OpaqueAlpha : ClampToQuantum(pixel_info->alpha);
615 }
616
617 static inline void SetPixelMagenta(const Image *restrict image,
618   const Quantum magenta,Quantum *restrict pixel)
619 {
620   pixel[image->channel_map[MagentaPixelChannel].offset]=magenta;
621 }
622
623 static inline void SetPixelMagentaTraits(Image *image,const PixelTrait traits)
624 {
625   image->channel_map[MagentaPixelChannel].traits=traits;
626 }
627
628 static inline void SetPixelMetaChannels(Image *image,
629   const size_t number_meta_channels)
630 {
631   image->number_meta_channels=number_meta_channels;
632 }
633
634 static inline void SetPixelMetacontentExtent(Image *image,const size_t extent)
635 {
636   image->metacontent_extent=extent;
637 }
638
639 static inline void SetPixelRed(const Image *restrict image,const Quantum red,
640   Quantum *restrict pixel)
641 {
642   pixel[image->channel_map[RedPixelChannel].offset]=red;
643 }
644
645 static inline void SetPixelRedTraits(Image *image,const PixelTrait traits)
646 {
647   image->channel_map[RedPixelChannel].traits=traits;
648 }
649
650 static inline void SetPixelYellow(const Image *restrict image,
651   const Quantum yellow,Quantum *restrict pixel)
652 {
653   pixel[image->channel_map[YellowPixelChannel].offset]=yellow;
654 }
655
656 static inline void SetPixelYellowTraits(Image *image,const PixelTrait traits)
657 {
658   image->channel_map[YellowPixelChannel].traits=traits;
659 }
660
661 static inline void SetPixelY(const Image *restrict image,const Quantum y,
662   Quantum *restrict pixel)
663 {
664   pixel[image->channel_map[YPixelChannel].offset]=y;
665 }
666
667 static inline void SetPixelYTraits(Image *image,const PixelTrait traits)
668 {
669   image->channel_map[YPixelChannel].traits=traits;
670 }
671
672 #if defined(__cplusplus) || defined(c_plusplus)
673 }
674 #endif
675
676 #endif