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-2024 by Apryse Software 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 
90  static Image Create(SDF::SDFDoc& doc, const UString& filename, SDF::Obj encoder_hints = 0);
91 
115  static Image Create(SDF::SDFDoc& doc,
116  const unsigned char* buf,
117  size_t buf_size,
118  int width,
119  int height,
120  int bpc,
121  ColorSpace color_space,
122  SDF::Obj encoder_hints = 0);
123 
129  static Image Create(SDF::SDFDoc& doc,
130  Filters::FilterReader& image_data,
131  int width,
132  int height,
133  int bpc,
134  ColorSpace color_space,
135  SDF::Obj encoder_hints = 0);
136 
142  static Image Create(SDF::SDFDoc& doc,
143  const unsigned char* buf,
144  size_t buf_size,
145  SDF::Obj encoder_hints = 0);
146 
154  static Image Create(SDF::SDFDoc& doc,
155  Filters::Filter image_data,
156  SDF::Obj encoder_hints = 0);
157 
171  #if defined(_WIN32)
172  static Image Create(SDF::SDFDoc& doc, Gdiplus::Bitmap* bmp, SDF::Obj encoder_hints = 0);
173  #endif
174 
196  static Image CreateImageMask(SDF::SDFDoc& doc,
197  const char* buf,
198  size_t buf_size,
199  int width,
200  int height,
201  SDF::Obj encoder_hints = 0);
202 
207  static Image CreateImageMask(SDF::SDFDoc& doc,
208  Filters::FilterReader& image_data,
209  int width,
210  int height,
211  SDF::Obj encoder_hints = 0);
212 
235  static Image CreateSoftMask(SDF::SDFDoc& doc,
236  const char* buf,
237  size_t buf_size,
238  int width,
239  int height,
240  int bpc,
241  SDF::Obj encoder_hints = 0);
242 
248  static Image CreateSoftMask(SDF::SDFDoc& doc,
249  Filters::FilterReader& image_data,
250  int width,
251  int height,
252  int bpc,
253  SDF::Obj encoder_hints = 0);
254 
255  // ------------------------------------------------
256 
258  {
259  e_none, // Input stream is not compressed
260  e_jpeg, // Input image is a JPEG image
261  e_jp2, // Input image is a JP2 (JPEG2000) image
262  e_flate, // Input image is a Flate compressed
263  e_g3, // Input image is a G3 stream
264  e_g4, // Input image is a G4 stream
265  e_ascii_hex // Input image stream compressed using ASCIIHexDecode filter
266  };
267 
284  static Image Create(SDF::SDFDoc& doc,
285  const char* buf,
286  size_t buf_size,
287  int width,
288  int height,
289  int bpc,
290  ColorSpace color_space,
291  InputFilter input_format);
292 
293 
298  static Image Create(SDF::SDFDoc& doc,
299  Filters::FilterReader& image_data,
300  int width,
301  int height,
302  int bpc,
303  ColorSpace color_space,
304  InputFilter input_format);
305 
312  Image(SDF::Obj image_xobject = 0);
313 
314  Image(const Image&);
315  Image& operator=(const Image&);
316 
320  SDF::Obj GetSDFObj () const;
321 
327  bool IsValid() const;
328 
333 
337  int GetImageDataSize() const;
338 
350  #if defined(_WIN32)
351  Gdiplus::Bitmap* GetBitmap() const;
352  #endif
353 
363 
367  int GetImageWidth() const;
368 
372  int GetImageHeight() const;
373 
382  SDF::Obj GetDecodeArray() const;
383 
389  int GetBitsPerComponent() const;
390 
394  int GetComponentNum() const;
395 
399  bool IsImageMask() const;
400 
404  bool IsImageInterpolate() const;
405 
413  SDF::Obj GetMask() const;
414 
430  void SetMask(Image& image_mask);
431 
443  void SetMask(SDF::Obj mask);
444 
451 
461  void SetSoftMask(Image& soft_mask);
462 
467 
487  int Export(const UString& filename);
488 
500  int Export(Filters::FilterWriter& writer);
501 
508  void ExportAsTiff(const UString& filename);
509 
515  void ExportAsTiff(Filters::FilterWriter& writer);
516 
523  void ExportAsPng(const UString& filename);
524 
530  void ExportAsPng(Filters::FilterWriter& writer);
531 
532 
533 // @cond PRIVATE_DOC
534 #ifndef SWIGHIDDEN
535  Image(TRN_Image impl);
536  TRN_Image mp_image;
537 #endif
538 // @endcond
539 };
540 
541 
542 
543 #include <Impl/Image.inl>
544 
545  }; // namespace PDF
546 }; // namespace pdftron
547 
548 #endif // PDFTRON_H_CPPPDFImage
bool IsImageMask() const
void SetMask(Image &image_mask)
void SetSoftMask(Image &soft_mask)
int GetImageWidth() const
Filters::Filter GetImageData() const
Gdiplus::Bitmap * GetBitmap() 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)