- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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-2025 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
138 class ColorSpace
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);
168 static ColorSpace CreateICC(SDF::SDFDoc& doc, Filters::Filter stm);
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 {
188 e_device_gray,
189 e_device_rgb,
190 e_device_cmyk,
191 e_cal_gray,
192 e_cal_rgb,
193 e_lab,
194 e_icc,
195 e_indexed,
196 e_pattern,
197 e_separation,
198 e_device_n,
199 e_null
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
313 ColorSpace GetAlternateColorSpace();
314
319 ColorSpace GetBaseColorSpace();
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
382 Function GetTintFunction();
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
pdftron::PDF::Function
Definition: Function.h:28
pdftron::PDF::ColorSpace::GetBaseColor
ColorPt GetBaseColor(UChar color_idx)
pdftron::PDF::ColorSpace::e_device_rgb
Definition: ColorSpace.h:189
pdftron::PDF::ColorPt::Set
void Set(double x=0, double y=0, double z=0, double w=0)
pdftron::PDF::ColorSpace::Destroy
void Destroy()
pdftron::PDF::ColorSpace::e_cal_rgb
Definition: ColorSpace.h:192
pdftron::PDF::ColorSpace::GetComponentNum
int GetComponentNum()
pdftron::PDF::ColorSpace::InitColor
void InitColor(ColorPt &out_colorants)
pdftron::PDF::ColorSpace::e_device_n
Definition: ColorSpace.h:198
pdftron::PDF::ColorPt
Definition: ColorSpace.h:20
pdftron::PDF::ColorSpace
Definition: ColorSpace.h:138
pdftron::PDF::ColorSpace::Type
Type
Definition: ColorSpace.h:186
pdftron::PDF::ColorSpace::e_null
Definition: ColorSpace.h:199
pdftron::PDF::ColorSpace::e_device_gray
Definition: ColorSpace.h:188
pdftron::PDF::ColorSpace::IsAll
bool IsAll()
pdftron::PDF::ColorSpace::Convert2RGB
ColorPt Convert2RGB(const ColorPt &in_color)
pdftron::PDF::ColorSpace::operator=
ColorSpace & operator=(const ColorSpace &c)
pdftron::PDF::ColorSpace::e_cal_gray
Definition: ColorSpace.h:191
pdftron::PDF::ColorSpace::CreateICC
static ColorSpace CreateICC(SDF::SDFDoc &doc, const UString &filepath)
pdftron::PDF::ColorSpace::GetSDFObj
SDF::Obj GetSDFObj()
pdftron::PDF::ColorPt::SetColorantNum
void SetColorantNum(int num)
pdftron::PDF::ColorSpace::IsNone
bool IsNone()
pdftron::PDF::ColorSpace::GetType
Type GetType() const
pdftron::PDF::ColorSpace::GetLookupTable
const UChar * GetLookupTable()
pdftron::PDF::ColorSpace::e_lab
Definition: ColorSpace.h:193
pdftron::PDF::ColorSpace::GetHighVal
int GetHighVal()
pdftron::PDF::ColorSpace::GetBaseColorSpace
ColorSpace GetBaseColorSpace()
pdftron::PDF::ColorSpace::ColorSpace
ColorSpace(SDF::Obj color_space=0)
pdftron::SDF::SDFDoc
Definition: SDFDoc.h:67
pdftron::PDF::ColorSpace::Convert2CMYK
ColorPt Convert2CMYK(const ColorPt &in_color)
pdftron::UChar
TRN_UChar UChar
Definition: BasicTypes.h:12
pdftron::PDF::ColorSpace::e_separation
Definition: ColorSpace.h:197
pdftron::PDF::ColorPt::operator=
ColorPt & operator=(const ColorPt &co)
pdftron::PDF::ColorSpace::CreateDeviceGray
static ColorSpace CreateDeviceGray()
pdftron::PDF::ColorSpace::GetAlternateColorSpace
ColorSpace GetAlternateColorSpace()
pdftron::Filters::Filter
Definition: Filter.h:45
pdftron::PDF::ColorSpace::e_indexed
Definition: ColorSpace.h:195
pdftron::PDF::ColorPt::ColorPt
ColorPt(double x=0, double y=0, double z=0, double w=0)
Common.h
pdftron::PDF::ColorSpace::e_pattern
Definition: ColorSpace.h:196
pdftron::PDF::ColorSpace::CreatePattern
static ColorSpace CreatePattern()
pdftron::PDF::ColorPt::operator==
bool operator==(const ColorPt &co) const
pdftron::PDF::ColorSpace::CreateDeviceCMYK
static ColorSpace CreateDeviceCMYK()
pdftron::PDF::ColorPt::Get
double Get(int colorant_index) const
pdftron::PDF::ColorSpace::InitComponentRanges
void InitComponentRanges(std::vector< double > &out_decode_low, std::vector< double > &out_decode_range)
pdftron::PDF::ColorSpace::e_icc
Definition: ColorSpace.h:194
Function.h
pdftron::PDF::ColorSpace::~ColorSpace
~ColorSpace()
pdftron::PDF::ColorSpace::e_device_cmyk
Definition: ColorSpace.h:190
pdftron::SDF::Obj
Definition: Obj.h:40
pdftron::PDF::ColorPt::Destroy
void Destroy()
pdftron::PDF::ColorSpace::Convert2Gray
ColorPt Convert2Gray(const ColorPt &in_color)
pdftron::PDF::ColorSpace::GetTintFunction
Function GetTintFunction()
pdftron::UString
Definition: UString.h:27
pdftron::PDF::ColorPt::~ColorPt
~ColorPt()
pdftron::PDF::ColorSpace::CreateDeviceRGB
static ColorSpace CreateDeviceRGB()