|
MagickCore
6.7.7
|
00001 /* 00002 Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization 00003 dedicated to making software imaging solutions freely available. 00004 00005 You may not use this file except in compliance with the License. 00006 obtain a copy of the License at 00007 00008 http://www.imagemagick.org/script/license.php 00009 00010 Unless required by applicable law or agreed to in writing, software 00011 distributed under the License is distributed on an "AS IS" BASIS, 00012 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 See the License for the specific language governing permissions and 00014 limitations under the License. 00015 00016 MagickCore pixel accessor methods. 00017 */ 00018 #ifndef _MAGICKCORE_PIXEL_ACCESSOR_H 00019 #define _MAGICKCORE_PIXEL_ACCESSOR_H 00020 00021 #if defined(__cplusplus) || defined(c_plusplus) 00022 extern "C" { 00023 #endif 00024 00025 #include <math.h> 00026 #include <MagickCore/cache.h> 00027 #include <MagickCore/cache-view.h> 00028 #include <MagickCore/color.h> 00029 #include <MagickCore/image.h> 00030 00031 #undef index 00032 00033 static inline Quantum GetPixelAlpha(const Image *restrict image, 00034 const Quantum *restrict pixel) 00035 { 00036 if (image->channel_map[AlphaPixelChannel].traits == UndefinedPixelTrait) 00037 return(OpaqueAlpha); 00038 return(pixel[image->channel_map[AlphaPixelChannel].offset]); 00039 } 00040 00041 static inline PixelTrait GetPixelAlphaTraits(const Image *restrict image) 00042 { 00043 return(image->channel_map[AlphaPixelChannel].traits); 00044 } 00045 00046 static inline Quantum GetPixelBlack(const Image *restrict image, 00047 const Quantum *restrict pixel) 00048 { 00049 if (image->channel_map[BlackPixelChannel].traits == UndefinedPixelTrait) 00050 return(0); 00051 return(pixel[image->channel_map[BlackPixelChannel].offset]); 00052 } 00053 00054 static inline PixelTrait GetPixelBlackTraits(const Image *restrict image) 00055 { 00056 return(image->channel_map[BlackPixelChannel].traits); 00057 } 00058 00059 static inline Quantum GetPixelBlue(const Image *restrict image, 00060 const Quantum *restrict pixel) 00061 { 00062 return(pixel[image->channel_map[BluePixelChannel].offset]); 00063 } 00064 00065 static inline PixelTrait GetPixelBlueTraits(const Image *restrict image) 00066 { 00067 return(image->channel_map[BluePixelChannel].traits); 00068 } 00069 00070 static inline Quantum GetPixelCb(const Image *restrict image, 00071 const Quantum *restrict pixel) 00072 { 00073 return(pixel[image->channel_map[CbPixelChannel].offset]); 00074 } 00075 00076 static inline PixelTrait GetPixelCbTraits(const Image *restrict image) 00077 { 00078 return(image->channel_map[CbPixelChannel].traits); 00079 } 00080 00081 static inline Quantum GetPixelChannel(const Image *restrict image, 00082 const PixelChannel channel,const Quantum *restrict pixel) 00083 { 00084 if (image->channel_map[channel].traits == UndefinedPixelTrait) 00085 return(0); 00086 return(pixel[image->channel_map[channel].offset]); 00087 } 00088 00089 static inline PixelChannel GetPixelChannelMapChannel( 00090 const Image *restrict image,const ssize_t offset) 00091 { 00092 return(image->channel_map[offset].channel); 00093 } 00094 00095 static inline ssize_t GetPixelChannelMapOffset(const Image *restrict image, 00096 const PixelChannel channel) 00097 { 00098 return(image->channel_map[channel].offset); 00099 } 00100 00101 static inline PixelTrait GetPixelChannelMapTraits(const Image *restrict image, 00102 const PixelChannel channel) 00103 { 00104 return(image->channel_map[channel].traits); 00105 } 00106 00107 static inline size_t GetPixelChannels(const Image *restrict image) 00108 { 00109 return(image->number_channels); 00110 } 00111 00112 static inline Quantum GetPixelCr(const Image *restrict image, 00113 const Quantum *restrict pixel) 00114 { 00115 return(pixel[image->channel_map[CrPixelChannel].offset]); 00116 } 00117 00118 static inline PixelTrait GetPixelCrTraits(const Image *restrict image) 00119 { 00120 return(image->channel_map[CrPixelChannel].traits); 00121 } 00122 00123 static inline Quantum GetPixelCyan(const Image *restrict image, 00124 const Quantum *restrict pixel) 00125 { 00126 return(pixel[image->channel_map[CyanPixelChannel].offset]); 00127 } 00128 00129 static inline PixelTrait GetPixelCyanTraits(const Image *restrict image) 00130 { 00131 return(image->channel_map[CyanPixelChannel].traits); 00132 } 00133 00134 static inline Quantum GetPixelGray(const Image *restrict image, 00135 const Quantum *restrict pixel) 00136 { 00137 return(pixel[image->channel_map[GrayPixelChannel].offset]); 00138 } 00139 00140 static inline PixelTrait GetPixelGrayTraits(const Image *restrict image) 00141 { 00142 return(image->channel_map[GrayPixelChannel].traits); 00143 } 00144 00145 static inline Quantum GetPixelGreen(const Image *restrict image, 00146 const Quantum *restrict pixel) 00147 { 00148 return(pixel[image->channel_map[GreenPixelChannel].offset]); 00149 } 00150 00151 static inline PixelTrait GetPixelGreenTraits(const Image *restrict image) 00152 { 00153 return(image->channel_map[GreenPixelChannel].traits); 00154 } 00155 00156 static inline Quantum GetPixelIndex(const Image *restrict image, 00157 const Quantum *restrict pixel) 00158 { 00159 if (image->channel_map[IndexPixelChannel].traits == UndefinedPixelTrait) 00160 return(0); 00161 return(pixel[image->channel_map[IndexPixelChannel].offset]); 00162 } 00163 00164 static inline PixelTrait GetPixelIndexTraits(const Image *restrict image) 00165 { 00166 return(image->channel_map[IndexPixelChannel].traits); 00167 } 00168 00169 static inline Quantum GetPixelInfoIntensity( 00170 const PixelInfo *restrict pixel_info) 00171 { 00172 #if !defined(MAGICKCORE_HDRI_SUPPORT) 00173 return((Quantum) (0.299*pixel_info->red+0.587*pixel_info->green+0.114* 00174 pixel_info->blue+0.5)); 00175 #else 00176 return((Quantum) (0.299*pixel_info->red+0.587*pixel_info->green+0.114* 00177 pixel_info->blue)); 00178 #endif 00179 } 00180 00181 static inline Quantum GetPixelInfoLuminance( 00182 const PixelInfo *restrict pixel_info) 00183 { 00184 Quantum 00185 luminance; 00186 00187 #if !defined(MAGICKCORE_HDRI_SUPPORT) 00188 luminance=(Quantum) (0.21267*pixel_info->red+0.71516*pixel_info->green+ 00189 0.07217*pixel_info->blue+0.5); 00190 #else 00191 luminance=(Quantum) (0.21267*pixel_info->red+0.71516*pixel_info->green+ 00192 0.07217*pixel_info->blue); 00193 #endif 00194 return((Quantum) luminance); 00195 } 00196 00197 static inline Quantum GetPixelIntensity(const Image *restrict image, 00198 const Quantum *restrict pixel) 00199 { 00200 #if !defined(MAGICKCORE_HDRI_SUPPORT) 00201 if (image->colorspace == GRAYColorspace) 00202 return(pixel[image->channel_map[GrayPixelChannel].offset]); 00203 return((Quantum) (0.299*pixel[image->channel_map[RedPixelChannel].offset]+ 00204 0.587*pixel[image->channel_map[GreenPixelChannel].offset]+0.114* 00205 pixel[image->channel_map[BluePixelChannel].offset]+0.5)); 00206 #else 00207 { 00208 double 00209 alpha, 00210 beta; 00211 00212 alpha=pixel[image->channel_map[RedPixelChannel].offset]-(double) 00213 pixel[image->channel_map[GreenPixelChannel].offset]; 00214 beta=pixel[image->channel_map[GreenPixelChannel].offset]-(double) 00215 pixel[image->channel_map[BluePixelChannel].offset]; 00216 if ((fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon)) 00217 return(pixel[image->channel_map[RedPixelChannel].offset]); 00218 return((Quantum) (0.299*pixel[image->channel_map[RedPixelChannel].offset]+ 00219 0.587*pixel[image->channel_map[GreenPixelChannel].offset]+0.114* 00220 pixel[image->channel_map[BluePixelChannel].offset])); 00221 } 00222 #endif 00223 } 00224 00225 static inline Quantum GetPixelLuminance(const Image *restrict image, 00226 const Quantum *restrict pixel) 00227 { 00228 #if !defined(MAGICKCORE_HDRI_SUPPORT) 00229 return((Quantum) (0.21267*pixel[image->channel_map[RedPixelChannel].offset]+ 00230 0.71516*pixel[image->channel_map[GreenPixelChannel].offset]+0.07217* 00231 pixel[image->channel_map[BluePixelChannel].offset]+0.5)); 00232 #else 00233 return((Quantum) (0.21267*pixel[image->channel_map[RedPixelChannel].offset]+ 00234 0.71516*pixel[image->channel_map[GreenPixelChannel].offset]+0.07217* 00235 pixel[image->channel_map[BluePixelChannel].offset])); 00236 #endif 00237 } 00238 00239 static inline Quantum GetPixelMagenta(const Image *restrict image, 00240 const Quantum *restrict pixel) 00241 { 00242 return(pixel[image->channel_map[MagentaPixelChannel].offset]); 00243 } 00244 00245 static inline PixelTrait GetPixelMagentaTraits(const Image *restrict image) 00246 { 00247 return(image->channel_map[MagentaPixelChannel].traits); 00248 } 00249 00250 static inline Quantum GetPixelMask(const Image *restrict image, 00251 const Quantum *restrict pixel) 00252 { 00253 if (image->channel_map[MaskPixelChannel].traits == UndefinedPixelTrait) 00254 return(0); 00255 return(pixel[image->channel_map[MaskPixelChannel].offset]); 00256 } 00257 00258 static inline PixelTrait GetPixelMaskTraits(const Image *restrict image) 00259 { 00260 return(image->channel_map[MaskPixelChannel].traits); 00261 } 00262 00263 static inline size_t GetPixelMetaChannels(const Image *restrict image) 00264 { 00265 return(image->number_meta_channels); 00266 } 00267 00268 static inline size_t GetPixelMetacontentExtent(const Image *restrict image) 00269 { 00270 return(image->metacontent_extent); 00271 } 00272 00273 static inline Quantum GetPixelOpacity(const Image *restrict image, 00274 const Quantum *restrict pixel) 00275 { 00276 if (image->channel_map[AlphaPixelChannel].traits == UndefinedPixelTrait) 00277 return(QuantumRange-OpaqueAlpha); 00278 return(QuantumRange-pixel[image->channel_map[AlphaPixelChannel].offset]); 00279 } 00280 00281 static inline Quantum GetPixelRed(const Image *restrict image, 00282 const Quantum *restrict pixel) 00283 { 00284 return(pixel[image->channel_map[RedPixelChannel].offset]); 00285 } 00286 00287 static inline PixelTrait GetPixelRedTraits(const Image *restrict image) 00288 { 00289 return(image->channel_map[RedPixelChannel].traits); 00290 } 00291 00292 static inline void GetPixelInfoPixel(const Image *restrict image, 00293 const Quantum *restrict pixel,PixelInfo *restrict pixel_info) 00294 { 00295 pixel_info->red=(double) 00296 pixel[image->channel_map[RedPixelChannel].offset]; 00297 pixel_info->green=(double) 00298 pixel[image->channel_map[GreenPixelChannel].offset]; 00299 pixel_info->blue=(double) 00300 pixel[image->channel_map[BluePixelChannel].offset]; 00301 pixel_info->black=0; 00302 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait) 00303 pixel_info->black=(double) 00304 pixel[image->channel_map[BlackPixelChannel].offset]; 00305 pixel_info->alpha=OpaqueAlpha; 00306 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait) 00307 pixel_info->alpha=(double) 00308 pixel[image->channel_map[AlphaPixelChannel].offset]; 00309 pixel_info->index=0; 00310 if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait) 00311 pixel_info->index=(double) 00312 pixel[image->channel_map[IndexPixelChannel].offset]; 00313 } 00314 00315 static inline PixelTrait GetPixelTraits(const Image *restrict image, 00316 const PixelChannel channel) 00317 { 00318 return(image->channel_map[channel].traits); 00319 } 00320 00321 static inline Quantum GetPixelY(const Image *restrict image, 00322 const Quantum *restrict pixel) 00323 { 00324 return(pixel[image->channel_map[YPixelChannel].offset]); 00325 } 00326 00327 static inline PixelTrait GetPixelYTraits(const Image *restrict image) 00328 { 00329 return(image->channel_map[YPixelChannel].traits); 00330 } 00331 00332 static inline Quantum GetPixelYellow(const Image *restrict image, 00333 const Quantum *restrict pixel) 00334 { 00335 return(pixel[image->channel_map[YellowPixelChannel].offset]); 00336 } 00337 00338 static inline PixelTrait GetPixelYellowTraits(const Image *restrict image) 00339 { 00340 return(image->channel_map[YellowPixelChannel].traits); 00341 } 00342 00343 static inline MagickBooleanType IsPixelEquivalent(const Image *restrict image, 00344 const Quantum *restrict p,const PixelInfo *restrict q) 00345 { 00346 if (((double) p[image->channel_map[RedPixelChannel].offset] == q->red) && 00347 ((double) p[image->channel_map[GreenPixelChannel].offset] == q->green) && 00348 ((double) p[image->channel_map[BluePixelChannel].offset] == q->blue)) 00349 return(MagickTrue); 00350 return(MagickFalse); 00351 } 00352 00353 static inline MagickBooleanType IsPixelGray(const Image *restrict image, 00354 const Quantum *restrict pixel) 00355 { 00356 #if !defined(MAGICKCORE_HDRI_SUPPORT) 00357 if ((pixel[image->channel_map[RedPixelChannel].offset] == 00358 pixel[image->channel_map[GreenPixelChannel].offset]) && 00359 (pixel[image->channel_map[GreenPixelChannel].offset] == 00360 pixel[image->channel_map[BluePixelChannel].offset])) 00361 return(MagickTrue); 00362 #else 00363 { 00364 double 00365 alpha, 00366 beta; 00367 00368 alpha=pixel[image->channel_map[RedPixelChannel].offset]-(double) 00369 pixel[image->channel_map[GreenPixelChannel].offset]; 00370 beta=pixel[image->channel_map[GreenPixelChannel].offset]-(double) 00371 pixel[image->channel_map[BluePixelChannel].offset]; 00372 if ((fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon)) 00373 return(MagickTrue); 00374 } 00375 #endif 00376 return(MagickFalse); 00377 } 00378 00379 static inline MagickBooleanType IsPixelInfoEquivalent( 00380 const PixelInfo *restrict p,const PixelInfo *restrict q) 00381 { 00382 if ((p->matte != MagickFalse) && (q->matte == MagickFalse) && 00383 (fabs(p->alpha-OpaqueAlpha) > 0.5)) 00384 return(MagickFalse); 00385 if ((q->matte != MagickFalse) && (p->matte == MagickFalse) && 00386 (fabs(q->alpha-OpaqueAlpha)) > 0.5) 00387 return(MagickFalse); 00388 if ((p->matte != MagickFalse) && (q->matte != MagickFalse)) 00389 { 00390 if (fabs(p->alpha-q->alpha) > 0.5) 00391 return(MagickFalse); 00392 if (fabs(p->alpha-TransparentAlpha) <= 0.5) 00393 return(MagickTrue); 00394 } 00395 if (fabs(p->red-q->red) > 0.5) 00396 return(MagickFalse); 00397 if (fabs(p->green-q->green) > 0.5) 00398 return(MagickFalse); 00399 if (fabs(p->blue-q->blue) > 0.5) 00400 return(MagickFalse); 00401 if ((p->colorspace == CMYKColorspace) && (fabs(p->black-q->black) > 0.5)) 00402 return(MagickFalse); 00403 return(MagickTrue); 00404 } 00405 00406 static inline MagickBooleanType IsPixelMonochrome(const Image *restrict image, 00407 const Quantum *restrict pixel) 00408 { 00409 #if !defined(MAGICKCORE_HDRI_SUPPORT) 00410 if (((pixel[image->channel_map[RedPixelChannel].offset] == 0) || 00411 (pixel[image->channel_map[RedPixelChannel].offset] == (Quantum) QuantumRange)) && 00412 (pixel[image->channel_map[RedPixelChannel].offset] == 00413 pixel[image->channel_map[GreenPixelChannel].offset]) && 00414 (pixel[image->channel_map[GreenPixelChannel].offset] == 00415 pixel[image->channel_map[BluePixelChannel].offset])) 00416 return(MagickTrue); 00417 #else 00418 { 00419 double 00420 alpha, 00421 beta; 00422 00423 alpha=pixel[image->channel_map[RedPixelChannel].offset]-(double) 00424 pixel[image->channel_map[GreenPixelChannel].offset]; 00425 beta=pixel[image->channel_map[GreenPixelChannel].offset]-(double) 00426 pixel[image->channel_map[BluePixelChannel].offset]; 00427 if (((fabs(pixel[image->channel_map[RedPixelChannel].offset]) <= MagickEpsilon) || 00428 (fabs(pixel[image->channel_map[RedPixelChannel].offset]-QuantumRange) <= MagickEpsilon)) && 00429 (fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon)) 00430 return(MagickTrue); 00431 } 00432 #endif 00433 return(MagickFalse); 00434 } 00435 00436 static inline MagickBooleanType IsPixelInfoGray( 00437 const PixelInfo *restrict pixel_info) 00438 { 00439 #if !defined(MAGICKCORE_HDRI_SUPPORT) 00440 if ((pixel_info->red == pixel_info->green) && 00441 (pixel_info->green == pixel_info->blue)) 00442 return(MagickTrue); 00443 #else 00444 { 00445 double 00446 alpha, 00447 beta; 00448 00449 alpha=pixel_info->red-(double) pixel_info->green; 00450 beta=pixel_info->green-(double) pixel_info->blue; 00451 if ((fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon)) 00452 return(MagickTrue); 00453 } 00454 #endif 00455 return(MagickFalse); 00456 } 00457 00458 static inline MagickBooleanType IsPixelInfoMonochrome( 00459 const PixelInfo *restrict pixel_info) 00460 { 00461 #if !defined(MAGICKCORE_HDRI_SUPPORT) 00462 if (((pixel_info->red == 0) || (pixel_info->red == (Quantum) QuantumRange)) && 00463 (pixel_info->red == pixel_info->green) && 00464 (pixel_info->green == pixel_info->blue)) 00465 return(MagickTrue); 00466 #else 00467 { 00468 double 00469 alpha, 00470 beta; 00471 00472 alpha=pixel_info->red-(double) pixel_info->green; 00473 beta=pixel_info->green-(double) pixel_info->blue; 00474 if (((fabs(pixel_info->red) <= MagickEpsilon) || 00475 (fabs(pixel_info->red-QuantumRange) <= MagickEpsilon)) && 00476 (fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon)) 00477 return(MagickTrue); 00478 } 00479 #endif 00480 return(MagickFalse); 00481 } 00482 00483 static inline void SetPixelAlpha(const Image *restrict image, 00484 const Quantum alpha,Quantum *restrict pixel) 00485 { 00486 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait) 00487 pixel[image->channel_map[AlphaPixelChannel].offset]=alpha; 00488 } 00489 00490 static inline void SetPixelAlphaTraits(Image *image,const PixelTrait traits) 00491 { 00492 image->channel_map[AlphaPixelChannel].traits=traits; 00493 } 00494 00495 static inline void SetPixelBlack(const Image *restrict image, 00496 const Quantum black,Quantum *restrict pixel) 00497 { 00498 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait) 00499 pixel[image->channel_map[BlackPixelChannel].offset]=black; 00500 } 00501 00502 static inline void SetPixelBlackTraits(Image *image,const PixelTrait traits) 00503 { 00504 image->channel_map[BlackPixelChannel].traits=traits; 00505 } 00506 00507 static inline void SetPixelBlue(const Image *restrict image,const Quantum blue, 00508 Quantum *restrict pixel) 00509 { 00510 pixel[image->channel_map[BluePixelChannel].offset]=blue; 00511 } 00512 00513 static inline void SetPixelBlueTraits(Image *image,const PixelTrait traits) 00514 { 00515 image->channel_map[BluePixelChannel].traits=traits; 00516 } 00517 00518 static inline void SetPixelCb(const Image *restrict image,const Quantum cb, 00519 Quantum *restrict pixel) 00520 { 00521 pixel[image->channel_map[CbPixelChannel].offset]=cb; 00522 } 00523 00524 static inline void SetPixelCbTraits(Image *image,const PixelTrait traits) 00525 { 00526 image->channel_map[CbPixelChannel].traits=traits; 00527 } 00528 00529 static inline void SetPixelChannel(const Image *restrict image, 00530 const PixelChannel channel,const Quantum quantum,Quantum *restrict pixel) 00531 { 00532 if (image->channel_map[channel].traits != UndefinedPixelTrait) 00533 pixel[image->channel_map[channel].offset]=quantum; 00534 } 00535 00536 static inline void SetPixelChannelMapChannel(const Image *restrict image, 00537 const PixelChannel channel,const ssize_t offset) 00538 { 00539 image->channel_map[offset].channel=channel; 00540 image->channel_map[channel].offset=offset; 00541 } 00542 00543 static inline void SetPixelChannelMap(const Image *restrict image, 00544 const PixelChannel channel,const PixelTrait traits,const ssize_t offset) 00545 { 00546 image->channel_map[offset].channel=channel; 00547 image->channel_map[channel].offset=offset; 00548 image->channel_map[channel].traits=traits; 00549 } 00550 00551 static inline void SetPixelChannels(Image *image,const size_t number_channels) 00552 { 00553 image->number_channels=number_channels; 00554 } 00555 00556 static inline void SetPixelChannelTraits(Image *image, 00557 const PixelChannel channel,const PixelTrait traits) 00558 { 00559 image->channel_map[channel].traits=traits; 00560 } 00561 00562 static inline void SetPixelChannelMapTraits(Image *image, 00563 const PixelChannel channel,const PixelTrait traits) 00564 { 00565 image->channel_map[channel].traits=traits; 00566 } 00567 00568 static inline void SetPixelCr(const Image *restrict image,const Quantum cr, 00569 Quantum *restrict pixel) 00570 { 00571 pixel[image->channel_map[CrPixelChannel].offset]=cr; 00572 } 00573 00574 static inline void SetPixelCrTraits(Image *image,const PixelTrait traits) 00575 { 00576 image->channel_map[CrPixelChannel].traits=traits; 00577 } 00578 00579 static inline void SetPixelCyan(const Image *restrict image,const Quantum cyan, 00580 Quantum *restrict pixel) 00581 { 00582 pixel[image->channel_map[CyanPixelChannel].offset]=cyan; 00583 } 00584 00585 static inline void SetPixelGray(const Image *restrict image,const Quantum gray, 00586 Quantum *restrict pixel) 00587 { 00588 pixel[image->channel_map[GrayPixelChannel].offset]=gray; 00589 } 00590 00591 static inline void SetPixelGrayTraits(Image *image,const PixelTrait traits) 00592 { 00593 image->channel_map[GrayPixelChannel].traits=traits; 00594 } 00595 00596 static inline void SetPixelGreen(const Image *restrict image, 00597 const Quantum green,Quantum *restrict pixel) 00598 { 00599 pixel[image->channel_map[GreenPixelChannel].offset]=green; 00600 } 00601 00602 static inline void SetPixelGreenTraits(Image *image,const PixelTrait traits) 00603 { 00604 image->channel_map[GreenPixelChannel].traits=traits; 00605 } 00606 00607 static inline void SetPixelIndex(const Image *restrict image, 00608 const Quantum index,Quantum *restrict pixel) 00609 { 00610 if (image->channel_map[IndexPixelChannel].traits != UndefinedPixelTrait) 00611 pixel[image->channel_map[IndexPixelChannel].offset]=index; 00612 } 00613 00614 static inline void SetPixelIndexTraits(Image *image,const PixelTrait traits) 00615 { 00616 image->channel_map[IndexPixelChannel].traits=traits; 00617 } 00618 00619 static inline void SetPixelInfoPixel(const Image *restrict image, 00620 const PixelInfo *restrict pixel_info,Quantum *restrict pixel) 00621 { 00622 pixel[image->channel_map[RedPixelChannel].offset]= 00623 ClampToQuantum(pixel_info->red); 00624 pixel[image->channel_map[GreenPixelChannel].offset]= 00625 ClampToQuantum(pixel_info->green); 00626 pixel[image->channel_map[BluePixelChannel].offset]= 00627 ClampToQuantum(pixel_info->blue); 00628 if (image->channel_map[BlackPixelChannel].traits != UndefinedPixelTrait) 00629 pixel[image->channel_map[BlackPixelChannel].offset]= 00630 ClampToQuantum(pixel_info->black); 00631 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait) 00632 pixel[image->channel_map[AlphaPixelChannel].offset]=pixel_info->matte == 00633 MagickFalse ? OpaqueAlpha : ClampToQuantum(pixel_info->alpha); 00634 } 00635 00636 static inline void SetPixelMagenta(const Image *restrict image, 00637 const Quantum magenta,Quantum *restrict pixel) 00638 { 00639 pixel[image->channel_map[MagentaPixelChannel].offset]=magenta; 00640 } 00641 00642 static inline void SetPixelMagentaTraits(Image *image,const PixelTrait traits) 00643 { 00644 image->channel_map[MagentaPixelChannel].traits=traits; 00645 } 00646 00647 static inline void SetPixelMask(const Image *restrict image, 00648 const Quantum mask,Quantum *restrict pixel) 00649 { 00650 if (image->channel_map[MaskPixelChannel].traits != UndefinedPixelTrait) 00651 pixel[image->channel_map[MaskPixelChannel].offset]=mask; 00652 } 00653 00654 static inline void SetPixelMetacontentExtent(Image *image,const size_t extent) 00655 { 00656 image->metacontent_extent=extent; 00657 } 00658 00659 static inline void SetPixelOpacity(const Image *restrict image, 00660 const Quantum alpha,Quantum *restrict pixel) 00661 { 00662 if (image->channel_map[AlphaPixelChannel].traits != UndefinedPixelTrait) 00663 pixel[image->channel_map[AlphaPixelChannel].offset]=QuantumRange-alpha; 00664 } 00665 00666 static inline void SetPixelRed(const Image *restrict image,const Quantum red, 00667 Quantum *restrict pixel) 00668 { 00669 pixel[image->channel_map[RedPixelChannel].offset]=red; 00670 } 00671 00672 static inline void SetPixelRedTraits(Image *image,const PixelTrait traits) 00673 { 00674 image->channel_map[RedPixelChannel].traits=traits; 00675 } 00676 00677 static inline void SetPixelYellow(const Image *restrict image, 00678 const Quantum yellow,Quantum *restrict pixel) 00679 { 00680 pixel[image->channel_map[YellowPixelChannel].offset]=yellow; 00681 } 00682 00683 static inline void SetPixelYellowTraits(Image *image,const PixelTrait traits) 00684 { 00685 image->channel_map[YellowPixelChannel].traits=traits; 00686 } 00687 00688 static inline void SetPixelY(const Image *restrict image,const Quantum y, 00689 Quantum *restrict pixel) 00690 { 00691 pixel[image->channel_map[YPixelChannel].offset]=y; 00692 } 00693 00694 static inline void SetPixelYTraits(Image *image,const PixelTrait traits) 00695 { 00696 image->channel_map[YPixelChannel].traits=traits; 00697 } 00698 00699 #if defined(__cplusplus) || defined(c_plusplus) 00700 } 00701 #endif 00702 00703 #endif