Package ej.microvg

Class ResourceVectorImage

  • All Implemented Interfaces:
    Closeable, AutoCloseable
    Direct Known Subclasses:
    BufferedVectorImage

    public class ResourceVectorImage
    extends VectorImage
    implements Closeable
    Represents a vector image which requires dynamic allocation in order to be created.

    A resource vector image must be closed in order to free the dynamic allocation used to store the image data.

    • Constructor Detail

      • ResourceVectorImage

        public ResourceVectorImage()
    • Method Detail

      • isClosed

        public boolean isClosed()
        Returns whether this vector image has been closed or not.
        Returns:
        true if the vector image has been closed, false otherwise.
      • close

        public void close()
        Closes this vector image and its associated resources.

        Calling this method on a vector image which has already been closed has no effect.

        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
      • loadImage

        public static ResourceVectorImage loadImage​(String resourcePath)
        Loads a vector image from a path.

        This method can load images which are in the internal image format defined by the MicroVG implementation. The caller is responsible for calling close() on the returned image when it is no longer used.

        Parameters:
        resourcePath - the path to get the image from
        Returns:
        a vector image
        Throws:
        VectorGraphicsException - if the image could not be retrieved for any reason (see VectorGraphicsException.getErrorCode())
        Since:
        1.2