Scribus
Open source desktop publishing at your fingertips
sccolorspacedata_cmyka.h
1 #ifndef SCCOLORSPACEDATA_CMYKA_H
2 #define SCCOLORSPACEDATA_CMYKA_H
3 
4 #include <cassert>
5 #include <climits>
6 #include <limits>
7 #include "sccolorprofile.h"
8 #include "sccolorspacedata.h"
9 
10 template<typename T, eColorFormat COLORFORMAT>
12 {
13 protected:
14  int m_cIndex;
15  int m_mIndex;
16  int m_yIndex;
17  int m_kIndex;
18  int m_aIndex;
19 
20 public:
22 
23  virtual uint alphaIndex(void) const { return m_aIndex; }
24  virtual void flattenAlpha(void* dataIn, uint numElems) const;
25 };
26 
27 template<typename T, eColorFormat COLORFORMAT>
29 {
30  m_colorFormat = COLORFORMAT;
31  m_profile = profile;
32  if (m_colorFormat == Format_CMYKA_8 || m_colorFormat == Format_CMYKA_16)
33  {
34  m_cIndex = 0;
35  m_mIndex = 1;
36  m_yIndex = 2;
37  m_kIndex = 3;
38  m_aIndex = 4;
39  }
40  else
41  {
42  assert(false);
43  }
44  if (m_profile)
45  {
46  assert(m_profile.colorSpace() == ColorSpace_Cmyk || m_profile.colorSpace() == ColorSpace_Cmy);
47  }
48 };
49 
50 template<typename T, eColorFormat COLORFORMAT>
51 void ScColorSpaceDataTempl_CMYKA<T, COLORFORMAT>::flattenAlpha(void* dataIn, uint numElems) const
52 {
53  T* data = ((T*) dataIn) + m_aIndex;
54  T nLimit = std::numeric_limits<T>::max();
55  while (numElems > 0)
56  {
57  *data = nLimit;
58  data += 5;
59  --numElems;
60  };
61 };
62 
65 
66 #endif
Definition: sccolorspacedata_cmyka.h:11
Definition: sccolorprofile.h:16
Definition: sccolorspacedata.h:17