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-2021 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/Page.h>
9 #include <C/PDF/TRN_PDFRasterizer.h>
10 #include <PDF/OCG/Context.h>
11 #ifdef SWIG
12 #include <PDF/Callback.h>
13 #endif
14 #include <C/Common/TRN_Types.h>
15 
16 namespace pdftron {
17  namespace PDF {
18 
21 {
36 };
37 
38 class PDFDoc;
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 
225  std::vector<Separation> RasterizeSeparations(
226  Page& page,
227  int width,
228  int height,
229  const Common::Matrix2D& mtx,
230  const Rect* clip,
231  volatile bool* cancel
232  );
233 
234 #ifdef _WIN32
235 
264  void Rasterize(Page& page, void* hdc,
265  const Common::Matrix2D& device_mtx,
266  const Rect* clip = 0,
267  int dpi = -1,
268  bool* cancel = 0);
269 #endif
270 
276  void SetDrawAnnotations(bool render_annots);
277 
283  void SetHighlightFields(bool highlight_fields);
284 
294  void SetAntiAliasing(bool enable_aa);
295 
304  void SetPathHinting(bool enable_hinting);
305 
316  void SetThinLineAdjustment(bool pixel_grid_fit, bool stroke_adjust);
317 
332  void SetImageSmoothing(bool smoothing_enabled = true, bool hq_image_resampling = false);
333 
340  void SetCaching(bool enabled = true);
341 
354  void SetGamma(double expgamma);
355 
365  void SetOCGContext(OCG::Context* ctx);
366 
376  void SetPrintMode(bool is_printing);
377 
388 
394  typedef void (*ErrorReportProc) (const char* message, void* data);
395 
403 #ifdef SWIG
404  void SetErrorReportProc(Callback* instance);
405 #else
406  void SetErrorReportProc(ErrorReportProc error_proc, void* data);
407 #endif
408 
420  void SetRasterizerType (Type type);
421 
428 
433  {
438  };
439 
450 
455 
461  void UpdateBuffer();
462 
466  void Destroy();
467 
468 // @cond PRIVATE_DOC
469 #ifndef SWIGHIDDEN
470  TRN_PDFRasterizer mp_rast;
471 private:
473  PDFRasterizer& operator= (const PDFRasterizer&);
474 #endif
475 // @endcond
476 };
477 
478 
479 
480 #include <Impl/PDFRasterizer.inl>
481 
482 
483  }; // namespace PDF
484 }; // namespace pdftron
485 
486 #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)