XImage.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 // C# preprocessor directive: #if ASPOSE_PDF_DRAWING
5 
6 // C# INACTIVE CODE:
7 // using PdfImage = Aspose.Pdf.Drawing.PdfImage;
8 // using ImageFormat = Aspose.Pdf.Drawing.ImageFormat;
9 
10 // C# preprocessor directive: #else
11 
12 
13 // C# preprocessor directive: #endif
14 
15 
16 #include <system/array.h>
17 #include <cstdint>
18 
19 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
20 
21 namespace Aspose
22 {
23 namespace Imaging
24 {
25 class RasterCachedImage;
26 } // namespace Imaging
27 namespace Pdf
28 {
29 namespace Annotations
30 {
31 class PDF3DAnnotation;
32 class Redaction;
33 } // namespace Annotations
34 enum class ColorType;
35 class DataUtils;
36 namespace Engine
37 {
38 namespace CommonData
39 {
40 namespace Graphics
41 {
42 namespace Images
43 {
44 class IPdfImage;
45 } // namespace Images
46 } // namespace Graphics
47 namespace PageContent
48 {
49 namespace EmptyPageDetection
50 {
51 class EmptyPageDetectionManager;
52 } // namespace EmptyPageDetection
53 } // namespace PageContent
54 } // namespace CommonData
55 namespace Data
56 {
57 class IPdfDataStream;
58 class IPdfObject;
59 class IPdfPrimitive;
60 } // namespace Data
61 namespace IO
62 {
63 namespace ConvertStrategies
64 {
65 class PdfAConvertStrategy;
66 class PdfConvertStrategy;
67 class PdfUaConvertStrategy;
68 class SearchablePdfConvertStrategy;
69 class TransparentContentRemoval;
70 } // namespace ConvertStrategies
71 } // namespace IO
72 namespace Presentation
73 {
74 class ColorDetectHelper;
75 } // namespace Presentation
76 } // namespace Engine
77 namespace Facades
78 {
79 class PdfContentEditor;
80 class PdfConverter;
81 class PdfExtractor;
82 } // namespace Facades
83 namespace Forms
84 {
85 class SignatureField;
86 } // namespace Forms
87 enum class ImageFilterType;
88 class ImagePlacement;
90 class ImageStamp;
91 namespace Interchange
92 {
93 class ContentSequenceXImage;
94 class ContentSequenceXObject;
95 } // namespace Interchange
96 class Metadata;
97 namespace Optimization
98 {
99 class ImageCompressor;
100 class ImageCompressor2;
101 } // namespace Optimization
102 namespace PageModel
103 {
104 class ImageElement;
105 } // namespace PageModel
106 namespace PdfToMarkdown
107 {
108 class ImageManager;
109 } // namespace PdfToMarkdown
110 class Resources;
112 namespace Tests
113 {
114 namespace Facades
115 {
116 class PdfFileStampTests;
117 } // namespace Facades
118 namespace Graphics
119 {
120 class ImageExtractionTests;
121 } // namespace Graphics
122 class RegressionTests_v11_1;
123 class RegressionTests_v19_1;
124 class RegressionTests_v19_12;
125 class RegressionTests_v19_5;
126 class RegressionTests_v20_02;
127 class RegressionTests_v20_05;
128 class RegressionTests_v24_02;
129 class RegressionTests_v6_2;
130 class RegressionTests_v6_9;
131 class RegressionTests_v7_0;
132 class RegressionTests_v7_1;
133 class RegressionTests_v7_5;
134 class RegressionTests_v7_7;
135 class RegressionTests_v7_8;
136 class RegressionTests_v7_9;
137 class RegressionTests_v8_1;
138 } // namespace Tests
139 class XImageCollection;
140 } // namespace Pdf
141 namespace Utils
142 {
143 class ImageUtils;
144 } // namespace Utils
145 } // namespace Aspose
146 namespace System
147 {
148 namespace Drawing
149 {
150 class Bitmap;
151 class Color;
152 class Image;
153 namespace Imaging
154 {
155 class BitmapData;
156 class ImageFormat;
157 enum class ImageLockMode;
158 } // namespace Imaging
159 } // namespace Drawing
160 namespace IO
161 {
162 class Stream;
163 } // namespace IO
164 } // namespace System
165 
166 namespace Aspose {
167 
168 namespace Pdf {
169 
173 class ASPOSE_PDF_SHARED_CLASS XImage final : public System::Object
174 {
175  typedef XImage ThisType;
176  typedef System::Object BaseType;
177 
178  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
179  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
180 
181  friend class Aspose::Pdf::Interchange::ContentSequenceXObject;
182  friend class Aspose::Pdf::Interchange::ContentSequenceXImage;
183  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::PdfUaConvertStrategy;
184  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::PdfConvertStrategy;
185  friend class Aspose::Pdf::Optimization::ImageCompressor;
186  friend class Aspose::Pdf::Optimization::ImageCompressor2;
189  friend class Aspose::Pdf::Annotations::Redaction;
190  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::TransparentContentRemoval;
191  friend class Aspose::Pdf::PageModel::ImageElement;
192  friend class Aspose::Pdf::Engine::Presentation::ColorDetectHelper;
193  friend class Aspose::Pdf::Engine::CommonData::PageContent::EmptyPageDetection::EmptyPageDetectionManager;
194  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::PdfAConvertStrategy;
195  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::SearchablePdfConvertStrategy;
205  friend class Aspose::Utils::ImageUtils;
207  friend class Aspose::Pdf::XImageCollection;
208  friend class Aspose::Pdf::DataUtils;
209  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::TransparentContentRemoval;
210  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::TransparentContentRemoval;
211  friend class Aspose::Pdf::PdfToMarkdown::ImageManager;
212  friend class Aspose::Pdf::Tests::RegressionTests_v7_0;
213  friend class Aspose::Pdf::Tests::RegressionTests_v6_2;
214  friend class Aspose::Pdf::Tests::RegressionTests_v11_1;
215  friend class Aspose::Pdf::Tests::RegressionTests_v20_05;
216  friend class Aspose::Pdf::Tests::RegressionTests_v6_9;
217  friend class Aspose::Pdf::Tests::RegressionTests_v7_1;
218  friend class Aspose::Pdf::Tests::RegressionTests_v7_5;
219  friend class Aspose::Pdf::Tests::RegressionTests_v7_7;
220  friend class Aspose::Pdf::Tests::RegressionTests_v7_8;
221  friend class Aspose::Pdf::Tests::RegressionTests_v7_9;
222  friend class Aspose::Pdf::Tests::RegressionTests_v8_1;
223  friend class Aspose::Pdf::Tests::RegressionTests_v19_1;
224  friend class Aspose::Pdf::Tests::RegressionTests_v19_5;
225  friend class Aspose::Pdf::Tests::RegressionTests_v19_12;
226  friend class Aspose::Pdf::Tests::RegressionTests_v20_02;
227  friend class Aspose::Pdf::Tests::RegressionTests_v24_02;
228  friend class Aspose::Pdf::Tests::Facades::PdfFileStampTests;
229  friend class Aspose::Pdf::Tests::Graphics::ImageExtractionTests;
230 
231 public:
232 
236  ASPOSE_PDF_SHARED_API bool get_ContainsTransparency();
240  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Drawing::Image> get_Grayscaled();
244  ASPOSE_PDF_SHARED_API Aspose::Pdf::ImageFilterType get_FilterType();
248  ASPOSE_PDF_SHARED_API int32_t get_Width();
252  ASPOSE_PDF_SHARED_API int32_t get_Height();
256  ASPOSE_PDF_SHARED_API System::String get_Name();
260  ASPOSE_PDF_SHARED_API void set_Name(System::String value);
264  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Metadata> get_Metadata();
265 
270  ASPOSE_PDF_SHARED_API void Rename(System::String name);
275  ASPOSE_PDF_SHARED_API void Save(System::SharedPtr<System::IO::Stream> stream);
286  ASPOSE_PDF_SHARED_API void AddStencilMask(System::SharedPtr<System::IO::Stream> maskStream);
292  ASPOSE_PDF_SHARED_API void Save(System::SharedPtr<System::IO::Stream> stream, int32_t resolution);
299  ASPOSE_PDF_SHARED_API void Save(System::SharedPtr<System::IO::Stream> stream, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t resolution);
304  ASPOSE_PDF_SHARED_API Aspose::Pdf::ColorType GetColorType();
308  static ASPOSE_PDF_SHARED_API Aspose::Pdf::ColorType DetectColorType(System::SharedPtr<System::Drawing::Bitmap> bmp);
314  ASPOSE_PDF_SHARED_API bool IsTheSameObject(System::SharedPtr<Aspose::Pdf::XImage> image);
319  ASPOSE_PDF_SHARED_API System::String GetNameInCollection();
324  ASPOSE_PDF_SHARED_API System::SharedPtr<System::IO::Stream> ToStream();
325 
326 protected:
327 
335  bool get_HasSMask();
340  System::SharedPtr<System::Drawing::Image> get_BlackAndWhite();
341  System::ArrayPtr<System::String> get_ColorSpace();
342 
347 
351  static System::SharedPtr<System::Drawing::Imaging::ImageFormat> get_DefaultImageFormat();
353 
355 
356  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(XImage, CODEPORTING_ARGS(System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfDataStream> image, System::SharedPtr<Aspose::Pdf::XImageCollection> parent));
360  void Delete();
367  void Replace(System::SharedPtr<System::IO::Stream> image);
368 
370 
371  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(XImage, CODEPORTING_ARGS(System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfDataStream> image));
375  void SaveWithBlending(System::SharedPtr<System::IO::Stream> stream, int32_t resolution);
380  System::SharedPtr<System::IO::Stream> MakeGrayscaleRawBytes();
382  static bool IsBitmapFilled(System::SharedPtr<System::Drawing::Bitmap> bitmap, uint8_t whiteColorReplace);
383  static bool IsBitmapFilledRgb(System::SharedPtr<System::Drawing::Bitmap> bitmap, uint8_t whiteColorReplace);
389  static int32_t GetRgbDelta(System::Drawing::Color color);
390  void UpdateMetadata();
391 
392  virtual ASPOSE_PDF_SHARED_API ~XImage();
393 
394 private:
395 
397  static System::ArrayPtr<System::String> _emptyColorSpace;
400 
410  static Aspose::Pdf::ColorType DetectColorTypeForRgbImage(System::SharedPtr<System::Drawing::Bitmap> bmp);
411  static Aspose::Pdf::ColorType DetectColorTypeForBwImage(System::SharedPtr<System::Drawing::Bitmap> bmp);
412  static Aspose::Pdf::ColorType DetectColorTypeForGrayscaleImage(System::SharedPtr<System::Drawing::Bitmap> bmp);
414  static Aspose::Pdf::ColorType DetectColorTypeFor32bppArgbImage(System::SharedPtr<System::Drawing::Bitmap> bmp);
416 
417  static struct __StaticConstructor__ { __StaticConstructor__(); } s_constructor__;
418 
419 };
420 
421 } // namespace Pdf
422 } // namespace Aspose
423 
424 
Reresents graphic stamp.
Definition: ImageStamp.h:41
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
Provides access to XMP metadata stream.
Definition: Metadata.h:66
Represents characteristics of an image placed to Pdf document page.
Definition: ImagePlacement.h:75
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:64
Definition: Artifact.h:67
Represents signature form field.
Definition: SignatureField.h:83
ImageFilterType
Enumeration representing image filter type.
Definition: ImageFilterType.h:11
Definition: signed_info.h:13
Represents rgb to device gray color spaces conversion strategy.
Definition: RgbToDeviceGrayConversionStrategy.h:46
Represents a class to convert a pdf file&#39;s each page to images, supporting BMP, JPEG, PNG and TIFF now. Supported content in pdfs: pictures, form, comment.
Definition: PdfConverter.h:94
Class representing page resources.
Definition: Resources.h:257
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
Represents an absorber object of image placement objects. Performs search of image usages and provide...
Definition: ImagePlacementAbsorber.h:77
ImageLockMode
Specifies properties of the region of an image being locked.
Definition: image_lock_mode.h:9
Definition: AFRelationship.h:4
Represents a color. This type should be allocated on stack and passed to functions by value or by ref...
Definition: color.h:23
Class representing image X-Object.
Definition: XImage.h:173
System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream > EngineImg
IPdfImage object which decribes image.
Definition: XImage.h:346
Represents class for color value which can be expressed in different color space. ...
Definition: Color.h:79
Class PDF3DAnnotation. This class cannot be inherited.
Definition: PDF3DAnnotation.h:85
Class for extracting images and text from PDF document.
Definition: PdfExtractor.h:83
Class representing XImage collection.
Definition: XImageCollection.h:153
Represents image.
Definition: Image.h:66
Represents a class to edit PDF file&#39;s content.
Definition: PdfContentEditor.h:89
ColorType
Specifies color type of elements on page.
Definition: ColorType.h:16