All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ColorSpace.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2018 by PDFTron Systems Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPPDFColorSpace
6 #define PDFTRON_H_CPPPDFColorSpace
7 
8 #include <C/PDF/TRN_ColorSpace.h>
9 #include <Common/Common.h>
10 #include <PDF/Function.h>
11 
12 namespace pdftron {
13  namespace PDF {
14 
15 
20 class ColorPt
21 {
22 public:
23 
31  explicit ColorPt(double x = 0, double y = 0, double z = 0, double w = 0);
32  ColorPt(const ColorPt& co);
36  ~ColorPt();
37 
38  ColorPt& operator= (const ColorPt& co);
39  bool operator== (const ColorPt& co) const;
40 
52  void Set(double x = 0, double y = 0, double z = 0, double w = 0);
53 
79  void Set(int colorant_index, double colorant_value);
80 
94  double Get(int colorant_index) const;
95 
103  void SetColorantNum(int num);
104 
108  void Destroy();
109 
111 #ifndef SWIGHIDDEN
112  TRN_ColorPt m_c;
113 #endif
114 };
116 
117 
134 {
135 public:
136 
137  // Common ColorSpace methods ----------------------------------------------------
138 
142  static ColorSpace CreateDeviceGray();
143 
147  static ColorSpace CreateDeviceRGB();
148 
152  static ColorSpace CreateDeviceCMYK();
153 
157  static ColorSpace CreatePattern();
158 
162  static ColorSpace CreateICC(SDF::SDFDoc& doc, const UString& filepath);
164  static ColorSpace CreateICC(SDF::SDFDoc& doc, const UChar* buf, size_t buf_sz);
165 
172  ColorSpace (SDF::Obj color_space = 0);
173  ColorSpace(const ColorSpace& c);
174  ColorSpace& operator=(const ColorSpace& c);
175 
179  ~ColorSpace();
180 
181  enum Type
182  {
195  };
196 
197  // Common Static/Global methods ----------------------------------------------------
198 
199 #ifndef SWIG
200 
207  static int GetComponentNum(Type cs_type, SDF::Obj cs);
208 
215  static Type GetType(SDF::Obj cs);
216 #endif
217 
221  Type GetType() const;
222 
226  SDF::Obj GetSDFObj ();
227 
232  int GetComponentNum();
233 
239  void InitColor(ColorPt& out_colorants);
240 
253  void InitComponentRanges(std::vector<double>& out_decode_low, std::vector<double>& out_decode_range);
254 
265  ColorPt Convert2Gray(const ColorPt& in_color);
266 
267 #ifndef SWIG
268  void Convert2Gray(const ColorPt& in_color, ColorPt& out_color);
269 #endif
270 
281  ColorPt Convert2RGB(const ColorPt& in_color);
282 
283 #ifndef SWIG
284  void Convert2RGB(const ColorPt& in_color, ColorPt& out_color);
285 #endif
286 
297  ColorPt Convert2CMYK(const ColorPt& in_color);
298 
299 #ifndef SWIG
300  void Convert2CMYK(const ColorPt& in_color, ColorPt& out_color);
301 #endif
302 
309 
315 
316  // Indexed color space methods --------------------------------------------------
317 
325  int GetHighVal();
326 
327 #ifndef SWIG
328 
334  const UChar* GetLookupTable();
335 #endif
336 
345  ColorPt GetBaseColor(UChar color_idx);
346 
347 #ifndef SWIG
348  void GetBaseColor(UChar color_idx, ColorPt& out_color);
349 #endif
350 
351  // Separation of DeviceN color space methods ------------------------------------
352 
360  bool IsNone();
361 
362  // Separation color space methods -----------------------------------------------
363 
369  bool IsAll();
370 
378 
382  void Destroy();
383 
385 #ifndef SWIGHIDDEN
386  ColorSpace(TRN_ColorSpace impl);
387  TRN_ColorSpace mp_cs;
388 #endif
389 };
391 
392 
393 #include <Impl/ColorSpace.inl>
394 
395  }; // namespace PDF
396 }; // namespace pdftron
397 
398 #endif
ColorPt GetBaseColor(UChar color_idx)
void Set(double x=0, double y=0, double z=0, double w=0)
void InitColor(ColorPt &out_colorants)
ColorPt Convert2RGB(const ColorPt &in_color)
ColorSpace & operator=(const ColorSpace &c)
static ColorSpace CreateICC(SDF::SDFDoc &doc, const UString &filepath)
void SetColorantNum(int num)
const UChar * GetLookupTable()
ColorSpace GetBaseColorSpace()
ColorSpace(SDF::Obj color_space=0)
ColorPt Convert2CMYK(const ColorPt &in_color)
TRN_UChar UChar
Definition: BasicTypes.h:12
ColorPt & operator=(const ColorPt &co)
static ColorSpace CreateDeviceGray()
ColorSpace GetAlternateColorSpace()
ColorPt(double x=0, double y=0, double z=0, double w=0)
static ColorSpace CreatePattern()
bool operator==(const ColorPt &co) const
static ColorSpace CreateDeviceCMYK()
double Get(int colorant_index) const
void InitComponentRanges(std::vector< double > &out_decode_low, std::vector< double > &out_decode_range)
ColorPt Convert2Gray(const ColorPt &in_color)
static ColorSpace CreateDeviceRGB()

© 2002-2014 PDFTron Systems Inc.