Defines an image for a shape.
Use the ImageData property to access and modify the image inside a shape. You do not create instances of the ImageData class directly.
An image can be stored inside a shape, linked to external file or both (linked and stored in the document).
Regardless of whether the image is stored inside the shape or linked, you can always access the actual image using the ToByteArray, ToStream, ToImage or Save() methods. If the image is stored inside the shape, you can also directly access it using the ImageBytes property.
To store an image inside a shape use the SetImage() method. To link an image to a shape, set the SourceFullName property.
Shows how to extract images from a document, and save them to the local file system as individual files.
Shows how to insert a linked image into a document.
#include <Aspose.Words.Cpp/Drawing/ImageData.h>
Public Member Functions | |
bool | get_BiLevel () |
Determines whether an image will be displayed in black and white. More... | |
SharedPtr< BorderCollection > | get_Borders () |
Gets the collection of borders of the image. Borders only have effect for inline images. More... | |
double | get_Brightness () |
Gets or sets the brightness of the picture. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). More... | |
Color | get_ChromaKey () |
Defines the color value of the image that will be treated as transparent. More... | |
double | get_Contrast () |
Gets or sets the contrast for the specified picture. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). More... | |
double | get_CropBottom () |
Defines the fraction of picture removal from the bottom side. More... | |
double | get_CropLeft () |
Defines the fraction of picture removal from the left side. More... | |
double | get_CropRight () |
Defines the fraction of picture removal from the right side. More... | |
double | get_CropTop () |
Defines the fraction of picture removal from the top side. More... | |
bool | get_GrayScale () |
Determines whether a picture will display in grayscale mode. More... | |
bool | get_HasImage () |
Returns true if the shape has image bytes or links an image. More... | |
ArrayPtr< uint8_t > | get_ImageBytes () |
Gets or sets the raw bytes of the image stored in the shape. More... | |
SharedPtr< ImageSize > | get_ImageSize () |
Gets the information about image size and resolution. More... | |
ImageType | get_ImageType () |
Gets the type of the image. More... | |
bool | get_IsLink () |
Returns true if the image is linked to the shape (when SourceFullName is specified). More... | |
bool | get_IsLinkOnly () |
Returns true if the image is linked and not stored in the document. More... | |
String | get_SourceFullName () |
Gets or sets the path and name of the source file for the linked image. More... | |
String | get_Title () |
Defines the title of an image. More... | |
virtual const TypeInfo & | GetType () const override |
virtual bool | Is (const TypeInfo &target) const override |
void | Save (SharedPtr< Stream > stream) |
Saves the image into the specified stream. More... | |
void | Save (String fileName) |
Saves the image into a file. More... | |
void | set_BiLevel (bool value) |
Setter for get_BiLevel. More... | |
void | set_Brightness (double value) |
Setter for get_Brightness. More... | |
void | set_ChromaKey (Color value) |
Setter for get_ChromaKey. More... | |
void | set_Contrast (double value) |
Setter for get_Contrast. More... | |
void | set_CropBottom (double value) |
Setter for get_CropBottom. More... | |
void | set_CropLeft (double value) |
Setter for get_CropLeft. More... | |
void | set_CropRight (double value) |
Setter for get_CropRight. More... | |
void | set_CropTop (double value) |
Setter for get_CropTop. More... | |
void | set_GrayScale (bool value) |
Setter for get_GrayScale. More... | |
void | set_ImageBytes (ArrayPtr< uint8_t > value) |
Setter for get_ImageBytes. More... | |
void | set_SourceFullName (String value) |
Setter for get_SourceFullName. More... | |
void | set_Title (String value) |
Setter for get_Title. More... | |
void | SetImage (SharedPtr< Image > image) |
Sets the image that the shape displays. More... | |
void | SetImage (SharedPtr< Stream > stream) |
Sets the image that the shape displays. More... | |
void | SetImage (String fileName) |
Sets the image that the shape displays. More... | |
ArrayPtr< uint8_t > | ToByteArray () |
Returns image bytes for any image regardless whether the image is stored or linked. More... | |
SharedPtr< Image > | ToImage () |
Gets the image stored in the shape as a Image object. More... | |
SharedPtr< Stream > | ToStream () |
Creates and returns a stream that contains the image bytes. More... | |
Static Public Member Functions | |
static const TypeInfo & | Type () |
bool Aspose::Words::Drawing::ImageData::get_BiLevel | ( | ) |
Determines whether an image will be displayed in black and white.
The default value is false.
Shows how to edit a shape's image data.
System::SharedPtr<Aspose::Words::BorderCollection> Aspose::Words::Drawing::ImageData::get_Borders | ( | ) |
Gets the collection of borders of the image. Borders only have effect for inline images.
Shows how to edit a shape's image data.
double Aspose::Words::Drawing::ImageData::get_Brightness | ( | ) |
Gets or sets the brightness of the picture. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest).
The default value is 0.5.
Shows how to edit a shape's image data.
System::Drawing::Color Aspose::Words::Drawing::ImageData::get_ChromaKey | ( | ) |
Defines the color value of the image that will be treated as transparent.
The default value is 0.
Shows how to edit a shape's image data.
double Aspose::Words::Drawing::ImageData::get_Contrast | ( | ) |
Gets or sets the contrast for the specified picture. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast).
The default value is 0.5.
Shows how to edit a shape's image data.
double Aspose::Words::Drawing::ImageData::get_CropBottom | ( | ) |
Defines the fraction of picture removal from the bottom side.
The amount of cropping can range from -1.0 to 1.0. The default value is 0. Note that a value of 1 will display no picture at all. Negative values will result in the picture being squeezed inward from the edge being cropped (the empty space between the picture and the cropped edge will be filled by the fill color of the shape). Positive values less than 1 will result in the remaining picture being stretched to fit the shape.
The default value is 0.
Shows how to edit a shape's image data.
double Aspose::Words::Drawing::ImageData::get_CropLeft | ( | ) |
Defines the fraction of picture removal from the left side.
The amount of cropping can range from -1.0 to 1.0. The default value is 0. Note that a value of 1 will display no picture at all. Negative values will result in the picture being squeezed inward from the edge being cropped (the empty space between the picture and the cropped edge will be filled by the fill color of the shape). Positive values less than 1 will result in the remaining picture being stretched to fit the shape.
The default value is 0.
Shows how to edit a shape's image data.
double Aspose::Words::Drawing::ImageData::get_CropRight | ( | ) |
Defines the fraction of picture removal from the right side.
The amount of cropping can range from -1.0 to 1.0. The default value is 0. Note that a value of 1 will display no picture at all. Negative values will result in the picture being squeezed inward from the edge being cropped (the empty space between the picture and the cropped edge will be filled by the fill color of the shape). Positive values less than 1 will result in the remaining picture being stretched to fit the shape.
The default value is 0.
Shows how to edit a shape's image data.
double Aspose::Words::Drawing::ImageData::get_CropTop | ( | ) |
Defines the fraction of picture removal from the top side.
The amount of cropping can range from -1.0 to 1.0. The default value is 0. Note that a value of 1 will display no picture at all. Negative values will result in the picture being squeezed inward from the edge being cropped (the empty space between the picture and the cropped edge will be filled by the fill color of the shape). Positive values less than 1 will result in the remaining picture being stretched to fit the shape.
The default value is 0.
Shows how to edit a shape's image data.
bool Aspose::Words::Drawing::ImageData::get_GrayScale | ( | ) |
Determines whether a picture will display in grayscale mode.
The default value is false.
Shows how to edit a shape's image data.
bool Aspose::Words::Drawing::ImageData::get_HasImage | ( | ) |
Returns true if the shape has image bytes or links an image.
Shows how to save all images from a document to the file system.
System::ArrayPtr<uint8_t> Aspose::Words::Drawing::ImageData::get_ImageBytes | ( | ) |
Gets or sets the raw bytes of the image stored in the shape.
Setting the value to null
or an empty array will remove the image from the shape.
Returns null
if the image is not stored in the document (e.g the image is probably linked in this case).
Shows how to create an image file from a shape's raw image data.
System::SharedPtr<Aspose::Words::Drawing::ImageSize> Aspose::Words::Drawing::ImageData::get_ImageSize | ( | ) |
Gets the information about image size and resolution.
If the image is linked only and not stored in the document, returns zero size.
Shows how to resize a shape with an image.
Aspose::Words::Drawing::ImageType Aspose::Words::Drawing::ImageData::get_ImageType | ( | ) |
Gets the type of the image.
Shows how to extract images from a document, and save them to the local file system as individual files.
bool Aspose::Words::Drawing::ImageData::get_IsLink | ( | ) |
Returns true if the image is linked to the shape (when SourceFullName is specified).
Shows how to edit a shape's image data.
bool Aspose::Words::Drawing::ImageData::get_IsLinkOnly | ( | ) |
Returns true if the image is linked and not stored in the document.
Shows how to edit a shape's image data.
System::String Aspose::Words::Drawing::ImageData::get_SourceFullName | ( | ) |
Gets or sets the path and name of the source file for the linked image.
The default value is an empty string.
If SourceFullName is not an empty string, the image is linked.
Shows how to insert a linked image into a document.
System::String Aspose::Words::Drawing::ImageData::get_Title | ( | ) |
Defines the title of an image.
The default value is an empty string.
Shows how to edit a shape's image data.
|
overridevirtual |
|
overridevirtual |
void Aspose::Words::Drawing::ImageData::Save | ( | System::SharedPtr< System::IO::Stream > | stream | ) |
Saves the image into the specified stream.
Is it the responsibility of the caller to dispose the stream object.
stream | The stream where to save the image to. |
Shows how to save all images from a document to the file system.
void Aspose::Words::Drawing::ImageData::Save | ( | System::String | fileName | ) |
Saves the image into a file.
fileName | The file name where to save the image. |
Shows how to extract images from a document, and save them to the local file system as individual files.
void Aspose::Words::Drawing::ImageData::set_BiLevel | ( | bool | value | ) |
Setter for Aspose::Words::Drawing::ImageData::get_BiLevel.
void Aspose::Words::Drawing::ImageData::set_Brightness | ( | double | value | ) |
void Aspose::Words::Drawing::ImageData::set_ChromaKey | ( | System::Drawing::Color | value | ) |
Setter for Aspose::Words::Drawing::ImageData::get_ChromaKey.
void Aspose::Words::Drawing::ImageData::set_Contrast | ( | double | value | ) |
Setter for Aspose::Words::Drawing::ImageData::get_Contrast.
void Aspose::Words::Drawing::ImageData::set_CropBottom | ( | double | value | ) |
void Aspose::Words::Drawing::ImageData::set_CropLeft | ( | double | value | ) |
Setter for Aspose::Words::Drawing::ImageData::get_CropLeft.
void Aspose::Words::Drawing::ImageData::set_CropRight | ( | double | value | ) |
Setter for Aspose::Words::Drawing::ImageData::get_CropRight.
void Aspose::Words::Drawing::ImageData::set_CropTop | ( | double | value | ) |
Setter for Aspose::Words::Drawing::ImageData::get_CropTop.
void Aspose::Words::Drawing::ImageData::set_GrayScale | ( | bool | value | ) |
Setter for Aspose::Words::Drawing::ImageData::get_GrayScale.
void Aspose::Words::Drawing::ImageData::set_ImageBytes | ( | System::ArrayPtr< uint8_t > | value | ) |
void Aspose::Words::Drawing::ImageData::set_SourceFullName | ( | System::String | value | ) |
void Aspose::Words::Drawing::ImageData::set_Title | ( | System::String | value | ) |
Setter for Aspose::Words::Drawing::ImageData::get_Title.
void Aspose::Words::Drawing::ImageData::SetImage | ( | System::SharedPtr< System::Drawing::Image > | image | ) |
Sets the image that the shape displays.
image | The image object. |
Shows how to display images from the local file system in a document.
void Aspose::Words::Drawing::ImageData::SetImage | ( | System::SharedPtr< System::IO::Stream > | stream | ) |
Sets the image that the shape displays.
stream | The stream that contains the image. |
Shows how to display images from the local file system in a document.
void Aspose::Words::Drawing::ImageData::SetImage | ( | System::String | fileName | ) |
Sets the image that the shape displays.
fileName | The image file. Can be a file name or a URL. |
Shows how to insert a linked image into a document.
System::ArrayPtr<uint8_t> Aspose::Words::Drawing::ImageData::ToByteArray | ( | ) |
Returns image bytes for any image regardless whether the image is stored or linked.
If the image is linked, downloads the image every time it is called.
Shows how to create an image file from a shape's raw image data.
System::SharedPtr<System::Drawing::Image> Aspose::Words::Drawing::ImageData::ToImage | ( | ) |
Gets the image stored in the shape as a Image object.
A new Image object is created every time this method is called.
It is the responsibility of the caller to dispose the image object.
Shows how to save all images from a document to the file system.
System::SharedPtr<System::IO::Stream> Aspose::Words::Drawing::ImageData::ToStream | ( | ) |
Creates and returns a stream that contains the image bytes.
If the image bytes are stored in the shape, creates and returns a MemoryStream object.
If the image is linked and stored in a file, opens the file and returns a FileStream object.
If the image is linked and stored in an external URL, downloads the file and returns a MemoryStream object.
Is it the responsibility of the caller to dispose the stream object.
Shows how to create an image file from a shape's raw image data.
|
static |