Packages

 

com.aspose.imaging.fileformats.cdr

Class CdrImage

  • All Implemented Interfaces:
    ICdrImage, IObjectWithBounds, com.aspose.ms.System.IDisposable, Closeable, AutoCloseable


    public class CdrImage
    extends Image
    implements ICdrImage

    The Cdr image.

    See Also:
    Image, ICdrImage
    Code example:

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


    String dir = "c:\\temp\\";
    
    // Load an image from a CDR file.
    com.aspose.imaging.fileformats.cdr.CdrImage image = (com.aspose.imaging.fileformats.cdr.CdrImage) com.aspose.imaging.Image.load(dir + "sample.cdr");
    try {
        // 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.
        for (com.aspose.imaging.fileformats.cdr.CdrImagePage page : image.getPages()) {
            page.cacheData();
        }
    } finally {
        image.dispose();
    }
    

    • Constructor Detail

      • CdrImage

        public CdrImage(InputStream stream,
                        LoadOptions loadOptions)

        Initializes a new instance of the CdrImage class.

        Parameters:
        stream - The stream.
        loadOptions - The load options.
        Throws:
        com.aspose.ms.System.IndexOutOfRangeException - This document not be contained pages
      • CdrImage

        public CdrImage(com.aspose.ms.System.IO.Stream stream,
                        LoadOptions loadOptions)
    • Method Detail

      • isCached

        public boolean isCached()

        Gets a value indicating whether object's data is cached currently and no data readig is required.

        Specified by:
        isCached in class DataStreamSupporter
        Returns:
        true if object's data is cached; otherwise, false.
      • getBitsPerPixel

        public int getBitsPerPixel()

        Gets the image bits per pixel count.

        Specified by:
        getBitsPerPixel in class Image
        Returns:
        the image bits per pixel count.
      • getPageCount

        public final int getPageCount()

        Gets the page count.

        Returns:
        the page count.
      • setPageCount

        public final void setPageCount(int value)

        Sets the page count.

        Parameters:
        value - the page count.
      • getPages

        public final CdrImagePage[] getPages()

        Gets the pages.

        Returns:
        the pages.
      • getFileFormat

        public long getFileFormat()

        Gets a value of file format

        Overrides:
        getFileFormat in class Image
        Returns:
        a value of file format
      • cacheData

        public void cacheData()

        Caches the data and ensures no additional data loading will be performed from the underlying DataStreamSupporter.DataStreamContainer(DataStreamSupporter.getDataStreamContainer()/DataStreamSupporter.setDataStreamContainer_internalized(com.aspose.imaging.StreamContainer)).

        Specified by:
        cacheData in class DataStreamSupporter
        Code example:

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


        String dir = "c:\\temp\\";
        
        // Load an image from a CDR file.
        com.aspose.imaging.fileformats.cdr.CdrImage image = (com.aspose.imaging.fileformats.cdr.CdrImage) com.aspose.imaging.Image.load(dir + "sample.cdr");
        try {
            // 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.
            for (com.aspose.imaging.fileformats.cdr.CdrImagePage page : image.getPages()) {
                page.cacheData();
            }
        } finally {
            image.dispose();
        }
        

      • resize

        public void resize(int newWidth,
                           int newHeight,
                           int resizeType)

        Resizes the image.

        Specified by:
        resize in class Image
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        resizeType - The resize type.
        Throws:
        com.aspose.ms.System.NotImplementedException - method is not supported
      • resize

        public void resize(int newWidth,
                           int newHeight,
                           ImageResizeSettings settings)

        Resizes the image.

        Specified by:
        resize in class Image
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        settings - The resize settings.
        Throws:
        com.aspose.ms.System.NotImplementedException - method is not supported
      • rotateFlip

        public void rotateFlip(int rotateFlipType)

        Rotates, flips, or rotates and flips the image.

        Specified by:
        rotateFlip in class Image
        Parameters:
        rotateFlipType - Type of the rotate flip.
        Throws:
        com.aspose.ms.System.NotImplementedException - method is not supported
      • setPalette

        public void setPalette(IColorPalette palette,
                               boolean updateColors)

        Sets the image palette.

        Specified by:
        setPalette in class Image
        Parameters:
        palette - The palette to set.
        updateColors - if set to true colors will be updated according to the new palette; otherwise color indexes remain unchanged. Note that unchanged indexes may crash the image on loading if some indexes have no corresponding palette entries.
        Throws:
        com.aspose.ms.System.NotImplementedException - method is not supported