00001
00002
00003
00004
00005
00006 #ifndef H_CPPPDFGState
00007 #define H_CPPPDFGState
00008
00009 #include <C/PDF/TRN_GState.h>
00010 #include <Common/Matrix2D.h>
00011 #include <PDF/ColorSpace.h>
00012 #include <PDF/Font.h>
00013
00014 namespace pdftron {
00015 namespace PDF {
00016
00026 class GState
00027 {
00028 public:
00029
00030 GState();
00031 GState(const GState& c);
00032 GState& operator=(const GState& c);
00033
00034
00035 enum GStateAttribute
00036 {
00037 e_transform = 0,
00038 e_rendering_intent,
00039
00040 e_stroke_cs,
00041 e_stroke_color,
00042 e_fill_cs,
00043 e_fill_color,
00044
00045 e_line_width,
00046 e_line_cap,
00047 e_line_join,
00048 e_flatness,
00049 e_miter_limit,
00050 e_dash_pattern,
00051
00052 e_char_spacing,
00053 e_word_spacing,
00054 e_horizontal_scale,
00055 e_leading,
00056 e_font,
00057 e_font_size,
00058 e_text_render_mode,
00059 e_text_rise,
00060 e_text_knockout,
00061
00062
00063
00064 e_text_pos_offset,
00065
00066 e_blend_mode,
00067 e_opacity_fill,
00068 e_opacity_stroke,
00069 e_alpha_is_shape,
00070 e_soft_mask,
00071 e_smoothnes,
00072 e_auto_stoke_adjust,
00073 e_stroke_overprint,
00074 e_fill_overprint,
00075 e_overprint_mode,
00076 e_transfer_funct,
00077 e_BG_funct,
00078 e_UCR_funct,
00079 e_halftone,
00080
00081
00082 e_null
00083 };
00084
00085
00086
00092 Common::Matrix2D GetTransform();
00093
00097 ColorSpace GetStrokeColorSpace();
00098
00102 ColorSpace GetFillColorSpace();
00103
00107 ColorPt GetStrokeColor();
00108
00112 SDF::Obj GetStrokePattern();
00113
00117 ColorPt GetFillColor();
00118
00122 SDF::Obj GetFillPattern();
00123
00134 double GetFlatness() const;
00135
00136
00137 enum LineCap
00138 {
00139 e_butt_cap = 0,
00140 e_round_cap,
00141 e_square_cap
00142 };
00143
00150 LineCap GetLineCap() const;
00151
00152
00153 enum LineJoin
00154 {
00155 e_miter_join = 0,
00156 e_round_join,
00157 e_bevel_join
00158 };
00159
00166 LineJoin GetLineJoin() const;
00167
00173 double GetLineWidth() const;
00174
00182 double GetMiterLimit() const;
00183
00193 void GetDashes(std::vector<double>& dashes) const;
00194
00199 double GetPhase() const;
00200
00209 double GetCharSpacing() const;
00210
00217 double GetWordSpacing() const;
00218
00228 double GetHorizontalScale() const;
00229
00237 double GetLeading() const;
00238
00242 Font GetFont() const;
00243
00247 double GetFontSize() const;
00248
00249 enum TextRenderingMode
00250 {
00251 e_fill_text = 0,
00252 e_stroke_text,
00253 e_fill_stroke_text,
00254 e_invisible_text,
00255 e_fill_clip_text,
00256 e_stroke_clip_text,
00257 e_fill_stroke_clip_text,
00258 e_clip_text
00259 };
00260
00268 TextRenderingMode GetTextRenderMode() const;
00269
00277 double GetTextRise() const;
00278
00284 bool IsTextKnockout() const;
00285
00286 enum RenderingIntent
00287 {
00288 e_absolute_colorimetric,
00289 e_relative_colorimetric,
00290 e_saturation,
00291 e_perceptual
00292 };
00293
00297 RenderingIntent GetRenderingIntent() const;
00298
00305 static RenderingIntent GetRenderingIntentType(const char* name);
00306
00307
00308
00309
00310 enum BlendMode
00311 {
00312 e_bl_compatible = 0,
00313 e_bl_normal,
00314 e_bl_multiply,
00315 e_bl_screen,
00316 e_bl_difference,
00317 e_bl_darken,
00318 e_bl_lighten,
00319 e_bl_color_dodge,
00320 e_bl_color_burn,
00321 e_bl_exclusion,
00322 e_bl_hard_light,
00323 e_bl_overlay,
00324 e_bl_soft_light,
00325 e_bl_luminosity,
00326 e_bl_hue,
00327 e_bl_saturation,
00328 e_bl_color
00329 };
00330
00335 BlendMode GetBlendMode();
00336
00342 double GetFillOpacity() const;
00343
00349 double GetStrokeOpacity() const;
00350
00356 bool GetAISFlag() const;
00357
00362 SDF::Obj GetSoftMask();
00363
00368 bool GetStrokeOverprint() const;
00369
00374 bool GetFillOverprint() const;
00375
00380 int GetOverprintMode() const;
00381
00386 bool GetAutoStrokeAdjust() const;
00387
00394 double GetSmoothnessTolerance() const;
00395
00402 SDF::Obj GetTransferFunct();
00403
00409 SDF::Obj GetBlackGenFunct();
00410
00416 SDF::Obj GetUCRFunct();
00417
00424 SDF::Obj GetHalftone();
00425
00426
00427
00436 void SetTransform(const Common::Matrix2D& mtx);
00437
00457 void SetTransform(double a, double b, double c, double d, double h, double v);
00458
00462 void Concat(const Common::Matrix2D& mtx);
00463 void Concat(double a, double b, double c, double d, double h, double v);
00464
00468 void SetStrokeColorSpace(ColorSpace cs);
00469
00473 void SetFillColorSpace(ColorSpace cs);
00474
00480 void SetStrokeColor(const ColorPt& c);
00481
00487 void SetStrokeColor(SDF::Obj pattern);
00488
00495 void SetStrokeColor(SDF::Obj pattern, const ColorPt& c);
00496
00502 void SetFillColor(const ColorPt& c);
00503
00509 void SetFillColor(SDF::Obj pattern);
00510
00517 void SetFillColor(SDF::Obj pattern, const ColorPt& c);
00518
00529 void SetFlatness(double flatness);
00530
00536 void SetLineCap(LineCap cap);
00537
00544 void SetLineJoin(LineJoin join);
00545
00552 void SetLineWidth(double width);
00553
00560 void SetMiterLimit(double miter_limit);
00561
00571 void SetDashPattern(const std::vector<double>& dash_array, double phase);
00572
00580 void SetCharSpacing(double char_spacing);
00581
00588 void SetWordSpacing(double word_spacing);
00589
00598 void SetHorizontalScale(double hscale);
00599
00607 void SetLeading(double leading);
00608
00612 void SetFont(Font font, double font_sz);
00613
00620 void SetTextRenderMode(TextRenderingMode rmode);
00621
00628 void SetTextRise(double rise);
00629
00634 void SetTextKnockout(bool knockout);
00635
00639 void SetRenderingIntent(RenderingIntent intent);
00640
00641
00642
00656 void SetBlendMode(BlendMode BM);
00657
00662 void SetFillOpacity(double ca);
00663
00668 void SetStrokeOpacity(double CA);
00669
00676 void SetAISFlag(bool AIS);
00677
00683 void SetSoftMask(SDF::Obj SM);
00684
00689 void SetStrokeOverprint(bool OP);
00690
00695 void SetFillOverprint(bool op);
00696
00701 void SetOverprintMode(int OPM);
00702
00707 void SetAutoStrokeAdjust(bool SA);
00708
00713 void SetSmoothnessTolerance(double SM);
00714
00721 void SetBlackGenFunct(SDF::Obj BG);
00722
00729 void SetUCRFunct(SDF::Obj UCR);
00730
00738 void SetTransferFunct(SDF::Obj TR);
00739
00747 void SetHalftone(SDF::Obj HT);
00748
00750 GState(TRN_GState impl);
00751 TRN_GState mp_state;
00753 };
00754
00755
00756 #include <Impl/GState.inl>
00757
00758 };
00759 };
00760
00761
00762
00764 #ifdef _WIN32
00765
00766 namespace Gdiplus { class Bitmap; };
00767 #endif
00769
00770 #endif
00771
00772