00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _IAICOLORSPACE_H_
00022 #define _IAICOLORSPACE_H_
00023
00024 #include "AITypes.h"
00025 #include "AIColor.h"
00026 #include "IAIUnicodeString.h"
00027
00033 #define kColorSpaceBadIndex 'CS!I'
00034
00037 #define kColorSpaceInvalid '!VAL'
00038
00039 class CAIColorSpaceImpl;
00040 class CAIColorSpaceListImpl;
00041
00042 namespace ai {
00043
00044 class ColorSpace;
00045 class ColorSpaceList;
00046
00048 class ColorSpace {
00049 friend class ColorSpaceList;
00050
00051 public:
00052 enum Family {
00053 kAIColorSpaceFamilyUnknown,
00054 kAIColorSpaceFamilyGray,
00055 kAIColorSpaceFamilyRGB,
00056 kAIColorSpaceFamilyLab,
00057 kAIColorSpaceFamilyCMYK,
00058 kAIColorSpaceFamilySeparation,
00059 kAIColorSpaceFamilyNChannel,
00060 kAIColorSpaceFamilyIndexed
00061 };
00062
00063 public:
00064
00066
00068
00069 explicit ColorSpace (void) AINOTHROW;
00075 explicit ColorSpace (ai::ColorSpace::Family family, bool hasAlpha = false);
00085 explicit ColorSpace (int separationNum, bool hasAlpha = false);
00092 explicit ColorSpace (const AICustomColorHandle customColor, bool hasAlpha = false);
00105 explicit ColorSpace (const ai::ColorSpaceList &csList, bool hasAlpha = false, bool promoteToProcess = false);
00116 explicit ColorSpace (const ai::ColorSpace &baseCs, int numComponents, int numEntries, const ASUInt8 *lookup);
00123 explicit ColorSpace (const ai::ColorSpace &baseCs, bool hasAlpha);
00128 ColorSpace (const ai::ColorSpace &cs);
00129
00130 #ifdef AI_HAS_RVALUE_REFERENCES
00131
00135 ColorSpace (ColorSpace&& rhs) AINOEXCEPT;
00136 #endif
00137
00139 ~ColorSpace ();
00141
00146 void swap(ColorSpace& rhs) AINOEXCEPT;
00147
00149 ai::ColorSpace& operator= (const ai::ColorSpace& rhs);
00150
00151 #ifdef AI_HAS_RVALUE_REFERENCES
00152
00153 ai::ColorSpace& operator= (ColorSpace&& rhs) AINOEXCEPT;
00154 #endif
00155
00157 bool operator== (const ai::ColorSpace& rhs) const;
00158
00160 bool operator!= (const ai::ColorSpace& rhs) const;
00161
00162
00163
00167 bool IsValid(void) const;
00171 ai::ColorSpace::Family GetFamily(void) const;
00177 bool HasAlpha(void) const;
00183 int NumComponents(void) const;
00189 int NumColorComponents(void) const;
00196 int NumSpotComponents(void) const;
00201 int NumProcessComponents(void) const;
00207 ai::ColorSpace BaseColorSpace(void) const;
00213 int IndexedNumComponents(void) const;
00219 int IndexedNumEntries(void) const;
00224 const ASUInt8* IndexedTable(void) const;
00229 const ASUInt8* IndexedColors(ASUInt8 index) const;
00235 const AIFloat* SeparationAltColors(void) const;
00240 ai::ColorSpaceList GetColorSpaceList(void) const;
00249 ai::UnicodeString NthColorant(ai::int32 n) const;
00255 bool HasFullSetOfProcessComponents(void) const;
00256
00257 public:
00258 void deleteImpl(void);
00259 const CAIColorSpaceImpl *getImpl(void) const;
00260 explicit ColorSpace (CAIColorSpaceImpl *impl);
00261
00262 private:
00263 CAIColorSpaceImpl *fImpl;
00264 };
00265
00271 inline void ColorSpace::swap(ColorSpace& rhs) AINOEXCEPT
00272 {
00273 std::swap(fImpl, rhs.fImpl);
00274 }
00275
00276 #ifdef AI_HAS_RVALUE_REFERENCES
00277
00279 inline ColorSpace::ColorSpace(ColorSpace&& rhs) AINOEXCEPT : fImpl{rhs.fImpl}
00280 {
00281 rhs.fImpl = nullptr;
00282 }
00283
00285 inline ColorSpace& ColorSpace::operator=(ColorSpace&& rhs) AINOEXCEPT
00286 {
00287 swap(rhs);
00288 return *this;
00289 }
00290
00291 #endif // AI_HAS_RVALUE_REFERENCES
00292
00295 class ColorSpaceList {
00296 friend class ColorSpace;
00297
00298 public:
00299
00301
00303
00308 explicit ColorSpaceList (void) AINOTHROW;
00313 explicit ColorSpaceList (const ai::ColorSpace& cs);
00318 ColorSpaceList (const ai::ColorSpaceList &csList);
00319
00320 #ifdef AI_HAS_RVALUE_REFERENCES
00321
00325 ColorSpaceList (ColorSpaceList&& rhs) AINOEXCEPT;
00326 #endif
00327
00329 ~ColorSpaceList ();
00331
00336 void swap(ColorSpaceList& rhs) AINOEXCEPT;
00337
00339 ai::ColorSpaceList& operator= (const ai::ColorSpaceList& rhs);
00340
00341 #ifdef AI_HAS_RVALUE_REFERENCES
00342
00343 ColorSpaceList& operator= (ColorSpaceList&& rhs) AINOEXCEPT;
00344 #endif
00345
00346
00347
00351 bool IsValid(void) const;
00356 void AddColorSpace(const ai::ColorSpace &cs);
00360 int NumColorSpaces(void) const;
00366 ai::ColorSpace NthColorSpace(int n) const;
00378 void Normalize(short docColorModel, bool convertGrayToFullProcess = false);
00379
00380 public:
00382 void deleteImpl(void);
00383
00384 private:
00385 CAIColorSpaceListImpl *fImpl;
00386 };
00387
00393 inline void ColorSpaceList::swap(ColorSpaceList& rhs) AINOEXCEPT
00394 {
00395 std::swap(fImpl, rhs.fImpl);
00396 }
00397
00398 #ifdef AI_HAS_RVALUE_REFERENCES
00399
00401 inline ColorSpaceList::ColorSpaceList(ColorSpaceList&& rhs) AINOEXCEPT : fImpl{rhs.fImpl}
00402 {
00403 rhs.fImpl = nullptr;
00404 }
00405
00407 inline ColorSpaceList& ColorSpaceList::operator=(ColorSpaceList&& rhs) AINOEXCEPT
00408 {
00409 swap(rhs);
00410 return *this;
00411 }
00412
00413 #endif // AI_HAS_RVALUE_REFERENCES
00414
00415 }
00416
00417 #endif // _IAICOLORSPACE_H_