Packages

 

com.aspose.imaging.fileformats.cmx

Class CmxImage

  • All Implemented Interfaces:
    ICmxImage, IMultipageImage, IObjectWithSizeF, IObjectWithBounds, com.aspose.imaging_internal.progressmanagement.IProgressEventHandler, com.aspose.imaging_internal.progressmanagement.IProgressInformer, com.aspose.ms.System.IDisposable, Closeable, AutoCloseable


    public class CmxImage
    extends VectorMultipageImage
    implements ICmxImage

    The CMX image.

    See Also:
    Image
    Code example:

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


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

    • Constructor Detail

      • CmxImage

        public CmxImage(StreamContainer streamContainer,
                        LoadOptions loadOptions)

        Initializes a new instance of the CmxImage class.

        Parameters:
        streamContainer - The stream container.
        loadOptions - The load options.
    • Method Detail

      • getFileFormat

        public long getFileFormat()

        Gets a value of file format

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

        public int getBitsPerPixel()

        Gets the image bits per pixel count.

        Overrides:
        getBitsPerPixel in class VectorMultipageImage
        Returns:
        the image bits per pixel count.
      • isCached

        public boolean isCached()

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

        Overrides:
        isCached in class VectorMultipageImage
        Returns:
        a value indicating whether object's data is cached currently and no data reading is required.
      • getDocument

        public final CmxDocument getDocument()

        Gets the CMX document.

        Returns:
        the CMX document.
      • getCmxPage

        public final CmxPage getCmxPage()

        Gets the CMX page.

        Specified by:
        getCmxPage in interface ICmxImage
        Returns:
        the CMX page.
      • getPages

        public Image[] getPages()

        Gets the pages.

        Specified by:
        getPages in interface IMultipageImage
        Specified by:
        getPages in class VectorMultipageImage
        Returns:
        the pages.
        Code example:

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


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

      • 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(StreamContainer)).

        Overrides:
        cacheData in class VectorMultipageImage
        Code example:

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


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

      • resize

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

        Resizes the image.

        Overrides:
        resize in class VectorMultipageImage
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        resizeType - The resize type.
      • resize

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

        Resizes the image.

        Overrides:
        resize in class VectorMultipageImage
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        settings - The resize settings.
      • rotateFlip

        public void rotateFlip(int rotateFlipType)

        Rotates, flips, or rotates and flips the image.

        Overrides:
        rotateFlip in class VectorMultipageImage
        Parameters:
        rotateFlipType - Type of the rotate flip.
      • setPalette

        public void setPalette(IColorPalette palette,
                               boolean updateColors)

        Sets the image palette.

        Overrides:
        setPalette in class VectorMultipageImage
        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.