Packages

 

com.aspose.imaging.fileformats.metafile

Class MetafileImage

    • Method Detail

      • getBounds

        public abstract Rectangle getBounds()
        Returns the metafile's bounds.
        Note: this rectangle is not an image size. To get image size and position use getMinX(), getMinY(), getWidth() and getHeight().
        Specified by:
        getBounds in interface IObjectWithBounds
        Overrides:
        getBounds in class Image
        Returns:
        metafile's bounds.
      • playMetafile

        public abstract void playMetafile(Graphics2D target)
                                   throws MetafilesException
        Plays a metafile without transform to the specified Graphics2D object.
        Parameters:
        target - - Graphics2D object.
        Throws:
        MetafilesException
      • playMetafile

        public abstract void playMetafile(Graphics2D target,
                                          AffineTransform trans)
                                   throws MetafilesException
        Plays a metafile to the specified Graphics2D object.
        Parameters:
        target - - Graphics2D object.
        trans - - coordinates transformation from metafile's coordinates to Graphics2D user space.
        Throws:
        MetafilesException
      • getSources

        public Vector getSources()
        Required by RenderableImage interface. Always returns null.
      • getMinX

        public float getMinX()
        Returns the minimum X coordinate of a metafile.
      • getMinY

        public float getMinY()
        Returns the minimum Y coordinate of a metafile.
      • resize

        public void resize(int newWidth,
                           int newHeight,
                           ImageResizeSettings settings)
        Description copied from class: Image

        Resizes the image.

        Specified by:
        resize in class Image
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        settings - The resize settings.
      • isDynamic

        public boolean isDynamic()
        Required by RenderableImage interface. Always returns false.
      • getPropertyNames

        public String[] getPropertyNames()
        Required by RenderableImage interface. Returns an empty array.
      • getProperty

        public Object getProperty(String name)
        Required by RenderableImage interface. Returns java.awt.Image.UndefinedProperty.
      • createScaledRendering

        public RenderedImage createScaledRendering(int w,
                                                   int h,
                                                   RenderingHints hints)
        Creates a RenderedImage with the specified width and height.
        Parameters:
        w - - image width.
        h - - image height.
        hints - - RenderingHits used to draw and scale metafile.
      • createDefaultRendering

        public RenderedImage createDefaultRendering()
        Creates a RenderedImage with default size unless it exceeds MinPixelCount..MaxPixelCount range. Unlike the other create*Rendering() functions, produced image's left and top coordinates are zeroes.
      • setDefaultRenderingHints

        public void setDefaultRenderingHints(RenderingHints rh)
        Replaces current metafile's default RenderingHints.

        Note: default rendering hints used only by createRendering(), createDefaultRendering(), createScaledRendering() and methods, which use them. For example Graphics2D.DrawRenderableImage().

        PlayMetafile() method uses RenderingHints of the specified Graphics2D object. When another RenderingHints object passed to createScaledRendering() or createRendering() via RenderContext object, function merges it with default RenderingHints. Caller's RenderingHints overrides metafile's default.
        Parameters:
        rh - - new default RenderingHints.
      • getDefaultRenderingHints

        public RenderingHints getDefaultRenderingHints()
        Returns metafile's default RenderingHints.
      • getTextOutOperations

        public com.aspose.imaging.fileformats.metafile.TextOutOperation[] getTextOutOperations()
                                                                                        throws MetafilesException
        Returns all TextOut Operations of a metafile.
        Throws:
        MetafilesException
      • crop

        public void crop(int leftShift,
                         int rightShift,
                         int topShift,
                         int bottomShift)

        Crop image with shifts.

        Parameters:
        leftShift - The left shift.
        rightShift - The right shift.
        topShift - The top shift.
        bottomShift - The bottom shift.
      • crop

        public void crop(Rectangle rectangle)

        Crops the specified rectangle.

        Parameters:
        rectangle - The rectangle.
      • getCroppingRectangle

        public Rectangle getCroppingRectangle()

        Returns the copping rectangle.

        Returns:
        The cropping rectangle.
      • getMinPixelCount

        public int getMinPixelCount()
        Returns a minimum number of pixels in the image created by createDefaultRendering() method. Image will be scaled in case it has smaller size. Default value is 0.
      • setMinPixelCount

        public void setMinPixelCount(int value)
        Sets a minimum number of pixels in the image, created by createDefaultRendering() method. Image will be scaled in case it has smaller size. Default value is 0.
      • getMaxPixelCount

        public int getMaxPixelCount()
        Returns a maximum number of pixels in the image, created by createDefaultRendering() method. Image will be scaled in case it has too large size. Default value is 10000000.
      • setMaxPixelCount

        public void setMaxPixelCount(int value)
        Sets a maximum number of pixels in the image, created by createDefaultRendering() method. Image will be scaled in case it has too large size. Default value is 10000000.
      • getRenderableBackgroundColor

        public Color getRenderableBackgroundColor()
        Returns a color to fill a RenderedImage generated by RenderableImage's methods. Value null means transparent color. This affects createDefaultRendering(), createScaledRendering(), createRendering() and all relying on them (for example, Graphics2D.drawRenderableImage()). PlayMetafile() ignores this value.
      • setRenderableBackgroundColor

        public void setRenderableBackgroundColor(Color color)
        Sets a color to fill a RenderedImage generated by RenderableImage's methods. Value null means transparent color. This affects createDefaultRendering(), createScaledRendering(), createRendering() and all relying on them (for example, Graphics2D.drawRenderableImage()). PlayMetafile() ignores this value.
      • getEmbeddedBitmaps

        public com.aspose.imaging.fileformats.metafile.EmbeddedBitmap[] getEmbeddedBitmaps()
        Returns an array containing copies of binary data of all embedded bitmaps.
      • clone

        public Object clone()
        Creates a copy of the metafile object. All immutable internal data (actually, metafile itself) is shared between clones so it is safe memory-wise to create any reasonable number of clones.
        Overrides:
        clone in class Object
      • isCached

        public boolean isCached()
        Description copied from class: DataStreamSupporter

        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.
      • cacheData

        public void cacheData()
        Description copied from class: DataStreamSupporter

        Caches the data and ensures no additional data loading will be performed from the underlying DataStreamSupporter.DataStreamContainer.

        Specified by:
        cacheData in class DataStreamSupporter
      • resize

        public void resize(int newWidth,
                           int newHeight,
                           int resizeType)
        Description copied from class: Image

        Resizes the image.

        Specified by:
        resize in class Image
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        resizeType - The resize type.
      • rotateFlip

        public void rotateFlip(int rotateFlipType)
        Description copied from class: Image

        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)
        Description copied from class: Image

        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.
      • getBitsPerPixel

        public int getBitsPerPixel()
        Description copied from class: Image

        Gets the image bits per pixel count.

        Specified by:
        getBitsPerPixel in class Image
        Returns:
        The image bits per pixel count.
      • getWatermarkDrawer

        public abstract com.aspose.imaging.fileformats.metafile.MetafileRecorderGraphics2D getWatermarkDrawer()

        Returns the custom watermark drawer

        Returns:
        Graphics2D watermark drawer.
      • getUsedFonts

        public abstract String[] getUsedFonts()
        Returns the list of font which used inside metafile.
        Returns:
        Font list
      • getMissedFonts

        public abstract String[] getMissedFonts()
        Retu rns the list of fonts which used inside metafile and are not found in system.
        Returns:
        Font list