Class representing image X-Object. More...

#include "XImage.h"

Inherits System::Object.

Public Member Functions

ASPOSE_PDF_SHARED_API bool get_ContainsTransparency ()
 If the image contains transparancy than return true; otherwise, false. More...
 
ASPOSE_PDF_SHARED_API System::SharedPtr< System::Drawing::Imageget_Grayscaled ()
 Gets grayscaled version of image. More...
 
ASPOSE_PDF_SHARED_API Aspose::Pdf::ImageFilterType get_FilterType ()
 Gets image filter type. More...
 
ASPOSE_PDF_SHARED_API int32_t get_Width ()
 Gets width of the image. More...
 
ASPOSE_PDF_SHARED_API int32_t get_Height ()
 Gets height of the image. More...
 
ASPOSE_PDF_SHARED_API System::String get_Name ()
 Gets image name. Please note that if you change name of the image which has references in page contents, document may became incorrect. Please use XImage.Rename method in this case. More...
 
ASPOSE_PDF_SHARED_API void set_Name (System::String value)
 Sets image name. Please note that if you change name of the image which has references in page contents, document may became incorrect. Please use XImage.Rename method in this case. More...
 
ASPOSE_PDF_SHARED_API System::SharedPtr< Aspose::Pdf::Metadataget_Metadata ()
 Metadata of the image. More...
 
ASPOSE_PDF_SHARED_API void Rename (System::String name)
 Renames image and replaces all references to the image with the new name More...
 
ASPOSE_PDF_SHARED_API void Save (System::SharedPtr< System::IO::Stream > stream)
 Saves image data into stream as JPEG image. More...
 
ASPOSE_PDF_SHARED_API void Save (System::SharedPtr< System::IO::Stream > stream, System::SharedPtr< System::Drawing::Imaging::ImageFormat > format)
 Saves image into stream with requested format. More...
 
ASPOSE_PDF_SHARED_API void Save (System::SharedPtr< System::IO::Stream > stream, int32_t resolution)
 Saves image data into stream as JPEG image with specified resolution. More...
 
ASPOSE_PDF_SHARED_API void Save (System::SharedPtr< System::IO::Stream > stream, System::SharedPtr< System::Drawing::Imaging::ImageFormat > format, int32_t resolution)
 Saves image into stream with requested format with specified resolution. More...
 
ASPOSE_PDF_SHARED_API Aspose::Pdf::ColorType GetColorType ()
 Returns color type of image. More...
 
ASPOSE_PDF_SHARED_API bool IsTheSameObject (System::SharedPtr< Aspose::Pdf::XImage > image)
 Returns true if both images references to the same object. More...
 
ASPOSE_PDF_SHARED_API System::String GetNameInCollection ()
 Returns name of the image in ints collection. More...
 
ASPOSE_PDF_SHARED_API System::SharedPtr< System::IO::StreamToStream ()
 Returns the original image stream. More...
 
- Public Member Functions inherited from System::Object
ASPOSECPP_SHARED_API Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ASPOSECPP_SHARED_API ~Object ()
 Destroys object. Frees all internal data structures. More...
 
ASPOSECPP_SHARED_API Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
ASPOSECPP_SHARED_API void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
ASPOSECPP_SHARED_API void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual ASPOSECPP_SHARED_API int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual ASPOSECPP_SHARED_API String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (uint32_t argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual ASPOSECPP_SHARED_API bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool Equals (double const &objA, double const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 Specialization of Object::ReferenceEquals for case of string and nullptr. More...
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 Specialization of Object::ReferenceEquals for case of strings. More...
 

Static Public Member Functions

static ASPOSE_PDF_SHARED_API Aspose::Pdf::ColorType DetectColorType (System::SharedPtr< System::Drawing::Bitmap > bmp)
 Returns color type of image. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Implements C# typeof(System.Object) construct. More...
 

Protected Member Functions

System::SharedPtr< Aspose::Pdf::Engine::CommonData::Graphics::Images::IPdfImage > get_PdfImage ()
 Gets the IPdfImage. More...
 
bool get_HasSMask ()
 If the image contains smask than return true; otherwise, false. More...
 
System::SharedPtr< Aspose::Pdf::XImageCollectionget_Parent () const
 
System::SharedPtr< System::Drawing::Imageget_BlackAndWhite ()
 Gets black and white version of image. More...
 
System::ArrayPtr< System::Stringget_ColorSpace ()
 
System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfObject > get_EngineObject ()
 
 XImage (System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream > image, System::SharedPtr< Aspose::Pdf::XImageCollection > parent)
 
 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION (XImage, CODEPORTING_ARGS(System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream > image, System::SharedPtr< Aspose::Pdf::XImageCollection > parent))
 
void Delete ()
 Deletes image from the parent collection. More...
 
void Replace (System::SharedPtr< System::IO::Stream > image)
 Replaces image onto stream specified in image . More...
 
 XImage (System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream > image)
 
 MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION (XImage, CODEPORTING_ARGS(System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream > image))
 
System::SharedPtr< System::Drawing::BitmapGetBitmap ()
 
System::SharedPtr< System::Drawing::ImageGetImage ()
 
void SaveWithBlending (System::SharedPtr< System::IO::Stream > stream, int32_t resolution)
 
System::SharedPtr< System::IO::StreamMakeGrayscaleRawBytes ()
 
void UpdateMetadata ()
 
virtual ASPOSE_PDF_SHARED_API ~XImage ()
 

Static Protected Member Functions

static System::SharedPtr< System::Drawing::Imaging::ImageFormatget_DefaultImageFormat ()
 Gets default image format. More...
 
static bool IsImage (System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfPrimitive > primitive)
 Returns true if the primitive is an image. More...
 
static System::SharedPtr< System::Drawing::BitmapMakeGrayscale (System::SharedPtr< System::IO::Stream > original)
 
static bool IsBitmapFilled (System::SharedPtr< System::Drawing::Bitmap > bitmap, uint8_t whiteColorReplace)
 
static bool IsBitmapFilledRgb (System::SharedPtr< System::Drawing::Bitmap > bitmap, uint8_t whiteColorReplace)
 
static int32_t GetRgbDelta (System::Drawing::Color color)
 Grayscale would have a delta of 0. More...
 

Protected Attributes

System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream > EngineImg
 IPdfImage object which decribes image. More...
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 

Detailed Description

Class representing image X-Object.

Constructor & Destructor Documentation

◆ XImage() [1/2]

Aspose::Pdf::XImage::XImage ( System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream >  image,
System::SharedPtr< Aspose::Pdf::XImageCollection parent 
)
protected

◆ XImage() [2/2]

Aspose::Pdf::XImage::XImage ( System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream >  image)
protected

◆ ~XImage()

virtual ASPOSE_PDF_SHARED_API Aspose::Pdf::XImage::~XImage ( )
protectedvirtual

Member Function Documentation

◆ Delete()

void Aspose::Pdf::XImage::Delete ( )
protected

Deletes image from the parent collection.

◆ DetectColorType()

static ASPOSE_PDF_SHARED_API Aspose::Pdf::ColorType Aspose::Pdf::XImage::DetectColorType ( System::SharedPtr< System::Drawing::Bitmap bmp)
static

Returns color type of image.

◆ get_BlackAndWhite()

System::SharedPtr<System::Drawing::Image> Aspose::Pdf::XImage::get_BlackAndWhite ( )
protected

Gets black and white version of image.

◆ get_ColorSpace()

System::ArrayPtr<System::String> Aspose::Pdf::XImage::get_ColorSpace ( )
protected

◆ get_ContainsTransparency()

ASPOSE_PDF_SHARED_API bool Aspose::Pdf::XImage::get_ContainsTransparency ( )

If the image contains transparancy than return true; otherwise, false.

◆ get_DefaultImageFormat()

static System::SharedPtr<System::Drawing::Imaging::ImageFormat> Aspose::Pdf::XImage::get_DefaultImageFormat ( )
staticprotected

Gets default image format.

◆ get_EngineObject()

System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfObject> Aspose::Pdf::XImage::get_EngineObject ( )
protected

◆ get_FilterType()

ASPOSE_PDF_SHARED_API Aspose::Pdf::ImageFilterType Aspose::Pdf::XImage::get_FilterType ( )

Gets image filter type.

◆ get_Grayscaled()

ASPOSE_PDF_SHARED_API System::SharedPtr<System::Drawing::Image> Aspose::Pdf::XImage::get_Grayscaled ( )

Gets grayscaled version of image.

◆ get_HasSMask()

bool Aspose::Pdf::XImage::get_HasSMask ( )
protected

If the image contains smask than return true; otherwise, false.

◆ get_Height()

ASPOSE_PDF_SHARED_API int32_t Aspose::Pdf::XImage::get_Height ( )

Gets height of the image.

◆ get_Metadata()

ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Metadata> Aspose::Pdf::XImage::get_Metadata ( )

Metadata of the image.

◆ get_Name()

ASPOSE_PDF_SHARED_API System::String Aspose::Pdf::XImage::get_Name ( )

Gets image name. Please note that if you change name of the image which has references in page contents, document may became incorrect. Please use XImage.Rename method in this case.

◆ get_Parent()

System::SharedPtr<Aspose::Pdf::XImageCollection> Aspose::Pdf::XImage::get_Parent ( ) const
protected

◆ get_PdfImage()

System::SharedPtr<Aspose::Pdf::Engine::CommonData::Graphics::Images::IPdfImage> Aspose::Pdf::XImage::get_PdfImage ( )
protected

Gets the IPdfImage.

◆ get_Width()

ASPOSE_PDF_SHARED_API int32_t Aspose::Pdf::XImage::get_Width ( )

Gets width of the image.

◆ GetBitmap()

System::SharedPtr<System::Drawing::Bitmap> Aspose::Pdf::XImage::GetBitmap ( )
protected

◆ GetColorType()

ASPOSE_PDF_SHARED_API Aspose::Pdf::ColorType Aspose::Pdf::XImage::GetColorType ( )

Returns color type of image.

Returns
The color type value.

◆ GetImage()

System::SharedPtr<System::Drawing::Image> Aspose::Pdf::XImage::GetImage ( )
protected

◆ GetNameInCollection()

ASPOSE_PDF_SHARED_API System::String Aspose::Pdf::XImage::GetNameInCollection ( )

Returns name of the image in ints collection.

Returns
Image key (name).

◆ GetRgbDelta()

static int32_t Aspose::Pdf::XImage::GetRgbDelta ( System::Drawing::Color  color)
staticprotected

Grayscale would have a delta of 0.

Parameters
colorThe color for which to calculate the delta.
Returns
The difference in the RGB values.

◆ IsBitmapFilled()

static bool Aspose::Pdf::XImage::IsBitmapFilled ( System::SharedPtr< System::Drawing::Bitmap bitmap,
uint8_t  whiteColorReplace 
)
staticprotected

◆ IsBitmapFilledRgb()

static bool Aspose::Pdf::XImage::IsBitmapFilledRgb ( System::SharedPtr< System::Drawing::Bitmap bitmap,
uint8_t  whiteColorReplace 
)
staticprotected

◆ IsImage()

static bool Aspose::Pdf::XImage::IsImage ( System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfPrimitive >  primitive)
staticprotected

Returns true if the primitive is an image.

◆ IsTheSameObject()

ASPOSE_PDF_SHARED_API bool Aspose::Pdf::XImage::IsTheSameObject ( System::SharedPtr< Aspose::Pdf::XImage image)

Returns true if both images references to the same object.

Parameters
imageImage to be compared with "this" image.
Returns
Boolean value which is true if images references to the same object.

◆ MakeGrayscale()

static System::SharedPtr<System::Drawing::Bitmap> Aspose::Pdf::XImage::MakeGrayscale ( System::SharedPtr< System::IO::Stream original)
staticprotected

◆ MakeGrayscaleRawBytes()

System::SharedPtr<System::IO::Stream> Aspose::Pdf::XImage::MakeGrayscaleRawBytes ( )
protected

◆ MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION() [1/2]

Aspose::Pdf::XImage::MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION ( XImage  ,
CODEPORTING_ARGS(System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream > image, System::SharedPtr< Aspose::Pdf::XImageCollection > parent)   
)
protected

◆ MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION() [2/2]

Aspose::Pdf::XImage::MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION ( XImage  ,
CODEPORTING_ARGS(System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDataStream > image)   
)
protected

◆ Rename()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::XImage::Rename ( System::String  name)

Renames image and replaces all references to the image with the new name

Parameters
nameNew image name.

◆ Replace()

void Aspose::Pdf::XImage::Replace ( System::SharedPtr< System::IO::Stream image)
protected

Replaces image onto stream specified in image .

Parameters
imageStream with image data.

◆ Save() [1/4]

ASPOSE_PDF_SHARED_API void Aspose::Pdf::XImage::Save ( System::SharedPtr< System::IO::Stream stream)

Saves image data into stream as JPEG image.

Parameters
streamStream where image data will be saved.

◆ Save() [2/4]

ASPOSE_PDF_SHARED_API void Aspose::Pdf::XImage::Save ( System::SharedPtr< System::IO::Stream stream,
System::SharedPtr< System::Drawing::Imaging::ImageFormat format 
)

Saves image into stream with requested format.

Parameters
streamStream where image will be saved
formatFormat which will be used for image enconding. ImageFormat

◆ Save() [3/4]

ASPOSE_PDF_SHARED_API void Aspose::Pdf::XImage::Save ( System::SharedPtr< System::IO::Stream stream,
int32_t  resolution 
)

Saves image data into stream as JPEG image with specified resolution.

Parameters
streamStream where image data will be saved.
resolutionImage resolution

◆ Save() [4/4]

ASPOSE_PDF_SHARED_API void Aspose::Pdf::XImage::Save ( System::SharedPtr< System::IO::Stream stream,
System::SharedPtr< System::Drawing::Imaging::ImageFormat format,
int32_t  resolution 
)

Saves image into stream with requested format with specified resolution.

Parameters
streamStream where image will be saved
formatFormat which will be used for image enconding. ImageFormat
resolutionImage resolution

◆ SaveWithBlending()

void Aspose::Pdf::XImage::SaveWithBlending ( System::SharedPtr< System::IO::Stream stream,
int32_t  resolution 
)
protected

◆ set_Name()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::XImage::set_Name ( System::String  value)

Sets image name. Please note that if you change name of the image which has references in page contents, document may became incorrect. Please use XImage.Rename method in this case.

◆ ToStream()

ASPOSE_PDF_SHARED_API System::SharedPtr<System::IO::Stream> Aspose::Pdf::XImage::ToStream ( )

Returns the original image stream.

Returns
The original image stream.

◆ UpdateMetadata()

void Aspose::Pdf::XImage::UpdateMetadata ( )
protected

Member Data Documentation

◆ EngineImg

System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfDataStream> Aspose::Pdf::XImage::EngineImg
protected

IPdfImage object which decribes image.