Scribus
Open source desktop publishing at your fingertips
sccolorspacedata_laba.h
1 #ifndef SCCOLORSPACEDATA_LABA_H
2 #define SCCOLORSPACEDATA_LABA_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_LIndex;
15  int m_aIndex;
16  int m_bIndex;
17  int m_AIndex;
18 
19 public:
21 
22  virtual uint alphaIndex(void) const { return m_AIndex; }
23  virtual void flattenAlpha(void* dataIn, uint numElems) const;
24 };
25 
26 template<typename T, eColorFormat COLORFORMAT>
28 {
29  m_colorFormat = COLORFORMAT;
30  m_profile = profile;
31  if (m_colorFormat == Format_LabA_8)
32  {
33  m_LIndex = 0;
34  m_aIndex = 1;
35  m_bIndex = 2;
36  m_AIndex = 3;
37  }
38  else
39  {
40  assert(false);
41  }
42  if (m_profile)
43  {
44  assert(m_profile.colorSpace() == ColorSpace_Lab);
45  }
46 };
47 
48 template<typename T, eColorFormat COLORFORMAT>
49 void ScColorSpaceDataTempl_LabA<T, COLORFORMAT>::flattenAlpha(void* dataIn, uint numElems) const
50 {
51  T* data = ((T*) dataIn) + m_aIndex;
52  T nLimit = std::numeric_limits<T>::max();
53  while (numElems > 0)
54  {
55  *data = nLimit;
56  data += 4;
57  --numElems;
58  };
59 };
60 
62 
63 #endif
Definition: sccolorprofile.h:16
Definition: sccolorspacedata.h:17
Definition: sccolorspacedata_laba.h:11