Packages

 

com.aspose.imaging.fileformats.cmx

Class CmxImage

  • All Implemented Interfaces:
    ICmxImage, 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 VectorImage
    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.

        Specified by:
        getBitsPerPixel in class Image
        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.

        Specified by:
        isCached in class DataStreamSupporter
        Returns:
        true if object's data is cached; otherwise, false.
      • 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 final CmxImagePage[] getPages()

        Gets the pages.

        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)).

        Specified by:
        cacheData in class DataStreamSupporter
        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.

        Specified by:
        resize in class Image
        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.

        Specified by:
        resize in class Image
        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.

        Specified by:
        rotateFlip in class Image
        Parameters:
        rotateFlipType - Type of the rotate flip.
      • 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.