eLynx SDK
v3.3.0 C++ image processing API reference |
00001 //============================================================================ 00002 // Pixels.h Image.Component package 00003 //============================================================================ 00004 // Usage : define common definition for pixel format 00005 //---------------------------------------------------------------------------- 00006 // Copyright (C) 2006 by eLynx project 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 // See the GNU Library General Public License for more details. 00017 //---------------------------------------------------------------------------- 00018 #ifndef __Pixels_h__ 00019 #define __Pixels_h__ 00020 00021 #include <elx/core/CoreTypes.h> 00022 #include <elx/image/ImageLib.h> 00023 #include <elx/image/PixelBase.h> 00024 00025 namespace eLynx { 00026 namespace Image { 00027 00029 enum EPixelMode 00030 { 00031 PM_Grey, 00032 PM_Color, 00033 PM_Complex, 00034 PM_Undefined 00035 }; 00036 00042 enum EColorSpace 00043 { 00044 CS_RGB, 00045 CS_HLS, 00046 CS_CIE_XYZ, 00047 CS_CIE_Luv, 00048 CS_CIE_Lab, 00049 CS_CIE_Lch, 00050 CS_Hunter_Lab, 00051 CS_Undefined 00052 }; 00053 00055 enum EPixelType 00056 { 00057 PT_L, 00058 PT_LA, 00059 PT_Complex, 00060 PT_RGB, 00061 PT_RGBA, 00062 PT_HLS, 00063 PT_XYZ, 00064 PT_Luv, 00065 PT_Lab, 00066 PT_Lch, 00067 PT_HLab, 00068 PT_Undefined 00069 }; 00070 00072 enum EPixelFormat 00073 { 00074 PF_Lub, 00075 PF_Lus, 00076 PF_Li, 00077 PF_Lf, 00078 PF_Ld, 00079 00080 PF_LAub, 00081 PF_LAus, 00082 PF_LAi, 00083 PF_LAf, 00084 PF_LAd, 00085 00086 PF_RGBub, 00087 PF_RGBus, 00088 PF_RGBi, 00089 PF_RGBf, 00090 PF_RGBd, 00091 00092 PF_RGBAub, 00093 PF_RGBAus, 00094 PF_RGBAi, 00095 PF_RGBAf, 00096 PF_RGBAd, 00097 00099 PF_CPLXi, 00100 PF_CPLXf, 00101 PF_CPLXd, 00102 00103 PF_HLSf, 00104 PF_HLSd, 00105 00106 PF_XYZf, 00107 PF_XYZd, 00108 00109 PF_Luvf, 00110 PF_Luvd, 00111 00112 PF_Labf, 00113 PF_Labd, 00114 00115 PF_Lchf, 00116 PF_Lchd, 00117 00118 PF_HLabf, 00119 PF_HLabd, 00120 00121 PF_Undefined 00122 }; 00123 00127 ExportedByImage EPixelFormat elxToEPixelFormat(const char * iprType); 00128 00131 enum EColorToGreyConversion 00132 { 00133 CGC_Green, 00134 CGC_Mean, 00135 CGC_Desaturate, 00136 CGC_CCIR_601, 00137 CGC_CCIR_709, 00138 CGC_ITU, 00139 CGC_Max, // do not use. 00140 00141 CGC_Default = CGC_CCIR_709 00142 }; 00143 00146 enum EGreyToColorConversion 00147 { 00148 GCC_Palettized, // 00149 GCC_FalseColor, // 00150 GCC_Max, // do not use 00151 00152 GCC_Default = GCC_Palettized 00153 }; 00154 00157 enum EGreyToComplexConversion 00158 { 00159 GCC_AsReal, 00160 GCC_AsImaginary, 00161 GCC_FFT 00162 }; 00163 00166 enum EComplexToGreyConversion 00167 { 00168 CGC_Real, 00169 CGC_Imaginary, 00170 CGC_Magnitude, 00171 CGC_LogMagnitude, 00172 CGC_Phase, 00173 CGC_IFFT 00174 }; 00175 00176 //============================================================================ 00178 //============================================================================ 00179 00183 // forward declarations 00184 template<typename T> struct PixelL; 00185 template<typename T> struct PixelLA; 00186 template<typename T> struct PixelComplex; 00187 template<typename T> struct PixelRGB; 00188 template<typename T> struct PixelHLS; 00189 template<typename T> struct PixelXYZ; 00190 template<typename T> struct PixelLuv; 00191 template<typename T> struct PixelLab; 00192 template<typename T> struct PixelLch; 00193 template<typename T> struct PixelHLab; 00194 template<typename T> struct PixelRGBA; 00196 00197 00198 template<typename T> 00199 struct ExportedByImage PixelL : public PixelBase< PixelL<T> > 00200 { 00201 typedef T type; 00202 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00203 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00204 00205 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00206 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00207 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00208 00209 typedef PixelL<S_type> SumOverflowPixel; 00210 typedef PixelL<M_type> MulOverflowPixel; 00211 typedef PixelL<F_type> FloatingPixel; 00212 00213 static const uint32 _nChannel = 1; 00214 static const bool _bColor = false; 00215 static const bool _bGrey = true; 00216 static const bool _bHasAlpha = false; 00217 static const bool _bRange[_nChannel]; 00218 static const T _min[_nChannel]; 00219 static const T _max[_nChannel]; 00220 00221 union { 00222 T _channel[_nChannel]; 00223 T _luminance; 00224 }; 00225 00226 PixelL() { _luminance = T();} 00227 PixelL(T iL) { _luminance = iL; } 00228 PixelL(const PixelL& iPixel) { _luminance = iPixel._luminance; } 00229 PixelL(const PixelLA<T>& iPixel, bool ibBlendAlpha=false); 00230 PixelL(const PixelRGB<T>& iPixel, EColorToGreyConversion iMethod=CGC_Default) { _luminance = iPixel.GetLuminance(iMethod); } 00231 PixelL(const PixelRGBA<T>& iPixel, EColorToGreyConversion iMethod=CGC_Default){ _luminance = iPixel.GetLuminance(iMethod); } 00232 PixelL(const PixelHLS<T>& iPixel) { _luminance = iPixel._luminance; } 00233 PixelL(const PixelLab<T>& iPixel) { _luminance = iPixel._luminance; } 00234 00235 PixelL& operator=(const PixelL& iPixel) { _luminance = iPixel._luminance; return *this;} 00236 00237 template <typename U> 00238 PixelL(const PixelL<U>& iPixel) { _luminance = T(iPixel._luminance); } 00239 00240 template <typename U> 00241 PixelL& operator=(const PixelL<U>& iPixel) { _luminance = T(iPixel._luminance); return *this;} 00242 00243 static const PixelL Null() { static const PixelL nullPixel( T(0) ); return nullPixel; } 00244 static const PixelL Black() { static const PixelL blackPixel(SampleTypeTraits<T>::_black); return blackPixel; } 00245 static const PixelL White() { static const PixelL whitePixel(SampleTypeTraits<T>::_white); return whitePixel; } 00246 00247 T GetChannel0() const { return _luminance; } 00248 T GetLuminance() const { return _luminance; } 00249 00250 static const uint32 GetChannelCount() { return _nChannel; } 00251 static const uint32 GetChannelMask() { return CM_Channel0; } 00252 static bool IsFullMask(uint32 iMask) { return (CM_Channel0 == (iMask & CM_Channel0)); } 00253 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel0)); } 00254 static const EPixelMode GetPixelMode() { return PM_Grey; } 00255 static const EPixelType GetPixelType() { return PT_L; } 00256 static const EColorSpace GetColorSpace() { return CS_Undefined; } 00257 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00258 static const bool HasAlpha() { return _bHasAlpha; } 00259 static const bool IsGrey() { return _bGrey; } 00260 static const bool IsColor() { return _bColor; } 00261 static EPixelFormat GetPixelFormat(); 00262 }; 00263 00264 00265 template<typename T> 00266 struct ExportedByImage PixelLA : public PixelBase< PixelLA<T> > 00267 { 00268 typedef T type; 00269 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00270 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00271 00272 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00273 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00274 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00275 00276 typedef PixelLA<S_type> SumOverflowPixel; 00277 typedef PixelLA<M_type> MulOverflowPixel; 00278 typedef PixelLA<F_type> FloatingPixel; 00279 00280 static const uint32 _nChannel = 2; 00281 static const bool _bColor = false; 00282 static const bool _bGrey = true; 00283 static const bool _bHasAlpha = true; 00284 static const bool _bRange[_nChannel]; 00285 static const T _min[_nChannel]; 00286 static const T _max[_nChannel]; 00287 00288 union { 00289 T _channel[_nChannel]; 00290 struct { 00291 T _luminance; 00292 T _alpha; 00293 }; 00294 }; 00295 00296 PixelLA() { _luminance = _alpha = T(); } 00297 PixelLA(T iL, T iA) { _luminance = iL; _alpha = iA; } 00298 PixelLA(const PixelLA& ip) { _luminance = ip._luminance; _alpha = ip._alpha; } 00299 PixelLA& operator=(const PixelLA& ip) { _luminance = ip._luminance; _alpha = ip._alpha; return *this; } 00300 00301 PixelLA(const PixelL<T>& ip) { _luminance = ip._luminance; _alpha = ResolutionTypeTraits<T>::_norm; } 00302 PixelLA& operator=(const PixelL<T>& ip) { _luminance = ip._luminance; _alpha = ResolutionTypeTraits<T>::_norm; return *this; } 00303 PixelLA(const PixelL<T>& ip, T iA) { _luminance = ip._luminance; _alpha = iA; } 00304 00305 template <typename U> 00306 PixelLA(const PixelLA<U>& ip) { _luminance = T(ip._luminance); _alpha = T(ip._alpha); } 00307 00308 template <typename U> 00309 PixelLA& operator=(const PixelLA<U>& ip) { _luminance = T(ip._luminance); _alpha = T(ip._alpha); return *this; } 00310 00311 static const PixelLA Null() { static const PixelLA nullPixel( T(0),T(0) ); return nullPixel; } 00312 static const PixelLA Black() { static const PixelLA blackPixel(SampleTypeTraits<T>::_black, ResolutionTypeTraits<T>::_norm); return blackPixel; } 00313 static const PixelLA White() { static const PixelLA whitePixel(SampleTypeTraits<T>::_white, ResolutionTypeTraits<T>::_norm); return whitePixel; } 00314 00315 T GetChannel0() const { return _luminance; } 00316 T GetChannel1() const { return _alpha; } 00317 T GetLuminance() const { return _luminance; } 00318 T GetAlpha() const { return _alpha; } 00319 00320 static const uint32 GetChannelCount() { return _nChannel; } 00321 static const uint32 GetChannelMask() { return CM_Channel01; } 00322 static bool IsFullMask(uint32 iMask) { return (CM_Channel01 == (iMask & CM_Channel01)); } 00323 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel01)); } 00324 static const EPixelMode GetPixelMode() { return PM_Grey; } 00325 static const EPixelType GetPixelType() { return PT_LA; } 00326 static const EColorSpace GetColorSpace() { return CS_Undefined; } 00327 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00328 static const bool HasAlpha() { return _bHasAlpha; } 00329 static const bool IsGrey() { return _bGrey; } 00330 static const bool IsColor() { return _bColor; } 00331 static EPixelFormat GetPixelFormat(); 00332 }; 00333 00334 00335 template<typename T> 00336 struct ExportedByImage PixelComplex : public PixelBase< PixelComplex<T> > 00337 { 00338 typedef T type; 00339 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00340 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00341 00342 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00343 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00344 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00345 00346 typedef PixelComplex<S_type> SumOverflowPixel; 00347 typedef PixelComplex<M_type> MulOverflowPixel; 00348 typedef PixelComplex<F_type> FloatingPixel; 00349 00350 static const uint32 _nChannel = 2; 00351 static const bool _bColor = false; 00352 static const bool _bGrey = false; 00353 static const bool _bHasAlpha = false; 00354 static const bool _bRange[_nChannel]; 00355 static const T _min[_nChannel]; 00356 static const T _max[_nChannel]; 00357 00358 union { 00359 T _channel[_nChannel]; 00360 struct { 00361 T _re; 00362 T _im; 00363 }; 00364 }; 00365 00366 PixelComplex() { _re = _im = T(); } 00367 PixelComplex(T iRe, T iIm) { _re = iRe; _im = iIm; } 00368 PixelComplex(const PixelComplex& ip) { _re = ip._re; _im = ip._im; } 00369 00370 PixelComplex& operator=(const PixelComplex& ip) { _re = ip._re; _im = ip._im; return *this; } 00371 00372 template <typename U> 00373 PixelComplex(const PixelComplex<U>& ip) { _re = T(ip._re); _im = T(ip._im); } 00374 00375 template <typename U> 00376 PixelComplex& operator=(const PixelComplex<U>& ip) { _re = T(ip._re); _im = T(ip._im); return *this; } 00377 00378 static const PixelComplex Null() { static const PixelComplex nullPixel (T(0), T(0)); return nullPixel; } 00379 static const PixelComplex Black() { static const PixelComplex blackPixel(T(0), T(0)); return blackPixel; } 00380 static const PixelComplex White() { static const PixelComplex whitePixel(T(0), T(0)); return whitePixel; } 00381 00382 T GetChannel0() const { return _re; } 00383 T GetChannel1() const { return _im; } 00384 T GetReal() const { return _re; } 00385 T GetImaginary() const { return _im; } 00386 T GetLuminance() const { return 0;/*sqrt(_re*_re + _im*_im);*/ } 00387 00388 static const uint32 GetChannelCount() { return _nChannel; } 00389 static const uint32 GetChannelMask() { return CM_Channel01; } 00390 static bool IsFullMask(uint32 iMask) { return (CM_Channel01 == (iMask & CM_Channel01)); } 00391 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel01)); } 00392 static const EPixelMode GetPixelMode() { return PM_Complex; } 00393 static const EPixelType GetPixelType() { return PT_Complex; } 00394 static const EColorSpace GetColorSpace() { return CS_Undefined; } 00395 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00396 static const bool HasAlpha() { return _bHasAlpha; } 00397 static const bool IsGrey() { return _bGrey; } 00398 static const bool IsColor() { return _bColor; } 00399 static EPixelFormat GetPixelFormat(); 00400 }; 00401 00402 00403 template<typename T> 00404 struct ExportedByImage PixelRGB : public PixelBase< PixelRGB<T> > 00405 { 00406 typedef T type; 00407 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00408 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00409 00410 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00411 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00412 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00413 00414 typedef PixelRGB<S_type> SumOverflowPixel; 00415 typedef PixelRGB<M_type> MulOverflowPixel; 00416 typedef PixelRGB<F_type> FloatingPixel; 00417 00418 static const uint32 _nChannel = 3; 00419 static const bool _bColor = true; 00420 static const bool _bGrey = false; 00421 static const bool _bHasAlpha = false; 00422 static const bool _bRange[_nChannel]; 00423 static const T _min[_nChannel]; 00424 static const T _max[_nChannel]; 00425 00426 union { 00427 T _channel[_nChannel]; 00428 struct { 00429 T _red; 00430 T _green; 00431 T _blue; 00432 }; 00433 }; 00434 00435 PixelRGB() { _red = _green = _blue = T(); } 00436 PixelRGB(T iR, T iG, T iB) { _red = iR; _green = iG; _blue = iB; } 00437 PixelRGB(const PixelRGB& ip) { _red = ip._red; _green = ip._green; _blue = ip._blue; } 00438 PixelRGB(const PixelL<T>& iPixel) { _red = _green = _blue = iPixel._luminance; } 00439 PixelRGB(const PixelLA<T>& iPixel) { _red = _green = _blue = iPixel._luminance; } 00440 PixelRGB(const PixelComplex<T>& iPixel) { elxFIXME; } 00441 PixelRGB(const PixelHLS<T>& iPixel); 00442 PixelRGB(const PixelXYZ<T>& iPixel); 00443 PixelRGB(const PixelLuv<T>& iPixel); 00444 PixelRGB(const PixelLab<T>& iPixel); 00445 PixelRGB(const PixelLch<T>& iPixel); 00446 PixelRGB(const PixelHLab<T>& iPixel); 00447 PixelRGB(const PixelRGBA<T>& iPixel, bool ibBlendAlpha=false); 00448 00449 PixelRGB& operator=(const PixelRGB& ip) { _red = ip._red; _green = ip._green; _blue = ip._blue; return *this;} 00450 00451 template <typename U> 00452 PixelRGB(const PixelRGB<U>& ip) { _red = T(ip._red); _green = T(ip._green); _blue = T(ip._blue); } 00453 00454 template <typename U> 00455 PixelRGB& operator=(const PixelRGB<U>& ip) { _red = T(ip._red); _green = T(ip._green); _blue = T(ip._blue); return *this;} 00456 00457 static const PixelRGB Null() { static const PixelRGB nullPixel( T(0),T(0),T(0) ); return nullPixel; } 00458 static const PixelRGB Black() { static const PixelRGB blackPixel(SampleTypeTraits<T>::_black, SampleTypeTraits<T>::_black, SampleTypeTraits<T>::_black); return blackPixel; } 00459 static const PixelRGB White() { static const PixelRGB whitePixel(SampleTypeTraits<T>::_white, SampleTypeTraits<T>::_white, SampleTypeTraits<T>::_white); return whitePixel; } 00460 00461 T GetChannel0() const { return _red; } 00462 T GetChannel1() const { return _green; } 00463 T GetChannel2() const { return _blue; } 00464 T GetRed() const { return _red; } 00465 T GetGreen() const { return _green; } 00466 T GetBlue() const { return _blue; } 00467 T GetLuminance(EColorToGreyConversion iMethod=CGC_Default) const; 00468 00469 static const uint32 GetChannelCount() { return _nChannel; } 00470 static const uint32 GetChannelMask() { return CM_Channel012; } 00471 static bool IsFullMask(uint32 iMask) { return (CM_Channel012 == (iMask & CM_Channel012)); } 00472 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel012)); } 00473 static const EPixelMode GetPixelMode() { return PM_Color; } 00474 static const EPixelType GetPixelType() { return PT_RGB; } 00475 static const EColorSpace GetColorSpace() { return CS_RGB; } 00476 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00477 static const bool HasAlpha() { return _bHasAlpha; } 00478 static const bool IsGrey() { return _bGrey; } 00479 static const bool IsColor() { return _bColor; } 00480 static EPixelFormat GetPixelFormat(); 00481 }; 00482 00483 00484 template<typename T> 00485 struct ExportedByImage PixelHLS : public PixelBase< PixelHLS<T> > 00486 { 00487 typedef T type; 00488 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00489 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00490 00491 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00492 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00493 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00494 00495 typedef PixelHLS<S_type> SumOverflowPixel; 00496 typedef PixelHLS<M_type> MulOverflowPixel; 00497 typedef PixelHLS<F_type> FloatingPixel; 00498 00499 static const uint32 _nChannel = 3; 00500 static const bool _bColor = true; 00501 static const bool _bGrey = false; 00502 static const bool _bHasAlpha = false; 00503 static const bool _bRange[_nChannel]; 00504 static const T _min[_nChannel]; 00505 static const T _max[_nChannel]; 00506 00507 union { 00508 T _channel[_nChannel]; 00509 struct { 00510 T _hue; 00511 T _luminance; 00512 T _saturation; 00513 }; 00514 }; 00515 00516 PixelHLS() { _hue = _luminance = _saturation = T(); } 00517 PixelHLS(T iH, T iL, T iS) { _hue = iH; _luminance = iL; _saturation = iS; } 00518 PixelHLS(const PixelL<T>& iPixel); 00519 PixelHLS(const PixelLA<T>& iPixel); 00520 PixelHLS(const PixelComplex<T>& iPixel) { elxFIXME; } 00521 PixelHLS(const PixelRGB<T>& iPixel); 00522 PixelHLS(const PixelXYZ<T>& iPixel); 00523 PixelHLS(const PixelLuv<T>& iPixel); 00524 PixelHLS(const PixelLab<T>& iPixel); 00525 PixelHLS(const PixelLch<T>& iPixel); 00526 PixelHLS(const PixelHLab<T>& iPixel); 00527 PixelHLS(const PixelRGBA<T>& iPixel) { elxFIXME; } 00528 PixelHLS(const PixelHLS& ip) { _hue = ip._hue; _luminance = ip._luminance; _saturation = ip._saturation; } 00529 00530 PixelHLS& operator=(const PixelHLS& ip) { _hue = ip._hue; _luminance = ip._luminance; _saturation = ip._saturation; return *this;} 00531 00532 template <typename U> 00533 PixelHLS(const PixelHLS<U>& ip) { _hue = T(ip._hue); _luminance = T(ip._luminance); _saturation = T(ip._saturation); } 00534 00535 template <typename U> 00536 PixelHLS& operator=(const PixelHLS<U>& ip) { _hue = T(ip._hue); _luminance = T(ip._luminance); _saturation = T(ip._saturation); return *this;} 00537 00538 static const PixelHLS Null() { static const PixelHLS nullPixel( T(0),T(0),T(0) ); return nullPixel; } 00539 static const PixelHLS Black() { static const PixelHLS blackPixel(T(0), SampleTypeTraits<T>::_black, T(0)); return blackPixel; } 00540 static const PixelHLS White() { static const PixelHLS whitePixel(T(0), SampleTypeTraits<T>::_white, T(0)); return whitePixel; } 00541 00542 T GetChannel0() const { return _hue; } 00543 T GetChannel1() const { return _luminance; } 00544 T GetChannel2() const { return _saturation; } 00545 T GetHue() const { return _hue; } 00546 T GetLuminance() const { return _luminance; } 00547 T GetSaturation() const { return _saturation; } 00548 00549 static const uint32 GetChannelCount() { return _nChannel; } 00550 static const uint32 GetChannelMask() { return CM_Channel012; } 00551 static bool IsFullMask(uint32 iMask) { return (CM_Channel012 == (iMask & CM_Channel012)); } 00552 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel012)); } 00553 static const EPixelMode GetPixelMode() { return PM_Color; } 00554 static const EPixelType GetPixelType() { return PT_HLS; } 00555 static const EColorSpace GetColorSpace() { return CS_HLS; } 00556 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00557 static const bool HasAlpha() { return _bHasAlpha; } 00558 static const bool IsGrey() { return _bGrey; } 00559 static const bool IsColor() { return _bColor; } 00560 static EPixelFormat GetPixelFormat(); 00561 }; 00562 00563 00564 template<typename T> 00565 struct ExportedByImage PixelXYZ : public PixelBase< PixelXYZ<T> > 00566 { 00567 typedef T type; 00568 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00569 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00570 00571 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00572 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00573 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00574 00575 typedef PixelXYZ<S_type> SumOverflowPixel; 00576 typedef PixelXYZ<M_type> MulOverflowPixel; 00577 typedef PixelXYZ<F_type> FloatingPixel; 00578 00579 static const uint32 _nChannel = 3; 00580 static const bool _bColor = true; 00581 static const bool _bGrey = false; 00582 static const bool _bHasAlpha = false; 00583 static const bool _bRange[_nChannel]; 00584 static const T _min[_nChannel]; 00585 static const T _max[_nChannel]; 00586 00587 union { 00588 T _channel[_nChannel]; 00589 struct { 00590 T _X; 00591 T _Y; 00592 T _Z; 00593 }; 00594 }; 00595 00596 PixelXYZ() { _X = _Y = _Z = T(); } 00597 PixelXYZ(T iX, T iY, T iZ) { _X = iX; _Y = iY; _Z = iZ; } 00598 PixelXYZ(const PixelXYZ& ip) { _X = ip._X; _Y = ip._Y; _Z = ip._Z; } 00599 PixelXYZ(const PixelRGB<T>& iPixel); 00600 PixelXYZ(const PixelHLS<T>& iPixel); 00601 PixelXYZ(const PixelLuv<T>& iPixel); 00602 PixelXYZ(const PixelLab<T>& iPixel); 00603 PixelXYZ(const PixelLch<T>& iPixel); 00604 PixelXYZ(const PixelHLab<T>& iPixel); 00605 00606 PixelXYZ& operator=(const PixelXYZ& ip) { _X = ip._X; _Y = ip._Y; _Z = ip._Z; return *this;} 00607 00608 template <typename U> 00609 PixelXYZ(const PixelXYZ<U>& ip) { _X = T(ip._X); _Y = T(ip._Y); _Z = T(ip._Z); } 00610 00611 template <typename U> 00612 PixelXYZ& operator=(const PixelXYZ<U>& ip) { _X = T(ip._X); _Y = T(ip._Y); _Z = T(ip._Z); return *this;} 00613 00614 static const PixelXYZ Null() { static const PixelXYZ nullPixel( T(0), T(0), T(0) ); return nullPixel; } 00615 static const PixelXYZ Black() { static const PixelXYZ blackPixel(T(0), T(0), T(0) ); return blackPixel; } 00616 static const PixelXYZ White() { static const PixelXYZ whitePixel(T(0.95045599999999997), T(1), T(1.088754) ); return whitePixel; } 00617 00618 T GetChannel0() const { return _X; } 00619 T GetChannel1() const { return _Y; } 00620 T GetChannel2() const { return _Z; } 00621 T GetX() const { return _X; } 00622 T GetY() const { return _Y; } 00623 T GetZ() const { return _Z; } 00624 T GetLuminance() const { return _Y; } 00625 00626 static const uint32 GetChannelCount() { return _nChannel; } 00627 static const uint32 GetChannelMask() { return CM_Channel012; } 00628 static bool IsFullMask(uint32 iMask) { return (CM_Channel012 == (iMask & CM_Channel012)); } 00629 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel012)); } 00630 static const EPixelMode GetPixelMode() { return PM_Color; } 00631 static const EPixelType GetPixelType() { return PT_XYZ; } 00632 static const EColorSpace GetColorSpace() { return CS_CIE_XYZ; } 00633 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00634 static const bool HasAlpha() { return _bHasAlpha; } 00635 static const bool IsGrey() { return _bGrey; } 00636 static const bool IsColor() { return _bColor; } 00637 static EPixelFormat GetPixelFormat(); 00638 }; 00639 00640 00641 template<typename T> 00642 struct ExportedByImage PixelLuv : public PixelBase< PixelLuv<T> > 00643 { 00644 typedef T type; 00645 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00646 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00647 00648 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00649 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00650 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00651 00652 typedef PixelLuv<S_type> SumOverflowPixel; 00653 typedef PixelLuv<M_type> MulOverflowPixel; 00654 typedef PixelLuv<F_type> FloatingPixel; 00655 00656 static const uint32 _nChannel = 3; 00657 static const bool _bColor = true; 00658 static const bool _bGrey = false; 00659 static const bool _bHasAlpha = false; 00660 static const bool _bRange[_nChannel]; 00661 static const T _min[_nChannel]; 00662 static const T _max[_nChannel]; 00663 00664 union { 00665 T _channel[_nChannel]; 00666 struct { 00667 T _luminance; 00668 T _u; 00669 T _v; 00670 }; 00671 }; 00672 00673 PixelLuv() { _luminance = _u = _v = T(); } 00674 PixelLuv(T iL, T iU, T iV) { _luminance = iL; _u = iU; _v = iV; } 00675 PixelLuv(const PixelLuv<T>& iPixel) { _luminance = iPixel._luminance; _u = iPixel._u; _v = iPixel._v; } 00676 PixelLuv(const PixelRGB<T>& iPixel); 00677 PixelLuv(const PixelHLS<T>& iPixel); 00678 PixelLuv(const PixelXYZ<T>& iPixel); 00679 PixelLuv(const PixelLab<T>& iPixel); 00680 PixelLuv(const PixelLch<T>& iPixel); 00681 PixelLuv(const PixelHLab<T>& iPixel); 00682 00683 PixelLuv& operator=(const PixelLuv& ip) { _luminance = ip._luminance; _u = ip._u; _v = ip._v; return *this;} 00684 00685 template <typename U> 00686 PixelLuv(const PixelLuv<U>& ip) { _luminance = T(ip._luminance); _u = T(ip._u); _v = T(ip._v); } 00687 00688 template <typename U> 00689 PixelLuv& operator=(const PixelLuv<U>& ip) { _luminance = T(ip._luminance); _u = T(ip._u); _v = T(ip._v); return *this;} 00690 00691 static const PixelLuv Null() { static const PixelLuv nullPixel( T(0), T(0), T(0) ); return nullPixel; } 00692 static const PixelLuv Black() { static const PixelLuv blackPixel(T(0), T(0), T(0) ); return blackPixel; } 00693 static const PixelLuv White() { static const PixelLuv whitePixel(T(1), T(0), T(0) ); return whitePixel; } 00694 00695 T GetChannel0() const { return _luminance; } 00696 T GetChannel1() const { return _u; } 00697 T GetChannel2() const { return _v; } 00698 T GetLuminance() const { return _luminance; } 00699 T GetU() const { return _u; } 00700 T GetV() const { return _v; } 00701 00702 static const uint32 GetChannelCount() { return _nChannel; } 00703 static const uint32 GetChannelMask() { return CM_Channel012; } 00704 static bool IsFullMask(uint32 iMask) { return (CM_Channel012 == (iMask & CM_Channel012)); } 00705 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel012)); } 00706 static const EPixelMode GetPixelMode() { return PM_Color; } 00707 static const EPixelType GetPixelType() { return PT_Luv; } 00708 static const EColorSpace GetColorSpace() { return CS_CIE_Luv; } 00709 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00710 static const bool HasAlpha() { return _bHasAlpha; } 00711 static const bool IsGrey() { return _bGrey; } 00712 static const bool IsColor() { return _bColor; } 00713 static EPixelFormat GetPixelFormat(); 00714 }; 00715 00716 00717 template<typename T> 00718 struct ExportedByImage PixelLab : public PixelBase< PixelLab<T> > 00719 { 00720 typedef T type; 00721 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00722 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00723 00724 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00725 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00726 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00727 00728 typedef PixelLab<S_type> SumOverflowPixel; 00729 typedef PixelLab<M_type> MulOverflowPixel; 00730 typedef PixelLab<F_type> FloatingPixel; 00731 00732 static const uint32 _nChannel = 3; 00733 static const bool _bColor = true; 00734 static const bool _bGrey = false; 00735 static const bool _bHasAlpha = false; 00736 static const bool _bRange[_nChannel]; 00737 static const T _min[_nChannel]; 00738 static const T _max[_nChannel]; 00739 00740 union { 00741 T _channel[_nChannel]; 00742 struct { 00743 T _luminance; 00744 T _a; 00745 T _b; 00746 }; 00747 }; 00748 00749 PixelLab() { _luminance = _a = _b = T(); } 00750 PixelLab(T iL, T iA, T iB) { _luminance = iL; _a = iA; _b = iB; } 00751 PixelLab(const PixelLab<T>& iPixel) { _luminance = iPixel._luminance; _a = iPixel._a; _b = iPixel._b; } 00752 PixelLab(const PixelL<T>& iPixel); 00753 PixelLab(const PixelLA<T>& iPixel); 00754 PixelLab(const PixelRGB<T>& iPixel); 00755 PixelLab(const PixelRGBA<T>& iPixel); 00756 PixelLab(const PixelHLS<T>& iPixel); 00757 PixelLab(const PixelXYZ<T>& iPixel); 00758 PixelLab(const PixelLuv<T>& iPixel); 00759 PixelLab(const PixelLch<T>& iPixel); 00760 PixelLab(const PixelHLab<T>& iPixel); 00761 00762 PixelLab& operator=(const PixelLab& ip) { _luminance = ip._luminance; _a = ip._a; _b = ip._b; return *this;} 00763 00764 template <typename U> 00765 PixelLab(const PixelLab<U>& ip) { _luminance = T(ip._luminance); _a = T(ip._a); _b = T(ip._b); } 00766 00767 template <typename U> 00768 PixelLab& operator=(const PixelLab<U>& ip) { _luminance = T(ip._luminance); _a = T(ip._a); _b = T(ip._b); return *this;} 00769 00770 static const PixelLab Null() { static const PixelLab nullPixel( T(0), T(0), T(0) ); return nullPixel; } 00771 static const PixelLab Black() { static const PixelLab blackPixel(T(0), T(0), T(0) ); return blackPixel; } 00772 static const PixelLab White() { static const PixelLab whitePixel(T(100), T(0), T(0) ); return whitePixel; } 00773 00774 T GetChannel0() const { return _luminance; } 00775 T GetChannel1() const { return _a; } 00776 T GetChannel2() const { return _b; } 00777 T GetLuminance() const { return _luminance; } 00778 T GetA() const { return _a; } 00779 T GetB() const { return _b; } 00780 00781 static const uint32 GetChannelCount() { return _nChannel; } 00782 static const uint32 GetChannelMask() { return CM_Channel012; } 00783 static bool IsFullMask(uint32 iMask) { return (CM_Channel012 == (iMask & CM_Channel012)); } 00784 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel012)); } 00785 static const EPixelMode GetPixelMode() { return PM_Color; } 00786 static const EPixelType GetPixelType() { return PT_Lab; } 00787 static const EColorSpace GetColorSpace() { return CS_CIE_Lab; } 00788 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00789 static const bool HasAlpha() { return _bHasAlpha; } 00790 static const bool IsGrey() { return _bGrey; } 00791 static const bool IsColor() { return _bColor; } 00792 static EPixelFormat GetPixelFormat(); 00793 }; 00794 00795 template<typename T> 00796 struct ExportedByImage PixelLch : public PixelBase< PixelLch<T> > 00797 { 00798 typedef T type; 00799 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00800 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00801 00802 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00803 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00804 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00805 00806 typedef PixelLch<S_type> SumOverflowPixel; 00807 typedef PixelLch<M_type> MulOverflowPixel; 00808 typedef PixelLch<F_type> FloatingPixel; 00809 00810 static const uint32 _nChannel = 3; 00811 static const bool _bColor = true; 00812 static const bool _bGrey = false; 00813 static const bool _bHasAlpha = false; 00814 static const bool _bRange[_nChannel]; 00815 static const T _min[_nChannel]; 00816 static const T _max[_nChannel]; 00817 00818 union { 00819 T _channel[_nChannel]; 00820 struct { 00821 T _luminance; 00822 T _c; 00823 T _h; 00824 }; 00825 }; 00826 00827 PixelLch() { _luminance = _c = _h = T(); } 00828 PixelLch(T iL, T iC, T iH) { _luminance = iL; _c = iC; _h = iH; } 00829 PixelLch(const PixelLch<T>& iPixel) { _luminance = iPixel._luminance; _c = iPixel._c; _h = iPixel._h; } 00830 PixelLch(const PixelRGB<T>& iPixel); 00831 PixelLch(const PixelHLS<T>& iPixel); 00832 PixelLch(const PixelXYZ<T>& iPixel); 00833 PixelLch(const PixelLuv<T>& iPixel); 00834 PixelLch(const PixelLab<T>& iPixel); 00835 PixelLch(const PixelHLab<T>& iPixel); 00836 00837 PixelLch& operator=(const PixelLch& ip) { _luminance = ip._luminance; _c = ip._c; _h = ip._h; return *this;} 00838 00839 template <typename U> 00840 PixelLch(const PixelLch<U>& ip) { _luminance = T(ip._luminance); _c = T(ip._c); _h = T(ip._h); } 00841 00842 template <typename U> 00843 PixelLch& operator=(const PixelLch<U>& ip) { _luminance = T(ip._luminance); _c = T(ip._c); _h = T(ip._h); return *this;} 00844 00845 static const PixelLch Null() { static const PixelLch nullPixel( T(0), T(0), T(0) ); return nullPixel; } 00846 static const PixelLch Black() { static const PixelLch blackPixel(T(0), T(0), T(0) ); return blackPixel; } 00847 static const PixelLch White() { static const PixelLch whitePixel(T(100), T(0), T(0) ); return whitePixel; } 00848 00849 T GetChannel0() const { return _luminance; } 00850 T GetChannel1() const { return _c; } 00851 T GetChannel2() const { return _h; } 00852 T GetLuminance() const { return _luminance; } 00853 T GetC() const { return _c; } 00854 T GetH() const { return _h; } 00855 00856 static const uint32 GetChannelCount() { return _nChannel; } 00857 static const uint32 GetChannelMask() { return CM_Channel012; } 00858 static bool IsFullMask(uint32 iMask) { return (CM_Channel012 == (iMask & CM_Channel012)); } 00859 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel012)); } 00860 static const EPixelMode GetPixelMode() { return PM_Color; } 00861 static const EPixelType GetPixelType() { return PT_Lch; } 00862 static const EColorSpace GetColorSpace() { return CS_CIE_Lch; } 00863 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00864 static const bool HasAlpha() { return _bHasAlpha; } 00865 static const bool IsGrey() { return _bGrey; } 00866 static const bool IsColor() { return _bColor; } 00867 static EPixelFormat GetPixelFormat(); 00868 }; 00869 00870 template<typename T> 00871 struct ExportedByImage PixelHLab : public PixelBase< PixelHLab<T> > 00872 { 00873 typedef T type; 00874 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00875 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00876 00877 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00878 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00879 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00880 00881 typedef PixelHLab<S_type> SumOverflowPixel; 00882 typedef PixelHLab<M_type> MulOverflowPixel; 00883 typedef PixelHLab<F_type> FloatingPixel; 00884 00885 static const uint32 _nChannel = 3; 00886 static const bool _bColor = true; 00887 static const bool _bGrey = false; 00888 static const bool _bHasAlpha = false; 00889 static const bool _bRange[_nChannel]; 00890 static const T _min[_nChannel]; 00891 static const T _max[_nChannel]; 00892 00893 union { 00894 T _channel[_nChannel]; 00895 struct { 00896 T _luminance; 00897 T _a; 00898 T _b; 00899 }; 00900 }; 00901 00902 PixelHLab() { _luminance = _a = _b = T(); } 00903 PixelHLab(T iL, T iA, T iB) { _luminance = iL; _a = iA; _b = iB; } 00904 PixelHLab(const PixelHLab<T>& iPixel) { _luminance = iPixel._luminance; _a = iPixel._a; _b = iPixel._b; } 00905 PixelHLab(const PixelRGB<T>& iPixel); 00906 PixelHLab(const PixelHLS<T>& iPixel); 00907 PixelHLab(const PixelXYZ<T>& iPixel); 00908 PixelHLab(const PixelLuv<T>& iPixel); 00909 PixelHLab(const PixelLab<T>& iPixel); 00910 PixelHLab(const PixelLch<T>& iPixel); 00911 00912 PixelHLab& operator=(const PixelHLab& ip) { _luminance = ip._luminance; _a = ip._a; _b = ip._b; return *this;} 00913 00914 template <typename U> 00915 PixelHLab(const PixelHLab<U>& ip) { _luminance = T(ip._luminance); _a = T(ip._a); _b = T(ip._b); } 00916 00917 template <typename U> 00918 PixelHLab& operator=(const PixelHLab<U>& ip) { _luminance = T(ip._luminance); _a = T(ip._a); _b = T(ip._b); return *this;} 00919 00920 static const PixelHLab Null() { static const PixelHLab nullPixel( T(0), T(0), T(0) ); return nullPixel; } 00921 static const PixelHLab Black() { static const PixelHLab blackPixel(T(0), T(0), T(0) ); return blackPixel; } 00922 static const PixelHLab White() { static const PixelHLab whitePixel(T(100), T(0), T(0) ); return whitePixel; } 00923 00924 T GetChannel0() const { return _luminance; } 00925 T GetChannel1() const { return _a; } 00926 T GetChannel2() const { return _b; } 00927 T GetLuminance() const { return _luminance; } 00928 T GetA() const { return _a; } 00929 T GetB() const { return _b; } 00930 00931 static const uint32 GetChannelCount() { return _nChannel; } 00932 static const uint32 GetChannelMask() { return CM_Channel012; } 00933 static bool IsFullMask(uint32 iMask) { return (CM_Channel012 == (iMask & CM_Channel012)); } 00934 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel012)); } 00935 static const EPixelMode GetPixelMode() { return PM_Color; } 00936 static const EPixelType GetPixelType() { return PT_HLab; } 00937 static const EColorSpace GetColorSpace() { return CS_Hunter_Lab; } 00938 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 00939 static const bool HasAlpha() { return _bHasAlpha; } 00940 static const bool IsGrey() { return _bGrey; } 00941 static const bool IsColor() { return _bColor; } 00942 static EPixelFormat GetPixelFormat(); 00943 }; 00944 00945 template<typename T> 00946 struct ExportedByImage PixelRGBA : public PixelBase< PixelRGBA<T> > 00947 { 00948 typedef T type; 00949 typedef IntegerToType< ResolutionTypeTraits<T>::_bInteger > IntType; 00950 typedef LutToType< ResolutionTypeTraits<T>::_bLUT > LutType; 00951 00952 typedef typename ResolutionTypeTraits<T>::SumOverflow_type S_type; 00953 typedef typename ResolutionTypeTraits<T>::MulOverflow_type M_type; 00954 typedef typename ResolutionTypeTraits<T>::Floating_type F_type; 00955 00956 typedef PixelRGBA<S_type> SumOverflowPixel; 00957 typedef PixelRGBA<M_type> MulOverflowPixel; 00958 typedef PixelRGBA<F_type> FloatingPixel; 00959 00960 static const uint32 _nChannel = 4; 00961 static const bool _bColor = true; 00962 static const bool _bGrey = false; 00963 static const bool _bHasAlpha = true; 00964 static const bool _bRange[_nChannel]; 00965 static const T _min[_nChannel]; 00966 static const T _max[_nChannel]; 00967 00968 union { 00969 T _channel[_nChannel]; 00970 struct { 00971 T _red; 00972 T _green; 00973 T _blue; 00974 T _alpha; 00975 }; 00976 }; 00977 00978 PixelRGBA() { _red = _green = _blue = _alpha = T(); } 00979 PixelRGBA(T iR, T iG, T iB, T iA) { _red = iR; _green = iG; _blue = iB; _alpha = iA; } 00980 PixelRGBA(const PixelRGBA& ip) { _red = ip._red; _green = ip._green; _blue = ip._blue; _alpha = ip._alpha; } 00981 00982 PixelRGBA(const PixelL<T>& iPixel) { _red = _green = _blue = iPixel._luminance; _alpha = ResolutionTypeTraits<T>::_norm; } 00983 PixelRGBA(const PixelLA<T>& iPixel) { _red = _green = _blue = iPixel._luminance; _alpha = iPixel._alpha; } 00984 PixelRGBA(const PixelComplex<T>& iPixel) { elxFIXME; } 00985 PixelRGBA(const PixelRGB<T>& iPixel) { _red = iPixel._red; _green = iPixel._green; _blue = iPixel._blue; _alpha = ResolutionTypeTraits<T>::_norm; } 00986 PixelRGBA(const PixelRGB<T>& iPixel, T iA) { _red = iPixel._red; _green = iPixel._green; _blue = iPixel._blue; _alpha = iA; } 00987 PixelRGBA(const PixelXYZ<T>& iPixel) { elxFIXME; } 00988 PixelRGBA(const PixelHLS<T>& iPixel) { elxFIXME; } 00989 PixelRGBA(const PixelLab<T>& iPixel) { elxFIXME; } 00990 PixelRGBA(const PixelLuv<T>& iPixel) { elxFIXME; } 00991 PixelRGBA(const PixelLch<T>& iPixel) { elxFIXME; } 00992 PixelRGBA(const PixelHLab<T>& iPixel) { elxFIXME; } 00993 00994 PixelRGBA& operator=(const PixelRGBA& ip) { _red = ip._red; _green = ip._green; _blue = ip._blue; _alpha = ip._alpha; return *this;} 00995 00996 template <typename U> 00997 PixelRGBA(const PixelRGBA<U>& ip) { _red = T(ip._red); _green = T(ip._green); _blue = T(ip._blue); _alpha = T(ip._alpha); } 00998 00999 template <typename U> 01000 PixelRGBA& operator=(const PixelRGBA<U>& ip) { _red = T(ip._red); _green = T(ip._green); _blue = T(ip._blue); _alpha = T(ip._alpha); return *this;} 01001 01002 static const PixelRGBA Null() { static const PixelRGBA nullPixel( T(0),T(0),T(0),T(0) ); return nullPixel; } 01003 static const PixelRGBA Black() { static const PixelRGBA blackPixel(SampleTypeTraits<T>::_black, SampleTypeTraits<T>::_black, SampleTypeTraits<T>::_black, ResolutionTypeTraits<T>::_norm); return blackPixel; } 01004 static const PixelRGBA White() { static const PixelRGBA whitePixel(SampleTypeTraits<T>::_white, SampleTypeTraits<T>::_white, SampleTypeTraits<T>::_white, ResolutionTypeTraits<T>::_norm); return whitePixel; } 01005 01006 T GetChannel0() const { return _red; } 01007 T GetChannel1() const { return _green; } 01008 T GetChannel2() const { return _blue; } 01009 T GetChannel3() const { return _alpha; } 01010 T GetRed() const { return _red; } 01011 T GetGreen() const { return _green; } 01012 T GetBlue() const { return _blue; } 01013 T GetAlpha() const { return _alpha; } 01014 T GetLuminance(EColorToGreyConversion iMethod=CGC_Default) const; 01015 01016 static const uint32 GetChannelCount() { return _nChannel; } 01017 static const uint32 GetChannelMask() { return CM_Channel0123; } 01018 static bool IsFullMask(uint32 iMask) { return (CM_Channel0123 == (iMask & CM_Channel0123)); } 01019 static bool IsMasking(uint32 iMask) { return (0 != (iMask & CM_Channel0123)); } 01020 static const EPixelMode GetPixelMode() { return PM_Color; } 01021 static const EPixelType GetPixelType() { return PT_RGBA; } 01022 static const EColorSpace GetColorSpace() { return CS_RGB; } 01023 static const EResolution GetResolution() { return ResolutionTypeTraits<T>::_resolution; } 01024 static const bool HasAlpha() { return _bHasAlpha; } 01025 static const bool IsGrey() { return _bGrey; } 01026 static const bool IsColor() { return _bColor; } 01027 static EPixelFormat GetPixelFormat(); 01028 }; 01029 01030 01033 // declare all suitable pixel types. 01034 typedef PixelL<uint8> PixelLub; 01035 typedef PixelL<uint16> PixelLus; 01036 typedef PixelL<int32> PixelLi; 01037 typedef PixelL<int64> PixelLl; 01038 typedef PixelL<float> PixelLf; 01039 typedef PixelL<double> PixelLd; 01040 01041 typedef PixelLA<uint8> PixelLAub; 01042 typedef PixelLA<uint16> PixelLAus; 01043 typedef PixelLA<int32> PixelLAi; 01044 typedef PixelLA<int64> PixelLAl; 01045 typedef PixelLA<float> PixelLAf; 01046 typedef PixelLA<double> PixelLAd; 01047 01048 typedef PixelRGB<uint8> PixelRGBub; 01049 typedef PixelRGB<uint16> PixelRGBus; 01050 typedef PixelRGB<int32> PixelRGBi; 01051 typedef PixelRGB<int64> PixelRGBl; 01052 typedef PixelRGB<float> PixelRGBf; 01053 typedef PixelRGB<double> PixelRGBd; 01054 01055 typedef PixelRGBA<uint8> PixelRGBAub; 01056 typedef PixelRGBA<uint16> PixelRGBAus; 01057 typedef PixelRGBA<int32> PixelRGBAi; 01058 typedef PixelRGBA<int64> PixelRGBAl; 01059 typedef PixelRGBA<float> PixelRGBAf; 01060 typedef PixelRGBA<double> PixelRGBAd; 01061 01062 typedef PixelComplex<int32> PixelComplexi; 01063 typedef PixelComplex<float> PixelComplexf; 01064 typedef PixelComplex<double> PixelComplexd; 01065 01066 typedef PixelHLS<float> PixelHLSf; 01067 typedef PixelHLS<double> PixelHLSd; 01068 01069 typedef PixelXYZ<float> PixelXYZf; 01070 typedef PixelXYZ<double> PixelXYZd; 01071 01072 typedef PixelLab<float> PixelLabf; 01073 typedef PixelLab<double> PixelLabd; 01074 01075 typedef PixelLuv<float> PixelLuvf; 01076 typedef PixelLuv<double> PixelLuvd; 01077 01078 typedef PixelLch<float> PixelLchf; 01079 typedef PixelLch<double> PixelLchd; 01080 01081 typedef PixelHLab<float> PixelHLabf; 01082 typedef PixelHLab<double> PixelHLabd; 01083 01085 01086 } // namespace Image 01087 } // namespace eLynx 01088 01089 #include "inl/Pixel/Pixels.inl" 01090 01091 #endif // __Pixels_h__