CdrImage

CdrImage class

The API for CorelDRAW CDR vector image format support is an essential toolkit for developers working with vector graphics. This API enables the seamless processing of CDR files, allowing for the storage and manipulation of diverse elements such as text, lines, shapes, images, colors, and effects. With its comprehensive capabilities, developers can efficiently work with vector representations of image contents, ensuring precision and flexibility in creating and editing CorelDRAW vector graphics programmatically.

public class CdrImage : VectorMultipageImage, ICdrImage

Constructors

NameDescription
CdrImage(Stream, LoadOptions)Start working with the CdrImage class effortlessly by initializing a new instance with a stream and loadOptions parameters. Ideal for developers seeking a convenient way to load CDR images from various data sources while customizing the loading process as needed.

Properties

NameDescription
AutoAdjustPalette { get; set; }Gets or sets a value indicating whether automatic adjust palette.
virtual BackgroundColor { get; set; }Gets or sets a value for the background color.
override BitsPerPixel { get; }Retrieve the bit depth of the image effortlessly with this user-friendly property. Ideal for developers seeking to determine the level of detail or color depth present in their images, ensuring accurate processing and manipulation.
Bounds { get; }Gets the image bounds.
BufferSizeHint { get; set; }Gets or sets the buffer size hint which is defined max allowed size for all internal buffers.
CdrDocument { get; }Effortlessly retrieve or update the CDR document using this intuitive property. Ideal for developers seeking to access or modify the CDR document, ensuring flexibility and efficiency in their applications.
Container { get; }Gets the Image container.
DataStreamContainer { get; }Gets the object’s data stream.
Disposed { get; }Gets a value indicating whether this instance is disposed.
override FileFormat { get; }Retrieve the file format of the image effortlessly with this intuitive property. Ideal for developers seeking to determine the format of their images dynamically, ensuring compatibility and accurate processing in their applications.
virtual HasBackgroundColor { get; set; }Gets or sets a value indicating whether image has background color.
override Height { get; }Retrieve the height of the image effortlessly with this intuitive property. Perfect for developers seeking to access the dimensions of their images dynamically, ensuring accurate layout and rendering in their applications.
virtual HeightF { get; }Gets the object height, in inches.
InterruptMonitor { get; set; }Gets or sets the interrupt monitor.
override IsCached { get; }Effortlessly determine whether the object’s data is currently cached, eliminating the need for data reading. Ideal for developers seeking to optimize performance by leveraging cached data efficiently, ensuring faster access to object information.
override PageCount { get; }Effortlessly retrieve or update the total page count of the image with this intuitive property. Ideal for developers seeking to manage multi-page images dynamically, ensuring efficient navigation and manipulation of image content.
override PageExportingAction { get; set; }Effortlessly retrieve or modify the page exporting action associated with the image using this intuitive property. Ideal for developers seeking to customize the export behavior of pages within multi-page images, ensuring flexibility and efficiency in their applications. Please note that setting this method will automatically release page resources after it is executed. It will be executed just before each page is saved.
override Pages { get; }Retrieve the pages of the image seamlessly with this intuitive property. Ideal for developers seeking to access and manipulate individual pages within multi-page images, ensuring efficient navigation and processing.
Palette { get; set; }Gets or sets the color palette. The color palette is not used when pixels are represented directly.
Size { get; }Gets the image size.
SizeF { get; }Gets the object size, in inches.
virtual UsePalette { get; }Gets a value indicating whether the image palette is used.
override Width { get; }Retrieve the width of the image seamlessly with this intuitive property. Ideal for developers seeking to access the dimensions of their images dynamically, ensuring precise layout and rendering in their applications.
virtual WidthF { get; }Gets the object width, in inches.

Methods

NameDescription
override CacheData()Effortlessly cache the data to prevent additional loading from the underlying source with this user-friendly method. Ideal for developers seeking to optimize performance by preloading data, ensuring faster access and smoother operation in their applications. DataStreamContainer.
CanSave(ImageOptionsBase)Determines whether image can be saved to the specified file format represented by the passed save options.
Dispose()Disposes the current instance.
override GetDefaultOptions(object[])Retrieve the default options effortlessly with this user-friendly method. Perfect for developers seeking quick access to the default settings or configurations associated with an object, ensuring efficient customization and streamlined workflow.
override GetEmbeddedImages()Gets the embedded images.
virtual GetOriginalOptions()Gets the options based on the original file settings. This can be helpful to keep bit-depth and other parameters of the original image unchanged. For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the Save method, the output PNG image with 8-bit per pixel will be produced. To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass them to the Save method as the second parameter.
RemoveBackground()Removes the background.
RemoveBackground(RemoveBackgroundSettings)Removes the background.
Resize(int, int)Resizes the image. The default NearestNeighbourResample is used.
override Resize(int, int, ImageResizeSettings)Resizes the image.
override Resize(int, int, ResizeType)Effortlessly resize the image to desired dimensions with this intuitive method. Perfect for developers seeking to adjust the size of images dynamically, ensuring they fit the layout or requirements of their applications seamlessly.
ResizeHeightProportionally(int)Resizes the height proportionally. The default NearestNeighbourResample is used.
virtual ResizeHeightProportionally(int, ImageResizeSettings)Resizes the height proportionally.
virtual ResizeHeightProportionally(int, ResizeType)Resizes the height proportionally.
ResizeWidthProportionally(int)Resizes the width proportionally. The default NearestNeighbourResample is used.
virtual ResizeWidthProportionally(int, ImageResizeSettings)Resizes the width proportionally.
virtual ResizeWidthProportionally(int, ResizeType)Resizes the width proportionally.
override RotateFlip(RotateFlipType)Adjust the orientation of the image by rotating, flipping, or applying both operations with this versatile method. Perfect for developers seeking to customize image orientation dynamically, ensuring optimal presentation or alignment in their applications.
Save()Saves the image data to the underlying stream.
Save(Stream)Saves the object’s data to the specified stream.
override Save(string)Saves the image to the specified file location.
Save(Stream, ImageOptionsBase)Saves the image’s data to the specified stream in the specified file format according to save options.
virtual Save(string, bool)Saves the object’s data to the specified file location.
virtual Save(string, ImageOptionsBase)Saves the object’s data to the specified file location in the specified file format according to save options.
virtual Save(Stream, ImageOptionsBase, Rectangle)Saves the image’s data to the specified stream in the specified file format according to save options.
virtual Save(string, ImageOptionsBase, Rectangle)Saves the object’s data to the specified file location in the specified file format according to save options.
override SetPalette(IColorPalette, bool)Customize the color palette of the image with this intuitive method. Ideal for developers seeking to apply specific color schemes or adjustments dynamically, ensuring precise control over the visual appearance of their images.

Examples

The following example shows how to cache all pages of a CDR image.

[C#]

string dir = "c:\\temp\\";

// Load an image from a CDR file.
using (Aspose.Imaging.FileFormats.Cdr.CdrImage image = (Aspose.Imaging.FileFormats.Cdr.CdrImage)Aspose.Imaging.Image.Load(dir + "sample.cdr"))
{
    // This call caches only the default page.
    image.CacheData();

    // Cache all pages so that no additional data loading will be performed from the underlying data stream.
    foreach (Aspose.Imaging.FileFormats.Cdr.CdrImagePage page in image.Pages)
    {
        page.CacheData();
    }
}

See Also