2 Copyright 1999-2012 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 #if defined(__cplusplus) || defined(c_plusplus)
25 #include <MagickCore/cache.h>
26 #include <MagickCore/cache-view.h>
27 #include <MagickCore/color.h>
28 #include <MagickCore/colorspace.h>
29 #include <MagickCore/gem.h>
30 #include <MagickCore/image.h>
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(
103 const Image *restrict image,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 double GetPixelInfoChannel(const PixelInfo *restrict pixel_info,
183 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(0.0);
197 static inline double GetPixelInfoIntensity(const PixelInfo *restrict pixel_info)
204 if (pixel_info->colorspace == GRAYColorspace)
205 return(pixel_info->red);
206 if (pixel_info->colorspace != sRGBColorspace)
207 return(0.298839*pixel_info->red+0.586811*pixel_info->green+
208 0.114350*pixel_info->blue);
209 red=InversesRGBCompandor(pixel_info->red);
210 green=InversesRGBCompandor(pixel_info->green);
211 blue=InversesRGBCompandor(pixel_info->blue);
212 return(0.298839*red+0.586811*green+0.114350*blue);
215 static inline double GetPixelInfoLuminance(const PixelInfo *restrict pixel_info)
222 if (pixel_info->colorspace == GRAYColorspace)
223 return(pixel_info->red);
224 if (pixel_info->colorspace != sRGBColorspace)
225 return(0.21267*pixel_info->red+0.71516*pixel_info->green+
226 0.07217*pixel_info->blue);
227 red=InversesRGBCompandor(pixel_info->red);
228 green=InversesRGBCompandor(pixel_info->green);
229 blue=InversesRGBCompandor(pixel_info->blue);
230 return(0.21267*red+0.71516*green+0.07217*blue);
233 static inline double GetPixelIntensity(const Image *restrict image,
234 const Quantum *restrict pixel)
241 if (image->colorspace == GRAYColorspace)
242 return((double) pixel[image->channel_map[GrayPixelChannel].offset]);
243 if (image->colorspace != sRGBColorspace)
244 return(0.298839*pixel[image->channel_map[RedPixelChannel].offset]+
245 0.586811*pixel[image->channel_map[GreenPixelChannel].offset]+
246 0.114350*pixel[image->channel_map[BluePixelChannel].offset]);
247 red=InversesRGBCompandor((double)
248 pixel[image->channel_map[RedPixelChannel].offset]);
249 green=InversesRGBCompandor((double)
250 pixel[image->channel_map[GreenPixelChannel].offset]);
251 blue=InversesRGBCompandor((double)
252 pixel[image->channel_map[BluePixelChannel].offset]);
253 return(0.298839*red+0.586811*green+0.114350*blue);
256 static inline Quantum GetPixelL(const Image *restrict image,
257 const Quantum *restrict pixel)
259 return(pixel[image->channel_map[LPixelChannel].offset]);
262 static inline double GetPixelLuminance(const Image *restrict image,
263 const Quantum *restrict pixel)
270 if (image->colorspace == GRAYColorspace)
271 return((double) pixel[image->channel_map[GrayPixelChannel].offset]);
272 if (image->colorspace != sRGBColorspace)
273 return(0.298839*pixel[image->channel_map[RedPixelChannel].offset]+
274 0.586811*pixel[image->channel_map[GreenPixelChannel].offset]+
275 0.114350*pixel[image->channel_map[BluePixelChannel].offset]);
276 red=InversesRGBCompandor((double)
277 pixel[image->channel_map[RedPixelChannel].offset]);
278 green=InversesRGBCompandor((double)
279 pixel[image->channel_map[GreenPixelChannel].offset]);
280 blue=InversesRGBCompandor((double)
281 pixel[image->channel_map[BluePixelChannel].offset]);
282 return(0.21267*red+0.71516*green+0.07217*blue);
285 static inline Quantum GetPixelMagenta(const Image *restrict image,
286 const Quantum *restrict pixel)
288 return(pixel[image->channel_map[MagentaPixelChannel].offset]);
291 static inline PixelTrait GetPixelMagentaTraits(const Image *restrict image)
293 return(image->channel_map[MagentaPixelChannel].traits);
296 static inline Quantum GetPixelMask(const Image *restrict image,
297 const Quantum *restrict pixel)
299 if (image->channel_map[MaskPixelChannel].traits == UndefinedPixelTrait)
301 return(pixel[image->channel_map[MaskPixelChannel].offset]);
304 static inline PixelTrait GetPixelMaskTraits(const Image *restrict image)
306 return(image->channel_map[MaskPixelChannel].traits);
309 static inline size_t GetPixelMetaChannels(const Image *restrict image)
311 return(image->number_meta_channels);
314 static inline size_t GetPixelMetacontentExtent(const Image *restrict image)
316 return(image->metacontent_extent);
319 static inline Quantum GetPixelOpacity(const Image *restrict image,
320 const Quantum *restrict pixel)
322 if (image->channel_map[AlphaPixelChannel].traits == UndefinedPixelTrait)
323 return(QuantumRange-OpaqueAlpha);
324 return(QuantumRange-pixel[image->channel_map[AlphaPixelChannel].offset]);
327 static inline Quantum GetPixelRed(const Image *restrict image,
328 const Quantum *restrict pixel)
330 return(pixel[image->channel_map[RedPixelChannel].offset]);
333 static inline PixelTrait GetPixelRedTraits(const Image *restrict image)
335 return(image->channel_map[RedPixelChannel].traits);
338 static inline void GetPixelInfoPixel(const Image *restrict image,
339 const Quantum *restrict pixel,PixelInfo *restrict pixel_info)
341 pixel_info->red=(double)
342 pixel[image->channel_map[RedPixelChannel].offset];
343 pixel_info->green=(double)
344 pixel[image->channel_map[GreenPixelChannel].offset];
345 pixel_info->blue=(double)
346 pixel[image->channel_map[BluePixelChannel].offset];
347 pixel_info->black=0.0;
348 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
349 pixel_info->black=(double)
350 pixel[image->channel_map[BlackPixelChannel].offset];
351 pixel_info->alpha=OpaqueAlpha;
352 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
353 pixel_info->alpha=(double)
354 pixel[image->channel_map[AlphaPixelChannel].offset];
355 pixel_info->index=0.0;
356 if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait)
357 pixel_info->index=(double)
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 double AbsolutePixelValue(const double x)
391 return(x < 0.0 ? -x : x);
394 static inline MagickBooleanType IsPixelEquivalent(const Image *restrict image,
395 const Quantum *restrict p,const PixelInfo *restrict q)
402 red=(double) p[image->channel_map[RedPixelChannel].offset];
403 green=(double) p[image->channel_map[GreenPixelChannel].offset];
404 blue=(double) p[image->channel_map[BluePixelChannel].offset];
405 if ((AbsolutePixelValue(red-q->red) < MagickEpsilon) &&
406 (AbsolutePixelValue(green-q->green) < MagickEpsilon) &&
407 (AbsolutePixelValue(blue-q->blue) < MagickEpsilon))
412 static inline MagickBooleanType IsPixelGray(const Image *restrict image,
413 const Quantum *restrict pixel)
420 red=(double) pixel[image->channel_map[RedPixelChannel].offset];
421 green=(double) pixel[image->channel_map[GreenPixelChannel].offset];
422 blue=(double) pixel[image->channel_map[BluePixelChannel].offset];
423 if ((AbsolutePixelValue(red-green) < MagickEpsilon) &&
424 (AbsolutePixelValue(green-blue) < MagickEpsilon))
429 static inline MagickBooleanType IsPixelInfoEquivalent(
430 const PixelInfo *restrict p,const PixelInfo *restrict q)
432 if ((p->alpha_trait == BlendPixelTrait) &&
433 (q->alpha_trait != BlendPixelTrait) &&
434 (AbsolutePixelValue(p->alpha-OpaqueAlpha) >= MagickEpsilon))
436 if ((q->alpha_trait == BlendPixelTrait) &&
437 (p->alpha_trait != BlendPixelTrait) &&
438 (AbsolutePixelValue(q->alpha-OpaqueAlpha)) >= MagickEpsilon)
440 if ((p->alpha_trait == BlendPixelTrait) &&
441 (q->alpha_trait == BlendPixelTrait))
443 if (AbsolutePixelValue(p->alpha-q->alpha) >= MagickEpsilon)
445 if (AbsolutePixelValue(p->alpha-TransparentAlpha) < MagickEpsilon)
448 if (AbsolutePixelValue(p->red-q->red) >= MagickEpsilon)
450 if (AbsolutePixelValue(p->green-q->green) >= MagickEpsilon)
452 if (AbsolutePixelValue(p->blue-q->blue) >= MagickEpsilon)
454 if ((p->colorspace == CMYKColorspace) &&
455 (AbsolutePixelValue(p->black-q->black) >= MagickEpsilon))
460 static inline MagickBooleanType IsPixelMonochrome(const Image *restrict image,
461 const Quantum *restrict pixel)
468 red=(double) pixel[image->channel_map[RedPixelChannel].offset];
469 if ((AbsolutePixelValue(red) >= MagickEpsilon) ||
470 (AbsolutePixelValue(red-QuantumRange) >= MagickEpsilon))
472 green=(double) pixel[image->channel_map[GreenPixelChannel].offset];
473 blue=(double) pixel[image->channel_map[BluePixelChannel].offset];
474 if ((AbsolutePixelValue(red-green) < MagickEpsilon) &&
475 (AbsolutePixelValue(green-blue) < MagickEpsilon))
480 static inline MagickBooleanType IsPixelInfoGray(
481 const PixelInfo *restrict pixel_info)
483 if ((pixel_info->colorspace != GRAYColorspace) &&
484 (pixel_info->colorspace != RGBColorspace))
486 if ((AbsolutePixelValue(pixel_info->red-pixel_info->green) < MagickEpsilon) &&
487 (AbsolutePixelValue(pixel_info->green-pixel_info->blue) < MagickEpsilon))
492 static inline MagickBooleanType IsPixelInfoMonochrome(
493 const PixelInfo *restrict pixel_info)
495 if ((pixel_info->colorspace != GRAYColorspace) &&
496 (pixel_info->colorspace != RGBColorspace))
498 if ((AbsolutePixelValue(pixel_info->red) >= MagickEpsilon) ||
499 (AbsolutePixelValue(pixel_info->red-QuantumRange) >= MagickEpsilon))
501 if ((AbsolutePixelValue(pixel_info->red-pixel_info->green) < MagickEpsilon) &&
502 (AbsolutePixelValue(pixel_info->green-pixel_info->blue) < MagickEpsilon))
507 static inline void SetPixela(const Image *restrict image,
508 const Quantum a,Quantum *restrict pixel)
510 if (image->channel_map[aPixelChannel].traits != UndefinedPixelTrait)
511 pixel[image->channel_map[aPixelChannel].offset]=a;
514 static inline void SetPixelAlpha(const Image *restrict image,
515 const Quantum alpha,Quantum *restrict pixel)
517 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
518 pixel[image->channel_map[AlphaPixelChannel].offset]=alpha;
521 static inline void SetPixelAlphaTraits(Image *image,const PixelTrait traits)
523 image->channel_map[AlphaPixelChannel].traits=traits;
526 static inline void SetPixelb(const Image *restrict image,
527 const Quantum b,Quantum *restrict pixel)
529 if (image->channel_map[bPixelChannel].traits != UndefinedPixelTrait)
530 pixel[image->channel_map[bPixelChannel].offset]=b;
533 static inline void SetPixelBlack(const Image *restrict image,
534 const Quantum black,Quantum *restrict pixel)
536 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
537 pixel[image->channel_map[BlackPixelChannel].offset]=black;
540 static inline void SetPixelBlackTraits(Image *image,const PixelTrait traits)
542 image->channel_map[BlackPixelChannel].traits=traits;
545 static inline void SetPixelBlue(const Image *restrict image,const Quantum blue,
546 Quantum *restrict pixel)
548 pixel[image->channel_map[BluePixelChannel].offset]=blue;
551 static inline void SetPixelBlueTraits(Image *image,const PixelTrait traits)
553 image->channel_map[BluePixelChannel].traits=traits;
556 static inline void SetPixelCb(const Image *restrict image,const Quantum cb,
557 Quantum *restrict pixel)
559 pixel[image->channel_map[CbPixelChannel].offset]=cb;
562 static inline void SetPixelCbTraits(Image *image,const PixelTrait traits)
564 image->channel_map[CbPixelChannel].traits=traits;
567 static inline void SetPixelChannel(const Image *restrict image,
568 const PixelChannel channel,const Quantum quantum,Quantum *restrict pixel)
570 if (image->channel_map[channel].traits != UndefinedPixelTrait)
571 pixel[image->channel_map[channel].offset]=quantum;
574 static inline void SetPixelChannelAttributes(const Image *restrict image,
575 const PixelChannel channel,const PixelTrait traits,const ssize_t offset)
577 image->channel_map[offset].channel=channel;
578 image->channel_map[channel].offset=offset;
579 image->channel_map[channel].traits=traits;
582 static inline void SetPixelChannelChannel(const Image *restrict image,
583 const PixelChannel channel,const ssize_t offset)
585 image->channel_map[offset].channel=channel;
586 image->channel_map[channel].offset=offset;
589 static inline void SetPixelChannels(Image *image,const size_t number_channels)
591 image->number_channels=number_channels;
594 static inline void SetPixelChannelTraits(Image *image,
595 const PixelChannel channel,const PixelTrait traits)
597 image->channel_map[channel].traits=traits;
600 static inline void SetPixelCr(const Image *restrict image,const Quantum cr,
601 Quantum *restrict pixel)
603 pixel[image->channel_map[CrPixelChannel].offset]=cr;
606 static inline void SetPixelCrTraits(Image *image,const PixelTrait traits)
608 image->channel_map[CrPixelChannel].traits=traits;
611 static inline void SetPixelCyan(const Image *restrict image,const Quantum cyan,
612 Quantum *restrict pixel)
614 pixel[image->channel_map[CyanPixelChannel].offset]=cyan;
617 static inline void SetPixelGray(const Image *restrict image,const Quantum gray,
618 Quantum *restrict pixel)
620 pixel[image->channel_map[GrayPixelChannel].offset]=gray;
623 static inline void SetPixelGrayTraits(Image *image,const PixelTrait traits)
625 image->channel_map[GrayPixelChannel].traits=traits;
628 static inline void SetPixelGreen(const Image *restrict image,
629 const Quantum green,Quantum *restrict pixel)
631 pixel[image->channel_map[GreenPixelChannel].offset]=green;
634 static inline void SetPixelGreenTraits(Image *image,const PixelTrait traits)
636 image->channel_map[GreenPixelChannel].traits=traits;
639 static inline void SetPixelIndex(const Image *restrict image,
640 const Quantum index,Quantum *restrict pixel)
642 if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait)
643 pixel[image->channel_map[IndexPixelChannel].offset]=index;
646 static inline void SetPixelIndexTraits(Image *image,const PixelTrait traits)
648 image->channel_map[IndexPixelChannel].traits=traits;
651 static inline void SetPixelInfoPixel(const Image *restrict image,
652 const PixelInfo *restrict pixel_info,Quantum *restrict pixel)
654 pixel[image->channel_map[RedPixelChannel].offset]=
655 ClampToQuantum(pixel_info->red);
656 pixel[image->channel_map[GreenPixelChannel].offset]=
657 ClampToQuantum(pixel_info->green);
658 pixel[image->channel_map[BluePixelChannel].offset]=
659 ClampToQuantum(pixel_info->blue);
660 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait)
661 pixel[image->channel_map[BlackPixelChannel].offset]=
662 ClampToQuantum(pixel_info->black);
663 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
664 pixel[image->channel_map[AlphaPixelChannel].offset]=
665 pixel_info->alpha_trait != BlendPixelTrait ? OpaqueAlpha :
666 ClampToQuantum(pixel_info->alpha);
669 static inline void SetPixelL(const Image *restrict image,const Quantum L,
670 Quantum *restrict pixel)
672 if (image->channel_map[LPixelChannel].traits != UndefinedPixelTrait)
673 pixel[image->channel_map[LPixelChannel].offset]=L;
676 static inline void SetPixelMagenta(const Image *restrict image,
677 const Quantum magenta,Quantum *restrict pixel)
679 pixel[image->channel_map[MagentaPixelChannel].offset]=magenta;
682 static inline void SetPixelMagentaTraits(Image *image,const PixelTrait traits)
684 image->channel_map[MagentaPixelChannel].traits=traits;
687 static inline void SetPixelMask(const Image *restrict image,
688 const Quantum mask,Quantum *restrict pixel)
690 if (image->channel_map[MaskPixelChannel].traits != UndefinedPixelTrait)
691 pixel[image->channel_map[MaskPixelChannel].offset]=mask;
694 static inline void SetPixelMetacontentExtent(Image *image,const size_t extent)
696 image->metacontent_extent=extent;
699 static inline void SetPixelOpacity(const Image *restrict image,
700 const Quantum alpha,Quantum *restrict pixel)
702 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait)
703 pixel[image->channel_map[AlphaPixelChannel].offset]=QuantumRange-alpha;
706 static inline void SetPixelRed(const Image *restrict image,const Quantum red,
707 Quantum *restrict pixel)
709 pixel[image->channel_map[RedPixelChannel].offset]=red;
712 static inline void SetPixelRedTraits(Image *image,const PixelTrait traits)
714 image->channel_map[RedPixelChannel].traits=traits;
717 static inline void SetPixelYellow(const Image *restrict image,
718 const Quantum yellow,Quantum *restrict pixel)
720 pixel[image->channel_map[YellowPixelChannel].offset]=yellow;
723 static inline void SetPixelYellowTraits(Image *image,const PixelTrait traits)
725 image->channel_map[YellowPixelChannel].traits=traits;
728 static inline void SetPixelY(const Image *restrict image,const Quantum y,
729 Quantum *restrict pixel)
731 pixel[image->channel_map[YPixelChannel].offset]=y;
734 static inline void SetPixelYTraits(Image *image,const PixelTrait traits)
736 image->channel_map[YPixelChannel].traits=traits;
739 #if defined(__cplusplus) || defined(c_plusplus)