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-2024 by Apryse Software 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 
290  void SetDrawUIElements(bool draw_ui_elements);
291 
301  void SetAntiAliasing(bool enable_aa);
302 
311  void SetPathHinting(bool enable_hinting);
312 
323  void SetThinLineAdjustment(bool pixel_grid_fit, bool stroke_adjust);
324 
334  void SetThinLineScaling(double scaling);
335 
345  void SetNightModeTuning(double contrast, double saturation, double flipness);
346 
361  void SetImageSmoothing(bool smoothing_enabled = true, bool hq_image_resampling = false);
362 
369  void SetCaching(bool enabled = true);
370 
383  void SetGamma(double expgamma);
384 
394  void SetOCGContext(OCG::Context* ctx);
395 
405  void SetPrintMode(bool is_printing);
406 
417 
423  typedef void (*ErrorReportProc) (const char* message, void* data);
424 
432 #ifdef SWIG
433  void SetErrorReportProc(Callback* instance);
434 #else
435  void SetErrorReportProc(ErrorReportProc error_proc, void* data);
436 #endif
437 
449  void SetRasterizerType (Type type);
450 
457 
462  {
467  };
468 
479 
484 
490  void UpdateBuffer();
491 
495  void Destroy();
496 
497 // @cond PRIVATE_DOC
498 #ifndef SWIGHIDDEN
499  TRN_PDFRasterizer mp_rast;
500 private:
502  PDFRasterizer& operator= (const PDFRasterizer&);
503 #endif
504 // @endcond
505 };
506 
507 
508 
509 #include <Impl/PDFRasterizer.inl>
510 
511 
512  }; // namespace PDF
513 }; // namespace pdftron
514 
515 #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 SetNightModeTuning(double contrast, double saturation, double flipness)
void SetHighlightFields(bool highlight_fields)
void SetDrawUIElements(bool draw_ui_elements)
high-quality, platform independent rasterizer.
void SetThinLineScaling(double scaling)
void SetDrawAnnotations(bool render_annots)
void SetOCGContext(OCG::Context *ctx)
PDFRasterizer(Type type=e_BuiltIn)
void SetPrintMode(bool is_printing)