Scribus
Open source desktop publishing at your fingertips
sccolorspace.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 
8 #ifndef SCCOLORSPACE_H
9 #define SCCOLORSPACE_H
10 
11 #include <QSharedPointer>
12 #include <QWeakPointer>
13 #include "scribusapi.h"
14 #include "sccolorprofile.h"
15 #include "sccolorspacedata.h"
16 #include "sccolortransform.h"
17 
18 class SCRIBUS_API ScColorSpace
19 {
20 public:
21  ScColorSpace();
23  ScColorSpace(const QSharedPointer<ScColorSpaceData>&);
24 
25  ScColorMgmtEngine& engine() { return m_data->engine(); }
26  const ScColorMgmtEngine& engine() const { return m_data->engine(); }
27 
28  inline bool isNull() const { return m_data.isNull(); }
29  inline operator bool () const { return !isNull(); }
30 
31  eColorType type() const;
32  eColorFormat colorFormat() const;
33  ScColorProfile profile() const;
34 
35  uint numChannels(void) const;
36  uint bytesPerChannel(void) const;
37 
38  bool hasAlphaChannel(void) const;
39  uint alphaIndex(void) const;
40 
41  // Restore full opacity of alpha channel
42  void flattenAlpha(void* dataIn, uint numElems);
43 
44  // Function to create transform to a specific output color space
45  ScColorTransform createTransform(const ScColorSpace& outputSpace, eRenderIntent renderIntent,
46  long transformFlags);
47  ScColorTransform createTransform(const ScColorProfile& outputProfile, eColorFormat outputFormat,
48  eRenderIntent renderIntent, long transformFlags);
49 
50  // Function to create proofing transform to a specific output color space and a specific proofing device
51  ScColorTransform createProofingTransform(const ScColorSpace& outputSpace, const ScColorProfile& proofing,
52  eRenderIntent renderIntent, eRenderIntent proofingIntent,
53  long transformFlags);
54  ScColorTransform createProofingTransform(const ScColorProfile& outputProfile, eColorFormat outputFormat,
55  const ScColorProfile& proofing, eRenderIntent renderIntent,
56  eRenderIntent proofingIntent, long transformFlags);
57 
58  // Convert color data to a specific color space
59  bool convert(ScColorSpace& data, eRenderIntent renderIntent, long transformFlags,
60  void* dataIn, void* dataOut, uint numElems, ScColorTransform* lastTrans = 0);
61  bool convert(ScColorSpace& data, eRenderIntent renderIntent, long transformFlags,
62  void* dataIn, QIODevice* device, uint numElems, ScColorTransform* lastTrans = 0);
63 
64  const ScColorSpaceData* data() const { return m_data.data(); }
65 
66  bool operator==(const ScColorSpace& cspace) const;
67 
68 protected:
69  QSharedPointer<ScColorSpaceData> m_data;
70 
71  QWeakPointer<ScColorSpaceData> weakRef() const { return m_data.toWeakRef(); }
72  QSharedPointer<ScColorSpaceData> strongRef() const { return m_data; }
73 };
74 
75 #endif
Definition: sccolorspace.h:18
Definition: sccolorprofile.h:16
Definition: sccolorspacedata.h:17
Definition: sccolortransform.h:16
Definition: sccolormgmtengine.h:16