public final class PathResourceConverter extends Object
Converts PathResource to GraphicsPath and vice versa.
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");
}
| Modifier and Type | Method and Description |
|---|---|
static PathResource[] |
fromGraphicsPath(GraphicsPath graphicsPath,
Size imageSize)
Converts the
GraphicsPath instance to path resources. |
static GraphicsPath |
toGraphicsPath(PathResource[] pathResources,
Size imageSize)
Converts path resources to the
GraphicsPath instance. |
public static GraphicsPath toGraphicsPath(PathResource[] pathResources, Size imageSize)
Converts path resources to the GraphicsPath instance.
pathResources - The path resources.imageSize - Size of the image.GraphicsPath instance.com.aspose.ms.System.ArgumentNullException - pathResources is null.public static PathResource[] fromGraphicsPath(GraphicsPath graphicsPath, Size imageSize)
Converts the GraphicsPath instance to path resources.
graphicsPath - The graphics path.imageSize - Size of the image.com.aspose.ms.System.ArgumentNullException - graphicsPath is null.Copyright (c) 2008-2022 Aspose Pty Ltd. All Rights Reserved.