ContentAwareFillWatermarkOptions

Inheritance: java.lang.Object, com.aspose.imaging.watermark.options.WatermarkOptions

public class ContentAwareFillWatermarkOptions extends WatermarkOptions

常见的内容感知填充算法选项。

构造函数

构造函数描述
ContentAwareFillWatermarkOptions(Point[] mask)初始化一个新的 ContentAwareFillWatermarkOptions 类实例。
ContentAwareFillWatermarkOptions(GraphicsPath mask)初始化一个新的 ContentAwareFillWatermarkOptions 类实例。

方法

方法描述
getPatchSize()获取补丁大小(应为奇数)。
setPatchSize(byte value)设置补丁大小(应为奇数)。
getMaxPaintingAttempts()获取最大绘画尝试次数。
setMaxPaintingAttempts(int value)设置最大绘画尝试次数。
getInterestArea()获取用于取补丁的区域。
setInterestArea(Rectangle value)设置用于取补丁的区域。

Example: The example shows how to remove any object from the image using Graphics Path with Content Aware fill algorithm.

String imageFilePath = "ball.png"; 
try (Image image = Image.load(imageFilePath))
{
    PngImage pngImage = (PngImage)image;

    GraphicsPath mask = new GraphicsPath();
    Figure firstFigure = new Figure();
    firstFigure.addShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
    mask.addFigure(firstFigure);

    ContentAwareFillWatermarkOptions options = new ContentAwareFillWatermarkOptions(mask);
    options.setMaxPaintingAttempts(4);
    try (Image result = WatermarkRemover.paintOver(pngImage, options))
    {
        result.Save(outputPath);
    }
}

ContentAwareFillWatermarkOptions(Point[] mask)

public ContentAwareFillWatermarkOptions(Point[] mask)

初始化一个新的 ContentAwareFillWatermarkOptions 类实例。

Parameters:

参数类型描述
maskPoint[]未知区域的掩码。

ContentAwareFillWatermarkOptions(GraphicsPath mask)

public ContentAwareFillWatermarkOptions(GraphicsPath mask)

初始化一个新的 ContentAwareFillWatermarkOptions 类实例。

Parameters:

参数类型描述
maskGraphicsPath未知区域的掩码。

getPatchSize()

public final byte getPatchSize()

获取补丁大小(应为奇数)。

值:补丁的大小。

Returns: byte - 补丁大小(应为奇数)。

setPatchSize(byte value)

public final void setPatchSize(byte value)

设置补丁大小(应为奇数)。

值:补丁的大小。

Parameters:

参数类型描述
valuebyte补丁大小(应为奇数)。

getMaxPaintingAttempts()

public final int getMaxPaintingAttempts()

获取最大绘画尝试次数。算法将选择最佳变体。

值:最大绘画尝试次数。

Returns: int - 最大绘画尝试次数。

Example: The example shows how to remove any object from the image using Graphics Path with Content Aware fill algorithm.

String imageFilePath = "ball.png"; 
try (Image image = Image.load(imageFilePath))
{
    PngImage pngImage = (PngImage)image;

    GraphicsPath mask = new GraphicsPath();
    Figure firstFigure = new Figure();
    firstFigure.addShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
    mask.addFigure(firstFigure);

    ContentAwareFillWatermarkOptions options = new ContentAwareFillWatermarkOptions(mask);
    options.setMaxPaintingAttempts(4);
    try (Image result = WatermarkRemover.paintOver(pngImage, options))
    {
        result.Save(outputPath);
    }
}

setMaxPaintingAttempts(int value)

public final void setMaxPaintingAttempts(int value)

设置最大绘画尝试次数。算法将选择最佳变体。

值:最大绘画尝试次数。

Parameters:

参数类型描述
valueint最大绘画尝试次数。

Example: The example shows how to remove any object from the image using Graphics Path with Content Aware fill algorithm.

String imageFilePath = "ball.png"; 
try (Image image = Image.load(imageFilePath))
{
    PngImage pngImage = (PngImage)image;

    GraphicsPath mask = new GraphicsPath();
    Figure firstFigure = new Figure();
    firstFigure.addShape(new EllipseShape(new RectangleF(350, 170, 570 - 350, 400 - 170)));
    mask.addFigure(firstFigure);

    ContentAwareFillWatermarkOptions options = new ContentAwareFillWatermarkOptions(mask);
    options.setMaxPaintingAttempts(4);
    try (Image result = WatermarkRemover.paintOver(pngImage, options))
    {
        result.Save(outputPath);
    }
}

getInterestArea()

public final Rectangle getInterestArea()

获取用于取补丁的区域。

值:感兴趣的区域用于提取补丁。

Returns: Rectangle - the area to take patches.

setInterestArea(Rectangle value)

public final void setInterestArea(Rectangle value)

设置用于取补丁的区域。

值:感兴趣的区域用于提取补丁。

Parameters:

参数类型描述
valueRectangle用于提取补丁的区域。