All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PDFRasterizer.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2019 by PDFTron Systems Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPPDFRasterizer
6 #define PDFTRON_H_CPPPDFRasterizer
7 
8 #include <PDF/PDFDoc.h>
9 #include <PDF/Page.h>
10 #include <C/PDF/TRN_PDFRasterizer.h>
11 #include <PDF/OCG/Context.h>
12 #ifdef SWIG
13 #include <PDF/Callback.h>
14 #endif
15 #include <C/Common/TRN_Types.h>
16 
17 namespace pdftron {
18  namespace PDF {
19 
22 {
37 };
38 
44 typedef void (*DownloadReportHandler) (DownloadedType type, PDFDoc* doc, int page_num, int obj_num, const char* message, void* data);
45 
49 class Separation : public TRN_separation
50 {
51 public:
52  Separation();
53  ~Separation();
54  Separation(const Separation&);
56  UInt8 C() const;
57  UInt8 M() const;
58  UInt8 Y() const;
59  UInt8 K() const;
60  UInt32 GetDataSize() const;
61  UString GetSeparationName() const;
62 #ifdef SWIG
63  std::vector<unsigned char> GetData() const;
64 #else
65  const UChar* GetData() const;
66 #endif
67 
69 
70 private:
71  bool m_owner;
72 };
73 
86 {
87 public:
88 
103  enum Type {
106  };
107 
115  e_op_off = 0,
118  };
119 
123  PDFRasterizer(Type type = e_BuiltIn);
124  ~PDFRasterizer();
125 
179 #ifndef SWIG
180  std::vector<unsigned char> Rasterize(Page& page,
181  int width, int height, int stride,
182  int num_comps, bool demult,
183  const Common::Matrix2D& device_mtx,
184  const Rect* clip = 0,
185  const Rect* scrl_clip_regions = 0,
186  bool* cancel = 0);
187 
188  void Rasterize(Page& page, UChar* in_out_image_buffer,
189  int width, int height, int stride,
190  int num_comps, bool demult,
191  const Common::Matrix2D& device_mtx,
192  const Rect* clip = 0,
193  const Rect* scrl_clip_regions = 0,
194  bool* cancel = 0);
195 #else // SWIG
196  std::vector<unsigned char> Rasterize(
197  Page& page,
198  int width,
199  int height,
200  int stride,
201  int num_comps,
202  bool demult,
203  const Common::Matrix2D& device_mtx,
204  const Rect* clip = 0,
205  const Rect* scrl_clip_regions = 0
206  );
207 #endif // SWIG
208 
209  std::vector<Separation> RasterizeSeparations(
210  Page& page,
211  int width,
212  int height,
213  const Common::Matrix2D& mtx,
214  const Rect* clip,
215  volatile bool* cancel
216  );
217 
247 #ifdef _WIN32
248  void Rasterize(Page& page, void* hdc,
249  const Common::Matrix2D& device_mtx,
250  const Rect* clip = 0,
251  int dpi = -1,
252  bool* cancel = 0);
253 #endif
254 
260  void SetDrawAnnotations(bool render_annots);
261 
267  void SetHighlightFields(bool highlight_fields);
268 
278  void SetAntiAliasing(bool enable_aa);
279 
288  void SetPathHinting(bool enable_hinting);
289 
300  void SetThinLineAdjustment(bool pixel_grid_fit, bool stroke_adjust);
301 
316  void SetImageSmoothing(bool smoothing_enabled = true, bool hq_image_resampling = false);
317 
324  void SetCaching(bool enabled = true);
325 
338  void SetGamma(double expgamma);
339 
349  void SetOCGContext(OCG::Context* ctx);
350 
360  void SetPrintMode(bool is_printing);
361 
372 
378  typedef void (*ErrorReportProc) (const char* message, void* data);
379 
387 #ifdef SWIG
388  void SetErrorReportProc(Callback* instance);
389 #else
390  void SetErrorReportProc(ErrorReportProc error_proc, void* data);
391 #endif
392 
404  void SetRasterizerType (Type type);
405 
412 
417  {
422  };
423 
434 
439 
445  void UpdateBuffer();
446 
450  void Destroy();
451 
452 // @cond PRIVATE_DOC
453 #ifndef SWIGHIDDEN
454  TRN_PDFRasterizer mp_rast;
455 private:
457  PDFRasterizer& operator= (const PDFRasterizer&);
458 #endif
459 // @endcond
460 };
461 
462 
463 
464 #include <Impl/PDFRasterizer.inl>
465 
466 
467  }; // namespace PDF
468 }; // namespace pdftron
469 
470 #endif // PDFTRON_H_CPPPDFRasterizer
void SetCaching(bool enabled=true)
UString GetSeparationName() const
void SetImageSmoothing(bool smoothing_enabled=true, bool hq_image_resampling=false)
UInt32 GetDataSize() const
TRN_UInt8 UInt8
Definition: BasicTypes.h:15
void SetThinLineAdjustment(bool pixel_grid_fit, bool stroke_adjust)
void SetErrorReportProc(ErrorReportProc error_proc, void *data)
void SetOverprint(OverprintPreviewMode op)
void SetGamma(double expgamma)
std::vector< unsigned char > Rasterize(Page &page, int width, int height, int stride, int num_comps, bool demult, const Common::Matrix2D &device_mtx, const Rect *clip=0, const Rect *scrl_clip_regions=0, bool *cancel=0)
void SetRasterizerType(Type type)
const UChar * GetData() const
ColorPostProcessMode GetColorPostProcessMode() const
void SetPathHinting(bool enable_hinting)
void(* ErrorReportProc)(const char *message, void *data)
Separation & operator=(const Separation &)
TRN_UInt32 UInt32
Definition: BasicTypes.h:13
void SetAntiAliasing(bool enable_aa)
TRN_UChar UChar
Definition: BasicTypes.h:12
GDI+ based rasterizer. (Deprecated)
std::vector< Separation > RasterizeSeparations(Page &page, int width, int height, const Common::Matrix2D &mtx, const Rect *clip, volatile bool *cancel)
void SetColorPostProcessMode(ColorPostProcessMode mode)
void(* DownloadReportHandler)(DownloadedType type, PDFDoc *doc, int page_num, int obj_num, const char *message, void *data)
Definition: PDFRasterizer.h:44
void SetHighlightFields(bool highlight_fields)
high-quality, platform independent rasterizer.
void SetDrawAnnotations(bool render_annots)
void SetOCGContext(OCG::Context *ctx)
PDFRasterizer(Type type=e_BuiltIn)
void SetPrintMode(bool is_printing)