- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GState.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_CPPPDFGState
6 #define PDFTRON_H_CPPPDFGState
7
8 #include <C/PDF/TRN_GState.h>
9 #include <Common/Matrix2D.h>
10 #include <PDF/ColorSpace.h>
11 #include <PDF/Font.h>
12 #include <PDF/PatternColor.h>
13
14 namespace pdftron {
15 namespace PDF {
16
26 class GState
27 {
28 public:
29
30 GState();
31 GState(const GState& c);
32 GState& operator=(const GState& c);
33
34 // GState properties
35 enum GStateAttribute
36 {
37 e_transform = 0, // General graphics state attributes
38 e_rendering_intent,
39
40 e_stroke_cs,
41 e_stroke_color,
42 e_fill_cs,
43 e_fill_color,
44
45 e_line_width, // Path attributes
46 e_line_cap,
47 e_line_join,
48 e_flatness,
49 e_miter_limit,
50 e_dash_pattern,
51
52 e_char_spacing, // Text attributes
53 e_word_spacing,
54 e_horizontal_scale,
55 e_leading,
56 e_font,
57 e_font_size,
58 e_text_render_mode,
59 e_text_rise,
60 e_text_knockout,
61
62 // Adjusts the text position by a given amount. The attribute can be
63 // accessed through Element interface
64 e_text_pos_offset,
65
66 e_blend_mode, // Extended graphics state attributes
67 e_opacity_fill,
68 e_opacity_stroke,
69 e_alpha_is_shape,
70 e_soft_mask,
71 e_smoothnes,
72 e_auto_stoke_adjust,
73 e_stroke_overprint,
74 e_fill_overprint,
75 e_overprint_mode,
76 e_transfer_funct,
77 e_BG_funct,
78 e_UCR_funct,
79 e_halftone,
80
81 // null attribute
82 e_null
83 };
84
85 // Get Methods ------------------------------------------------------------------
86
92 Common::Matrix2D GetTransform();
93
97 ColorSpace GetStrokeColorSpace();
98
102 ColorSpace GetFillColorSpace();
103
107 ColorPt GetStrokeColor();
108
112 PatternColor GetStrokePattern();
113
117 ColorPt GetFillColor();
118
122 PatternColor GetFillPattern();
123
134 double GetFlatness() const;
135
136
137 enum LineCap
138 {
139 e_butt_cap = 0, // The stroke is squared off at the endpoint of the path.
140 e_round_cap, // A semicircular arc with a diameter equal to the line width.
141 e_square_cap // squared off stroke continues beyond the endpoint of the path.
142 };
143
150 LineCap GetLineCap() const;
151
152
153 enum LineJoin
154 {
155 e_miter_join = 0, // The two segments are extended until they meet
156 e_round_join, // A circle with a diameter equal to the line width
157 e_bevel_join // The two segments are finished with butt caps
158 };
159
166 LineJoin GetLineJoin() const;
167
173 double GetLineWidth() const;
174
182 double GetMiterLimit() const;
183
193 std::vector<double> GetDashes() const;
194
195 #ifndef SWIG
196 void GetDashes(std::vector<double>& dashes) const;
197 #endif
198
203 double GetPhase() const;
204
213 double GetCharSpacing() const;
214
221 double GetWordSpacing() const;
222
232 double GetHorizontalScale() const;
233
241 double GetLeading() const;
242
246 Font GetFont() const;
247
251 double GetFontSize() const;
252
253 enum TextRenderingMode
254 {
255 e_fill_text = 0, // Fill text.
256 e_stroke_text, // Stroke text.
257 e_fill_stroke_text, // Fill, then stroke text.
258 e_invisible_text, // Neither fill nor stroke text (invisible).
259 e_fill_clip_text, // Fill text and add to path for clipping (see above).
260 e_stroke_clip_text, // Stroke text and add to path for clipping.
261 e_fill_stroke_clip_text, // Fill, then stroke text and add to path for clipping.
262 e_clip_text // Add text to path for clipping.
263 };
264
272 TextRenderingMode GetTextRenderMode() const;
273
281 double GetTextRise() const;
282
288 bool IsTextKnockout() const;
289
290 enum RenderingIntent
291 {
292 e_absolute_colorimetric,
293 e_relative_colorimetric,
294 e_saturation,
295 e_perceptual
296 };
297
301 RenderingIntent GetRenderingIntent() const;
302
309 static RenderingIntent GetRenderingIntentType(const char* name);
310
311 // Extended graphics state 'Get' methods ----------------------------------------
312
313 // The standard separable blend modes available in PDF.
314 enum BlendMode
315 {
316 e_bl_compatible = 0,
317 e_bl_normal,
318 e_bl_multiply,
319 e_bl_screen,
320 e_bl_difference,
321 e_bl_darken,
322 e_bl_lighten,
323 e_bl_color_dodge,
324 e_bl_color_burn,
325 e_bl_exclusion,
326 e_bl_hard_light,
327 e_bl_overlay,
328 e_bl_soft_light,
329 e_bl_luminosity,
330 e_bl_hue,
331 e_bl_saturation,
332 e_bl_color
333 };
334
339 BlendMode GetBlendMode();
340
346 double GetFillOpacity() const;
347
353 double GetStrokeOpacity() const;
354
360 bool GetAISFlag() const;
361
366 SDF::Obj GetSoftMask();
367
374 Common::Matrix2D GetSoftMaskTransform();
375
380 bool GetStrokeOverprint() const;
381
386 bool GetFillOverprint() const;
387
392 int GetOverprintMode() const;
393
398 bool GetAutoStrokeAdjust() const;
399
406 double GetSmoothnessTolerance() const;
407
414 SDF::Obj GetTransferFunct();
415
421 SDF::Obj GetBlackGenFunct();
422
428 SDF::Obj GetUCRFunct();
429
436 SDF::Obj GetHalftone();
437
438 // Set Methods ------------------------------------------------------------------
439
448 void SetTransform(const Common::Matrix2D& mtx);
449
468 void SetTransform(double a, double b, double c, double d, double h, double v);
469
474 void Concat(const Common::Matrix2D& mtx);
485 void Concat(double a, double b, double c, double d, double h, double v);
486
491 void SetStrokeColorSpace(ColorSpace cs);
492
497 void SetFillColorSpace(ColorSpace cs);
498
505 void SetStrokeColor(const ColorPt& c);
506
512 void SetStrokeColor(PatternColor pattern);
513
520 void SetStrokeColor(PatternColor pattern, const ColorPt& c);
521
528 void SetFillColor(const ColorPt& c);
529
535 void SetFillColor(PatternColor pattern);
536
543 void SetFillColor(PatternColor pattern, const ColorPt& c);
544
555 void SetFlatness(double flatness);
556
563 void SetLineCap(LineCap cap);
564
571 void SetLineJoin(LineJoin join);
572
579 void SetLineWidth(double width);
580
587 void SetMiterLimit(double miter_limit);
588
597 void SetDashPattern(const std::vector<double>& dash_array, double phase);
598
606 void SetCharSpacing(double char_spacing);
607
614 void SetWordSpacing(double word_spacing);
615
625 void SetHorizontalScale(double hscale);
626
635 void SetLeading(double leading);
636
642 void SetFont(Font font, double font_sz);
643
650 void SetTextRenderMode(TextRenderingMode rmode);
651
659 void SetTextRise(double rise);
660
666 void SetTextKnockout(bool knockout);
667
671 void SetRenderingIntent(RenderingIntent intent);
672
673 // Extended graphics state 'Set' methods ----------------------------------------
674
688 void SetBlendMode(BlendMode BM);
689
695 void SetFillOpacity(double ca);
696
702 void SetStrokeOpacity(double ca);
703
711 void SetAISFlag(bool AIS);
712
718 void SetSoftMask(SDF::Obj SM);
719
725 void SetStrokeOverprint(bool OP);
726
732 void SetFillOverprint(bool op);
733
739 void SetOverprintMode(int OPM);
740
746 void SetAutoStrokeAdjust(bool SA);
747
753 void SetSmoothnessTolerance(double SM);
754
761 void SetBlackGenFunct(SDF::Obj BG);
762
769 void SetUCRFunct(SDF::Obj UCR);
770
778 void SetTransferFunct(SDF::Obj TR);
779
787 void SetHalftone(SDF::Obj HT);
788
789 // @cond PRIVATE_DOC
790 #ifndef SWIGHIDDEN
791 GState(TRN_GState impl);
792 TRN_GState mp_state;
793 #endif
794 // @endcond
795 };
796
797
798 #include <Impl/GState.inl>
799
800 }; // namespace PDF
801 }; // namespace pdftron
802
803
804
805 // @cond PRIVATE_DOC
806 #ifndef SWIGHIDDEN
807 #ifdef _WIN32
808 // A forward declaration for GDI+
809 namespace Gdiplus { class Bitmap; };
810 #endif
811 #endif
812 // @endcond
813
814 #endif // PDFTRON_H_CPPPDFGState
pdftron::PDF::GState::e_smoothnes
Definition: GState.h:71
pdftron::PDF::GState::SetSoftMask
void SetSoftMask(SDF::Obj SM)
pdftron::PDF::GState::e_stroke_text
Definition: GState.h:256
pdftron::PDF::GState::GetHorizontalScale
double GetHorizontalScale() const
pdftron::PDF::GState::e_font_size
Definition: GState.h:57
pdftron::PDF::GState::SetLeading
void SetLeading(double leading)
pdftron::PDF::GState::SetHalftone
void SetHalftone(SDF::Obj HT)
pdftron::PDF::GState::GStateAttribute
GStateAttribute
Definition: GState.h:35
pdftron::PDF::GState::e_bl_color_burn
Definition: GState.h:324
pdftron::PDF::GState::e_bl_luminosity
Definition: GState.h:329
pdftron::PDF::GState::e_bl_exclusion
Definition: GState.h:325
pdftron::PDF::GState::GetFillPattern
PatternColor GetFillPattern()
pdftron::PDF::GState::GetLeading
double GetLeading() const
pdftron::PDF::GState::IsTextKnockout
bool IsTextKnockout() const
pdftron::PDF::GState::GetSoftMask
SDF::Obj GetSoftMask()
pdftron::PDF::GState::e_transfer_funct
Definition: GState.h:76
pdftron::PDF::GState::e_miter_join
Definition: GState.h:155
pdftron::PDF::GState::SetStrokeColorSpace
void SetStrokeColorSpace(ColorSpace cs)
pdftron::PDF::GState::SetCharSpacing
void SetCharSpacing(double char_spacing)
pdftron::PDF::GState::e_bl_soft_light
Definition: GState.h:328
pdftron::PDF::GState::e_stroke_cs
Definition: GState.h:40
pdftron::PDF::GState::e_invisible_text
Definition: GState.h:258
pdftron::PDF::GState::e_bl_saturation
Definition: GState.h:331
pdftron::PDF::GState::e_dash_pattern
Definition: GState.h:50
pdftron::PDF::GState::GetDashes
std::vector< double > GetDashes() const
pdftron::PDF::ColorPt
Definition: ColorSpace.h:20
pdftron::PDF::ColorSpace
Definition: ColorSpace.h:138
pdftron::PDF::GState::e_text_rise
Definition: GState.h:59
pdftron::PDF::GState::GetSmoothnessTolerance
double GetSmoothnessTolerance() const
pdftron::PDF::GState::e_butt_cap
Definition: GState.h:139
pdftron::PDF::GState::SetAISFlag
void SetAISFlag(bool AIS)
pdftron::PDF::GState::SetTextRise
void SetTextRise(double rise)
pdftron::PDF::GState::e_soft_mask
Definition: GState.h:70
pdftron::PDF::GState::GetRenderingIntent
RenderingIntent GetRenderingIntent() const
pdftron::PDF::GState::e_font
Definition: GState.h:56
pdftron::PDF::GState::e_bl_multiply
Definition: GState.h:318
pdftron::PDF::GState::GetTransferFunct
SDF::Obj GetTransferFunct()
pdftron::PDF::GState::e_absolute_colorimetric
Definition: GState.h:292
pdftron::PDF::GState::GetRenderingIntentType
static RenderingIntent GetRenderingIntentType(const char *name)
pdftron::PDF::GState::e_char_spacing
Definition: GState.h:52
pdftron::PDF::GState::GetFillColorSpace
ColorSpace GetFillColorSpace()
pdftron::PDF::GState::SetSmoothnessTolerance
void SetSmoothnessTolerance(double SM)
pdftron::PDF::GState::GetFlatness
double GetFlatness() const
pdftron::PDF::GState::GetLineCap
LineCap GetLineCap() const
pdftron::PDF::GState::e_bl_color
Definition: GState.h:332
pdftron::PDF::GState
Definition: GState.h:26
pdftron::PDF::GState::e_bl_compatible
Definition: GState.h:316
pdftron::PDF::GState::SetTextRenderMode
void SetTextRenderMode(TextRenderingMode rmode)
Matrix2D.h
pdftron::PDF::GState::GetLineWidth
double GetLineWidth() const
pdftron::PDF::GState::GetTransform
Common::Matrix2D GetTransform()
pdftron::PDF::PatternColor
Definition: PatternColor.h:42
pdftron::PDF::GState::GetBlendMode
BlendMode GetBlendMode()
pdftron::PDF::GState::GetCharSpacing
double GetCharSpacing() const
pdftron::PDF::GState::e_bl_screen
Definition: GState.h:319
pdftron::PDF::GState::GetHalftone
SDF::Obj GetHalftone()
ColorSpace.h
pdftron::PDF::GState::GetFillOverprint
bool GetFillOverprint() const
pdftron::PDF::GState::e_word_spacing
Definition: GState.h:53
pdftron::PDF::GState::SetLineJoin
void SetLineJoin(LineJoin join)
pdftron::PDF::GState::SetLineCap
void SetLineCap(LineCap cap)
pdftron::PDF::GState::SetTransferFunct
void SetTransferFunct(SDF::Obj TR)
pdftron::PDF::GState::SetStrokeColor
void SetStrokeColor(const ColorPt &c)
pdftron::PDF::GState::e_perceptual
Definition: GState.h:295
pdftron::PDF::GState::GetStrokeColor
ColorPt GetStrokeColor()
pdftron::PDF::GState::e_UCR_funct
Definition: GState.h:78
pdftron::PDF::GState::e_relative_colorimetric
Definition: GState.h:293
pdftron::PDF::GState::SetStrokeOpacity
void SetStrokeOpacity(double ca)
pdftron::PDF::GState::e_stroke_color
Definition: GState.h:41
pdftron::PDF::GState::SetBlendMode
void SetBlendMode(BlendMode BM)
pdftron::PDF::GState::e_BG_funct
Definition: GState.h:77
pdftron::PDF::GState::SetFillColorSpace
void SetFillColorSpace(ColorSpace cs)
pdftron::PDF::GState::e_round_cap
Definition: GState.h:140
pdftron::PDF::GState::GetSoftMaskTransform
Common::Matrix2D GetSoftMaskTransform()
pdftron::PDF::GState::e_text_knockout
Definition: GState.h:60
pdftron::PDF::GState::SetHorizontalScale
void SetHorizontalScale(double hscale)
pdftron::PDF::GState::GetStrokeColorSpace
ColorSpace GetStrokeColorSpace()
pdftron::PDF::GState::BlendMode
BlendMode
Definition: GState.h:314
pdftron::PDF::GState::e_fill_overprint
Definition: GState.h:74
pdftron::PDF::GState::GetPhase
double GetPhase() const
pdftron::PDF::GState::e_rendering_intent
Definition: GState.h:38
pdftron::PDF::GState::SetStrokeOverprint
void SetStrokeOverprint(bool OP)
pdftron::PDF::GState::GetAISFlag
bool GetAISFlag() const
pdftron::PDF::GState::e_alpha_is_shape
Definition: GState.h:69
pdftron::PDF::GState::GetMiterLimit
double GetMiterLimit() const
pdftron::PDF::GState::e_miter_limit
Definition: GState.h:49
pdftron::PDF::GState::LineJoin
LineJoin
Definition: GState.h:153
pdftron::PDF::GState::SetOverprintMode
void SetOverprintMode(int OPM)
pdftron::PDF::GState::Concat
void Concat(const Common::Matrix2D &mtx)
pdftron::PDF::GState::e_null
Definition: GState.h:82
pdftron::PDF::GState::e_text_render_mode
Definition: GState.h:58
pdftron::Common::Matrix2D
Definition: Matrix2D.h:103
pdftron::PDF::GState::e_fill_color
Definition: GState.h:43
pdftron::PDF::GState::SetBlackGenFunct
void SetBlackGenFunct(SDF::Obj BG)
pdftron::PDF::GState::RenderingIntent
RenderingIntent
Definition: GState.h:290
pdftron::PDF::GState::e_bl_normal
Definition: GState.h:317
pdftron::PDF::GState::SetTextKnockout
void SetTextKnockout(bool knockout)
pdftron::PDF::GState::SetFlatness
void SetFlatness(double flatness)
pdftron::PDF::GState::e_auto_stoke_adjust
Definition: GState.h:72
pdftron::PDF::GState::GState
GState()
pdftron::PDF::GState::GetOverprintMode
int GetOverprintMode() const
pdftron::PDF::GState::SetFillColor
void SetFillColor(const ColorPt &c)
pdftron::PDF::GState::SetTransform
void SetTransform(const Common::Matrix2D &mtx)
pdftron::PDF::GState::GetFillOpacity
double GetFillOpacity() const
pdftron::PDF::Font
Definition: Font.h:55
pdftron::PDF::GState::e_fill_stroke_clip_text
Definition: GState.h:261
pdftron::PDF::GState::e_bl_difference
Definition: GState.h:320
pdftron::PDF::GState::SetUCRFunct
void SetUCRFunct(SDF::Obj UCR)
pdftron::PDF::GState::GetTextRise
double GetTextRise() const
Font.h
pdftron::PDF::GState::e_line_cap
Definition: GState.h:46
pdftron::PDF::GState::e_fill_text
Definition: GState.h:255
pdftron::PDF::GState::e_saturation
Definition: GState.h:294
pdftron::PDF::GState::e_line_width
Definition: GState.h:45
pdftron::PDF::GState::e_transform
Definition: GState.h:37
pdftron::PDF::GState::SetLineWidth
void SetLineWidth(double width)
pdftron::PDF::GState::GetUCRFunct
SDF::Obj GetUCRFunct()
pdftron::PDF::GState::e_bl_lighten
Definition: GState.h:322
pdftron::PDF::GState::e_bevel_join
Definition: GState.h:157
pdftron::PDF::GState::GetLineJoin
LineJoin GetLineJoin() const
pdftron::PDF::GState::GetWordSpacing
double GetWordSpacing() const
pdftron::PDF::GState::e_fill_clip_text
Definition: GState.h:259
pdftron::PDF::GState::e_clip_text
Definition: GState.h:262
pdftron::PDF::GState::e_stroke_clip_text
Definition: GState.h:260
pdftron::PDF::GState::e_blend_mode
Definition: GState.h:66
pdftron::PDF::GState::e_leading
Definition: GState.h:55
pdftron::PDF::GState::e_stroke_overprint
Definition: GState.h:73
pdftron::PDF::GState::e_opacity_stroke
Definition: GState.h:68
pdftron::PDF::GState::GetStrokePattern
PatternColor GetStrokePattern()
pdftron::PDF::GState::e_text_pos_offset
Definition: GState.h:64
pdftron::PDF::GState::SetRenderingIntent
void SetRenderingIntent(RenderingIntent intent)
pdftron::PDF::GState::e_fill_stroke_text
Definition: GState.h:257
pdftron::PDF::GState::TextRenderingMode
TextRenderingMode
Definition: GState.h:253
PatternColor.h
pdftron::PDF::GState::e_opacity_fill
Definition: GState.h:67
pdftron::PDF::GState::operator=
GState & operator=(const GState &c)
pdftron::PDF::GState::e_halftone
Definition: GState.h:79
pdftron::PDF::GState::SetFont
void SetFont(Font font, double font_sz)
pdftron::PDF::GState::GetAutoStrokeAdjust
bool GetAutoStrokeAdjust() const
pdftron::PDF::GState::GetTextRenderMode
TextRenderingMode GetTextRenderMode() const
pdftron::PDF::GState::SetMiterLimit
void SetMiterLimit(double miter_limit)
pdftron::PDF::GState::e_horizontal_scale
Definition: GState.h:54
pdftron::PDF::GState::GetFont
Font GetFont() const
pdftron::PDF::GState::e_bl_color_dodge
Definition: GState.h:323
pdftron::PDF::GState::e_bl_hue
Definition: GState.h:330
pdftron::PDF::GState::e_fill_cs
Definition: GState.h:42
pdftron::PDF::GState::e_bl_overlay
Definition: GState.h:327
pdftron::PDF::GState::e_round_join
Definition: GState.h:156
pdftron::PDF::GState::e_bl_darken
Definition: GState.h:321
pdftron::PDF::GState::SetAutoStrokeAdjust
void SetAutoStrokeAdjust(bool SA)
pdftron::SDF::Obj
Definition: Obj.h:40
pdftron::PDF::GState::e_overprint_mode
Definition: GState.h:75
pdftron::PDF::GState::e_line_join
Definition: GState.h:47
pdftron::PDF::GState::SetWordSpacing
void SetWordSpacing(double word_spacing)
pdftron::PDF::GState::e_square_cap
Definition: GState.h:141
pdftron::PDF::GState::GetFontSize
double GetFontSize() const
pdftron::PDF::GState::e_flatness
Definition: GState.h:48
pdftron::PDF::GState::SetFillOpacity
void SetFillOpacity(double ca)
pdftron::PDF::GState::GetFillColor
ColorPt GetFillColor()
pdftron::PDF::GState::e_bl_hard_light
Definition: GState.h:326
pdftron::PDF::GState::GetBlackGenFunct
SDF::Obj GetBlackGenFunct()
pdftron::PDF::GState::SetFillOverprint
void SetFillOverprint(bool op)
pdftron::PDF::GState::GetStrokeOpacity
double GetStrokeOpacity() const
pdftron::PDF::GState::GetStrokeOverprint
bool GetStrokeOverprint() const
pdftron::PDF::GState::SetDashPattern
void SetDashPattern(const std::vector< double > &dash_array, double phase)
pdftron::PDF::GState::LineCap
LineCap
Definition: GState.h:137