Loading...
Searching...
No Matches
Image.h
Go to the documentation of this file.
1//---------------------------------------------------------------------------------------
2// Copyright (c) 2001-2025 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
12namespace pdftron {
13 namespace PDF {
14
22class Image
23{
24public:
25
90 static Image Create(SDF::SDFDoc& doc, const UString& filename, SDF::Obj encoder_hints = 0);
91
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
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
143 const unsigned char* buf,
144 size_t buf_size,
145 SDF::Obj encoder_hints = 0);
146
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
197 const char* buf,
198 size_t buf_size,
199 int width,
200 int height,
201 SDF::Obj encoder_hints = 0);
202
208 Filters::FilterReader& image_data,
209 int width,
210 int height,
211 SDF::Obj encoder_hints = 0);
212
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
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
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
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&);
316
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
383
390
394 int GetComponentNum() const;
395
399 bool IsImageMask() const;
400
404 bool IsImageInterpolate() const;
405
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
501
508 void ExportAsTiff(const UString& filename);
509
516
523 void ExportAsPng(const UString& filename);
524
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
int GetImageWidth() const
GState::RenderingIntent GetImageRenderingIntent() const
int GetImageHeight() const
static Image CreateSoftMask(SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, int bpc, SDF::Obj encoder_hints=0)
void SetMask(Image &image_mask)
void SetMask(SDF::Obj mask)
int GetBitsPerComponent() const
void ExportAsPng(const UString &filename)
int Export(const UString &filename)
int GetComponentNum() const
static Image Create(SDF::SDFDoc &doc, const unsigned char *buf, size_t buf_size, SDF::Obj encoder_hints=0)
Image & operator=(const Image &)
SDF::Obj GetSDFObj() const
SDF::Obj GetMask() const
void ExportAsTiff(Filters::FilterWriter &writer)
static Image CreateSoftMask(SDF::SDFDoc &doc, const char *buf, size_t buf_size, int width, int height, int bpc, SDF::Obj encoder_hints=0)
SDF::Obj GetSoftMask()
void ExportAsPng(Filters::FilterWriter &writer)
void ExportAsTiff(const UString &filename)
static Image CreateImageMask(SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, SDF::Obj encoder_hints=0)
SDF::Obj GetDecodeArray() const
Image(const Image &)
static Image Create(SDF::SDFDoc &doc, const unsigned char *buf, size_t buf_size, int width, int height, int bpc, ColorSpace color_space, SDF::Obj encoder_hints=0)
bool IsImageMask() const
bool IsImageInterpolate() const
static Image Create(SDF::SDFDoc &doc, const UString &filename, SDF::Obj encoder_hints=0)
int GetImageDataSize() const
void SetSoftMask(Image &soft_mask)
static Image Create(SDF::SDFDoc &doc, Filters::Filter image_data, SDF::Obj encoder_hints=0)
static Image CreateImageMask(SDF::SDFDoc &doc, const char *buf, size_t buf_size, int width, int height, SDF::Obj encoder_hints=0)
static Image Create(SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, int bpc, ColorSpace color_space, SDF::Obj encoder_hints=0)
static Image Create(SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, int bpc, ColorSpace color_space, InputFilter input_format)
int Export(Filters::FilterWriter &writer)
ColorSpace GetImageColorSpace() const
Image(SDF::Obj image_xobject=0)
bool IsValid() const
static Image Create(SDF::SDFDoc &doc, const char *buf, size_t buf_size, int width, int height, int bpc, ColorSpace color_space, InputFilter input_format)
Filters::Filter GetImageData() const