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 #include <PDF/PatternColor.h>
00014
00015 namespace pdftron {
00016 namespace PDF {
00017
00027 class GState
00028 {
00029 public:
00030
00031 GState();
00032 GState(const GState& c);
00033 GState& operator=(const GState& c);
00034
00035
00036 enum GStateAttribute
00037 {
00038 e_transform = 0,
00039 e_rendering_intent,
00040
00041 e_stroke_cs,
00042 e_stroke_color,
00043 e_fill_cs,
00044 e_fill_color,
00045
00046 e_line_width,
00047 e_line_cap,
00048 e_line_join,
00049 e_flatness,
00050 e_miter_limit,
00051 e_dash_pattern,
00052
00053 e_char_spacing,
00054 e_word_spacing,
00055 e_horizontal_scale,
00056 e_leading,
00057 e_font,
00058 e_font_size,
00059 e_text_render_mode,
00060 e_text_rise,
00061 e_text_knockout,
00062
00063
00064
00065 e_text_pos_offset,
00066
00067 e_blend_mode,
00068 e_opacity_fill,
00069 e_opacity_stroke,
00070 e_alpha_is_shape,
00071 e_soft_mask,
00072 e_smoothnes,
00073 e_auto_stoke_adjust,
00074 e_stroke_overprint,
00075 e_fill_overprint,
00076 e_overprint_mode,
00077 e_transfer_funct,
00078 e_BG_funct,
00079 e_UCR_funct,
00080 e_halftone,
00081
00082
00083 e_null
00084 };
00085
00086
00087
00093 Common::Matrix2D GetTransform();
00094
00098 ColorSpace GetStrokeColorSpace();
00099
00103 ColorSpace GetFillColorSpace();
00104
00108 ColorPt GetStrokeColor();
00109
00113 PatternColor GetStrokePattern();
00114
00118 ColorPt GetFillColor();
00119
00123 PatternColor GetFillPattern();
00124
00135 double GetFlatness() const;
00136
00137
00138 enum LineCap
00139 {
00140 e_butt_cap = 0,
00141 e_round_cap,
00142 e_square_cap
00143 };
00144
00151 LineCap GetLineCap() const;
00152
00153
00154 enum LineJoin
00155 {
00156 e_miter_join = 0,
00157 e_round_join,
00158 e_bevel_join
00159 };
00160
00167 LineJoin GetLineJoin() const;
00168
00174 double GetLineWidth() const;
00175
00183 double GetMiterLimit() const;
00184
00194 void GetDashes(std::vector<double>& dashes) const;
00195
00200 double GetPhase() const;
00201
00210 double GetCharSpacing() const;
00211
00218 double GetWordSpacing() const;
00219
00229 double GetHorizontalScale() const;
00230
00238 double GetLeading() const;
00239
00243 Font GetFont() const;
00244
00248 double GetFontSize() const;
00249
00250 enum TextRenderingMode
00251 {
00252 e_fill_text = 0,
00253 e_stroke_text,
00254 e_fill_stroke_text,
00255 e_invisible_text,
00256 e_fill_clip_text,
00257 e_stroke_clip_text,
00258 e_fill_stroke_clip_text,
00259 e_clip_text
00260 };
00261
00269 TextRenderingMode GetTextRenderMode() const;
00270
00278 double GetTextRise() const;
00279
00285 bool IsTextKnockout() const;
00286
00287 enum RenderingIntent
00288 {
00289 e_absolute_colorimetric,
00290 e_relative_colorimetric,
00291 e_saturation,
00292 e_perceptual
00293 };
00294
00298 RenderingIntent GetRenderingIntent() const;
00299
00306 static RenderingIntent GetRenderingIntentType(const char* name);
00307
00308
00309
00310
00311 enum BlendMode
00312 {
00313 e_bl_compatible = 0,
00314 e_bl_normal,
00315 e_bl_multiply,
00316 e_bl_screen,
00317 e_bl_difference,
00318 e_bl_darken,
00319 e_bl_lighten,
00320 e_bl_color_dodge,
00321 e_bl_color_burn,
00322 e_bl_exclusion,
00323 e_bl_hard_light,
00324 e_bl_overlay,
00325 e_bl_soft_light,
00326 e_bl_luminosity,
00327 e_bl_hue,
00328 e_bl_saturation,
00329 e_bl_color
00330 };
00331
00336 BlendMode GetBlendMode();
00337
00343 double GetFillOpacity() const;
00344
00350 double GetStrokeOpacity() const;
00351
00357 bool GetAISFlag() const;
00358
00363 SDF::Obj GetSoftMask();
00364
00369 bool GetStrokeOverprint() const;
00370
00375 bool GetFillOverprint() const;
00376
00381 int GetOverprintMode() const;
00382
00387 bool GetAutoStrokeAdjust() const;
00388
00395 double GetSmoothnessTolerance() const;
00396
00403 SDF::Obj GetTransferFunct();
00404
00410 SDF::Obj GetBlackGenFunct();
00411
00417 SDF::Obj GetUCRFunct();
00418
00425 SDF::Obj GetHalftone();
00426
00427
00428
00437 void SetTransform(const Common::Matrix2D& mtx);
00438
00458 void SetTransform(double a, double b, double c, double d, double h, double v);
00459
00463 void Concat(const Common::Matrix2D& mtx);
00464 void Concat(double a, double b, double c, double d, double h, double v);
00465
00469 void SetStrokeColorSpace(ColorSpace cs);
00470
00474 void SetFillColorSpace(ColorSpace cs);
00475
00481 void SetStrokeColor(const ColorPt& c);
00482
00488 void SetStrokeColor(PatternColor pattern);
00489
00496 void SetStrokeColor(PatternColor pattern, const ColorPt& c);
00497
00503 void SetFillColor(const ColorPt& c);
00504
00510 void SetFillColor(PatternColor pattern);
00511
00518 void SetFillColor(PatternColor pattern, const ColorPt& c);
00519
00530 void SetFlatness(double flatness);
00531
00537 void SetLineCap(LineCap cap);
00538
00545 void SetLineJoin(LineJoin join);
00546
00553 void SetLineWidth(double width);
00554
00561 void SetMiterLimit(double miter_limit);
00562
00572 void SetDashPattern(const std::vector<double>& dash_array, double phase);
00573
00581 void SetCharSpacing(double char_spacing);
00582
00589 void SetWordSpacing(double word_spacing);
00590
00599 void SetHorizontalScale(double hscale);
00600
00608 void SetLeading(double leading);
00609
00613 void SetFont(Font font, double font_sz);
00614
00621 void SetTextRenderMode(TextRenderingMode rmode);
00622
00629 void SetTextRise(double rise);
00630
00635 void SetTextKnockout(bool knockout);
00636
00640 void SetRenderingIntent(RenderingIntent intent);
00641
00642
00643
00657 void SetBlendMode(BlendMode BM);
00658
00663 void SetFillOpacity(double ca);
00664
00669 void SetStrokeOpacity(double CA);
00670
00677 void SetAISFlag(bool AIS);
00678
00684 void SetSoftMask(SDF::Obj SM);
00685
00690 void SetStrokeOverprint(bool OP);
00691
00696 void SetFillOverprint(bool op);
00697
00702 void SetOverprintMode(int OPM);
00703
00708 void SetAutoStrokeAdjust(bool SA);
00709
00714 void SetSmoothnessTolerance(double SM);
00715
00722 void SetBlackGenFunct(SDF::Obj BG);
00723
00730 void SetUCRFunct(SDF::Obj UCR);
00731
00739 void SetTransferFunct(SDF::Obj TR);
00740
00748 void SetHalftone(SDF::Obj HT);
00749
00751 GState(TRN_GState impl);
00752 TRN_GState mp_state;
00754 };
00755
00756
00757 #include <Impl/GState.inl>
00758
00759 };
00760 };
00761
00762
00763
00765 #ifdef _WIN32
00766
00767 namespace Gdiplus { class Bitmap; };
00768 #endif
00770
00771 #endif
00772
00773