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-2023 by Apryse Software 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 
33  explicit ColorPt(double x = 0, double y = 0, double z = 0, double w = 0);
34  ColorPt(const ColorPt& co);
38  ~ColorPt();
39 
40  ColorPt& operator= (const ColorPt& co);
41  bool operator== (const ColorPt& co) const;
42 
55  void Set(double x = 0, double y = 0, double z = 0, double w = 0);
56 
84  void Set(int colorant_index, double colorant_value);
85 
99  double Get(int colorant_index) const;
100 
108  void SetColorantNum(int num);
109 
113  void Destroy();
114 
115 // @cond PRIVATE_DOC
116 #ifndef SWIGHIDDEN
117  TRN_ColorPt m_c;
118 #endif
119 // @endcond
120 };
121 
122 
139 {
140 public:
141 
142  // Common ColorSpace methods ----------------------------------------------------
143 
147  static ColorSpace CreateDeviceGray();
148 
152  static ColorSpace CreateDeviceRGB();
153 
157  static ColorSpace CreateDeviceCMYK();
158 
162  static ColorSpace CreatePattern();
163 
167  static ColorSpace CreateICC(SDF::SDFDoc& doc, const UString& filepath);
169  static ColorSpace CreateICC(SDF::SDFDoc& doc, const UChar* buf, size_t buf_sz);
170 
177  ColorSpace (SDF::Obj color_space = 0);
178  ColorSpace(const ColorSpace& c);
179  ColorSpace& operator=(const ColorSpace& c);
180 
184  ~ColorSpace();
185 
186  enum Type
187  {
200  };
201 
202  // Common Static/Global methods ----------------------------------------------------
203 
204 #ifndef SWIG
205 
212  static int GetComponentNum(Type cs_type, SDF::Obj cs);
213 
220  static Type GetType(SDF::Obj cs);
221 #endif
222 
226  Type GetType() const;
227 
231  SDF::Obj GetSDFObj ();
232 
237  int GetComponentNum();
238 
244  void InitColor(ColorPt& out_colorants);
245 
258  void InitComponentRanges(std::vector<double>& out_decode_low, std::vector<double>& out_decode_range);
259 
270  ColorPt Convert2Gray(const ColorPt& in_color);
271 
272 #ifndef SWIG
273  void Convert2Gray(const ColorPt& in_color, ColorPt& out_color);
274 #endif
275 
286  ColorPt Convert2RGB(const ColorPt& in_color);
287 
288 #ifndef SWIG
289  void Convert2RGB(const ColorPt& in_color, ColorPt& out_color);
290 #endif
291 
302  ColorPt Convert2CMYK(const ColorPt& in_color);
303 
304 #ifndef SWIG
305  void Convert2CMYK(const ColorPt& in_color, ColorPt& out_color);
306 #endif
307 
314 
320 
321  // Indexed color space methods --------------------------------------------------
322 
330  int GetHighVal();
331 
332 #ifndef SWIG
333 
339  const UChar* GetLookupTable();
340 #endif
341 
350  ColorPt GetBaseColor(UChar color_idx);
351 
352 #ifndef SWIG
353  void GetBaseColor(UChar color_idx, ColorPt& out_color);
354 #endif
355 
356  // Separation of DeviceN color space methods ------------------------------------
357 
365  bool IsNone();
366 
367  // Separation color space methods -----------------------------------------------
368 
374  bool IsAll();
375 
383 
387  void Destroy();
388 
389 // @cond PRIVATE_DOC
390 #ifndef SWIGHIDDEN
391  ColorSpace(TRN_ColorSpace impl);
392  TRN_ColorSpace mp_cs;
393 #endif
394 // @endcond
395 };
396 
397 
398 #include <Impl/ColorSpace.inl>
399 
400  }; // namespace PDF
401 }; // namespace pdftron
402 
403 #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()