All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Image.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2018 by PDFTron Systems Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPPDFImage
6 #define PDFTRON_H_CPPPDFImage
7 
8 #include <PDF/GState.h>
9 #include <C/PDF/TRN_Image.h>
10 
11 
12 namespace pdftron {
13  namespace PDF {
14 
22 class Image
23 {
24 public:
25 
82  static Image Create(SDF::SDFDoc& doc, const UString& filename, SDF::Obj encoder_hints = 0);
83 
107  static Image Create(SDF::SDFDoc& doc,
108  const unsigned char* buf,
109  size_t buf_size,
110  int width,
111  int height,
112  int bpc,
113  ColorSpace color_space,
114  SDF::Obj encoder_hints = 0);
115 
121  static Image Create(SDF::SDFDoc& doc,
122  Filters::FilterReader& image_data,
123  int width,
124  int height,
125  int bpc,
126  ColorSpace color_space,
127  SDF::Obj encoder_hints = 0);
128 
134  static Image Create(SDF::SDFDoc& doc,
135  const unsigned char* buf,
136  size_t buf_size,
137  SDF::Obj encoder_hints = 0);
138 
146  static Image Create(SDF::SDFDoc& doc,
147  Filters::Filter image_data,
148  SDF::Obj encoder_hints = 0);
149 
163  #if defined(_WIN32)
164  static Image Create(SDF::SDFDoc& doc, Gdiplus::Bitmap* bmp, SDF::Obj encoder_hints = 0);
165  #endif
166 
188  static Image CreateImageMask(SDF::SDFDoc& doc,
189  const char* buf,
190  size_t buf_size,
191  int width,
192  int height,
193  SDF::Obj encoder_hints = 0);
194 
199  static Image CreateImageMask(SDF::SDFDoc& doc,
200  Filters::FilterReader& image_data,
201  int width,
202  int height,
203  SDF::Obj encoder_hints = 0);
204 
227  static Image CreateSoftMask(SDF::SDFDoc& doc,
228  const char* buf,
229  size_t buf_size,
230  int width,
231  int height,
232  int bpc,
233  SDF::Obj encoder_hints = 0);
234 
240  static Image CreateSoftMask(SDF::SDFDoc& doc,
241  Filters::FilterReader& image_data,
242  int width,
243  int height,
244  int bpc,
245  SDF::Obj encoder_hints = 0);
246 
247  // ------------------------------------------------
248 
250  {
251  e_none, // Input stream is not compressed
252  e_jpeg, // Input image is a JPEG image
253  e_jp2, // Input image is a JP2 (JPEG2000) image
254  e_flate, // Input image is a Flate compressed
255  e_g3, // Input image is a G3 stream
256  e_g4, // Input image is a G4 stream
257  e_ascii_hex // Input image stream compressed using ASCIIHexDecode filter
258  };
259 
279  static Image Create(SDF::SDFDoc& doc,
280  const char* buf,
281  size_t buf_size,
282  int width,
283  int height,
284  int bpc,
285  ColorSpace color_space,
286  InputFilter input_format);
287 
288 
293  static Image Create(SDF::SDFDoc& doc,
294  Filters::FilterReader& image_data,
295  int width,
296  int height,
297  int bpc,
298  ColorSpace color_space,
299  InputFilter input_format);
300 
307  Image(SDF::Obj image_xobject = 0);
308 
309  Image(const Image&);
310  Image& operator=(const Image&);
311 
315  SDF::Obj GetSDFObj () const;
316 
322  bool IsValid() const;
323 
328 
332  int GetImageDataSize() const;
333 
345  #if defined(_WIN32)
346  Gdiplus::Bitmap* GetBitmap() const;
347  #endif
348 
358 
362  int GetImageWidth() const;
363 
367  int GetImageHeight() const;
368 
377  SDF::Obj GetDecodeArray() const;
378 
384  int GetBitsPerComponent() const;
385 
389  int GetComponentNum() const;
390 
394  bool IsImageMask() const;
395 
399  bool IsImageInterpolate() const;
400 
408  SDF::Obj GetMask() const;
409 
425  void SetMask(Image& image_mask);
426 
438  void SetMask(SDF::Obj mask);
439 
446 
456  void SetSoftMask(Image& soft_mask);
457 
462 
482  int Export(const UString& filename);
483 
495  int Export(Filters::FilterWriter& writer);
496 
503  void ExportAsTiff(const UString& filename);
504 
510  void ExportAsTiff(Filters::FilterWriter& writer);
511 
518  void ExportAsPng(const UString& filename);
519 
525  void ExportAsPng(Filters::FilterWriter& writer);
526 
527 
529 #ifndef SWIGHIDDEN
530  Image(TRN_Image impl);
531  TRN_Image mp_image;
532 #endif
533 };
535 
536 
537 
538 #include <Impl/Image.inl>
539 
540  }; // namespace PDF
541 }; // namespace pdftron
542 
543 #endif // PDFTRON_H_CPPPDFImage
bool IsImageMask() const
void SetMask(Image &image_mask)
void SetSoftMask(Image &soft_mask)
int GetImageWidth() const
Filters::Filter GetImageData() const
int Export(const UString &filename)
Image & operator=(const Image &)
int GetImageDataSize() const
int GetComponentNum() const
SDF::Obj GetMask() const
Image(SDF::Obj image_xobject=0)
SDF::Obj GetSDFObj() const
ColorSpace GetImageColorSpace() const
SDF::Obj GetSoftMask()
SDF::Obj GetDecodeArray() const
bool IsValid() const
int GetImageHeight() const
void ExportAsPng(const UString &filename)
static Image CreateSoftMask(SDF::SDFDoc &doc, const char *buf, size_t buf_size, int width, int height, int bpc, SDF::Obj encoder_hints=0)
void ExportAsTiff(const UString &filename)
static Image Create(SDF::SDFDoc &doc, const UString &filename, SDF::Obj encoder_hints=0)
GState::RenderingIntent GetImageRenderingIntent() const
int GetBitsPerComponent() const
bool IsImageInterpolate() const
static Image CreateImageMask(SDF::SDFDoc &doc, const char *buf, size_t buf_size, int width, int height, SDF::Obj encoder_hints=0)

© 2002-2014 PDFTron Systems Inc.