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
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
257 enum InputFilter
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
332 Filters::Filter GetImageData() const;
333
337 int GetImageDataSize() const;
338
350 #if defined(_WIN32)
351 Gdiplus::Bitmap* GetBitmap() const;
352 #endif
353
362 ColorSpace GetImageColorSpace() const;
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
450 SDF::Obj GetSoftMask();
451
461 void SetSoftMask(Image& soft_mask);
462
466 GState::RenderingIntent GetImageRenderingIntent() const;
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
GState.h
pdftron::Filters::Filter
Definition Filter.h:46
pdftron::Filters::FilterReader
Definition FilterReader.h:30
pdftron::Filters::FilterWriter
Definition FilterWriter.h:30
pdftron::PDF::ColorSpace
Definition ColorSpace.h:139
pdftron::PDF::GState::RenderingIntent
RenderingIntent
Definition GState.h:291
pdftron::PDF::Image::GetImageWidth
int GetImageWidth() const
pdftron::PDF::Image::GetImageRenderingIntent
GState::RenderingIntent GetImageRenderingIntent() const
pdftron::PDF::Image::GetImageHeight
int GetImageHeight() const
pdftron::PDF::Image::CreateSoftMask
static Image CreateSoftMask(SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, int bpc, SDF::Obj encoder_hints=0)
pdftron::PDF::Image::SetMask
void SetMask(Image &image_mask)
pdftron::PDF::Image::SetMask
void SetMask(SDF::Obj mask)
pdftron::PDF::Image::GetBitsPerComponent
int GetBitsPerComponent() const
pdftron::PDF::Image::ExportAsPng
void ExportAsPng(const UString &filename)
pdftron::PDF::Image::Export
int Export(const UString &filename)
pdftron::PDF::Image::GetComponentNum
int GetComponentNum() const
pdftron::PDF::Image::Create
static Image Create(SDF::SDFDoc &doc, const unsigned char *buf, size_t buf_size, SDF::Obj encoder_hints=0)
pdftron::PDF::Image::operator=
Image & operator=(const Image &)
pdftron::PDF::Image::GetSDFObj
SDF::Obj GetSDFObj() const
pdftron::PDF::Image::GetMask
SDF::Obj GetMask() const
pdftron::PDF::Image::ExportAsTiff
void ExportAsTiff(Filters::FilterWriter &writer)
pdftron::PDF::Image::CreateSoftMask
static Image CreateSoftMask(SDF::SDFDoc &doc, const char *buf, size_t buf_size, int width, int height, int bpc, SDF::Obj encoder_hints=0)
pdftron::PDF::Image::GetSoftMask
SDF::Obj GetSoftMask()
pdftron::PDF::Image::ExportAsPng
void ExportAsPng(Filters::FilterWriter &writer)
pdftron::PDF::Image::ExportAsTiff
void ExportAsTiff(const UString &filename)
pdftron::PDF::Image::CreateImageMask
static Image CreateImageMask(SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, SDF::Obj encoder_hints=0)
pdftron::PDF::Image::GetDecodeArray
SDF::Obj GetDecodeArray() const
pdftron::PDF::Image::Image
Image(const Image &)
pdftron::PDF::Image::Create
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)
pdftron::PDF::Image::InputFilter
InputFilter
Definition Image.h:258
pdftron::PDF::Image::e_jpeg
@ e_jpeg
Definition Image.h:260
pdftron::PDF::Image::e_g4
@ e_g4
Definition Image.h:264
pdftron::PDF::Image::e_ascii_hex
@ e_ascii_hex
Definition Image.h:265
pdftron::PDF::Image::e_jp2
@ e_jp2
Definition Image.h:261
pdftron::PDF::Image::e_none
@ e_none
Definition Image.h:259
pdftron::PDF::Image::e_flate
@ e_flate
Definition Image.h:262
pdftron::PDF::Image::e_g3
@ e_g3
Definition Image.h:263
pdftron::PDF::Image::IsImageMask
bool IsImageMask() const
pdftron::PDF::Image::IsImageInterpolate
bool IsImageInterpolate() const
pdftron::PDF::Image::Create
static Image Create(SDF::SDFDoc &doc, const UString &filename, SDF::Obj encoder_hints=0)
pdftron::PDF::Image::GetImageDataSize
int GetImageDataSize() const
pdftron::PDF::Image::SetSoftMask
void SetSoftMask(Image &soft_mask)
pdftron::PDF::Image::Create
static Image Create(SDF::SDFDoc &doc, Filters::Filter image_data, SDF::Obj encoder_hints=0)
pdftron::PDF::Image::CreateImageMask
static Image CreateImageMask(SDF::SDFDoc &doc, const char *buf, size_t buf_size, int width, int height, SDF::Obj encoder_hints=0)
pdftron::PDF::Image::Create
static Image Create(SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, int bpc, ColorSpace color_space, SDF::Obj encoder_hints=0)
pdftron::PDF::Image::Create
static Image Create(SDF::SDFDoc &doc, Filters::FilterReader &image_data, int width, int height, int bpc, ColorSpace color_space, InputFilter input_format)
pdftron::PDF::Image::Export
int Export(Filters::FilterWriter &writer)
pdftron::PDF::Image::GetImageColorSpace
ColorSpace GetImageColorSpace() const
pdftron::PDF::Image::Image
Image(SDF::Obj image_xobject=0)
pdftron::PDF::Image::IsValid
bool IsValid() const
pdftron::PDF::Image::Create
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)
pdftron::PDF::Image::GetImageData
Filters::Filter GetImageData() const
pdftron::SDF::Obj
Definition Obj.h:41
pdftron::SDF::SDFDoc
Definition SDFDoc.h:68
pdftron::UString
Definition UString.h:28
pdftron::PDF
Definition Action.h:15
pdftron
Definition BasicTypes.h:10