Packages

 

com.aspose.imaging.fileformats.tiff.pathresources

Class PathResourceConverter

  • java.lang.Object
    • com.aspose.imaging.fileformats.tiff.pathresources.PathResourceConverter


  • public final class PathResourceConverter
    extends Object

    Converts PathResource to GraphicsPath and vice versa.

    Code example:

    Create Graphics Path from Path Resources in TIFF image.


    try (TiffImage image = (TiffImage)Image.load("Bottle.tif"))
    {
        // Create the GraphicsPath using PathResources from TIFF image
        GraphicsPath graphicsPath = PathResourceConverter.toGraphicsPath(
                image.getActiveFrame().getPathResources().toArray(new PathResource[0]), 
                image.getActiveFrame().getSize());
        Graphics graphics = new Graphics(image);
    
        // Draw red line and save the image
        graphics.drawPath(new Pen(Color.getRed(), 10), graphicsPath);
        image.save("BottleWithRedBorder.tif");
    }
    

    • Method Detail

      • toGraphicsPath

        public static GraphicsPath toGraphicsPath(PathResource[] pathResources,
                                                  Size imageSize)

        Converts path resources to the GraphicsPath instance.

        Parameters:
        pathResources - The path resources.
        imageSize - Size of the image.
        Returns:
        The GraphicsPath instance.
        Throws:
        com.aspose.ms.System.ArgumentNullException - pathResources is null.
      • fromGraphicsPath

        public static PathResource[] fromGraphicsPath(GraphicsPath graphicsPath,
                                                      Size imageSize)

        Converts the GraphicsPath instance to path resources.

        Parameters:
        graphicsPath - The graphics path.
        imageSize - Size of the image.
        Returns:
        The path resources.
        Throws:
        com.aspose.ms.System.ArgumentNullException - graphicsPath is null.