ContentAwareFillWatermarkOptions

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

public class ContentAwareFillWatermarkOptions extends WatermarkOptions

Les options communes de l’algorithme de remplissage sensible au contenu.

Constructeurs

ConstructeurDescription
ContentAwareFillWatermarkOptions(Point[] mask)Initialise une nouvelle instance de la classe ContentAwareFillWatermarkOptions.
ContentAwareFillWatermarkOptions(GraphicsPath mask)Initialise une nouvelle instance de la classe ContentAwareFillWatermarkOptions.

Méthodes

MéthodeDescription
getPatchSize()Obtient la taille du patch (doit être impair).
setPatchSize(byte value)Définit la taille du patch (doit être impair).
getMaxPaintingAttempts()Obtient le nombre maximal de tentatives de peinture.
setMaxPaintingAttempts(int value)Définit le nombre maximal de tentatives de peinture.
getInterestArea()Obtient la zone où prélever les patches.
setInterestArea(Rectangle value)Définit la zone où prélever les patches.

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)

Initialise une nouvelle instance de la classe ContentAwareFillWatermarkOptions.

Parameters:

ParamètreTypeDescription
maskPoint[]Le masque pour la zone inconnue.

ContentAwareFillWatermarkOptions(GraphicsPath mask)

public ContentAwareFillWatermarkOptions(GraphicsPath mask)

Initialise une nouvelle instance de la classe ContentAwareFillWatermarkOptions.

Parameters:

ParamètreTypeDescription
maskGraphicsPathLe masque pour la zone inconnue.

getPatchSize()

public final byte getPatchSize()

Obtient la taille du patch (doit être impair).

Valeur : la taille du patch.

Returns: byte - la taille du patch (doit être impair).

setPatchSize(byte value)

public final void setPatchSize(byte value)

Définit la taille du patch (doit être impair).

Valeur : la taille du patch.

Parameters:

ParamètreTypeDescription
valeurbytela taille du patch (doit être impair).

getMaxPaintingAttempts()

public final int getMaxPaintingAttempts()

Obtient le nombre maximal de tentatives de peinture. L’algorithme choisira la meilleure variante.

Valeur: le nombre maximal de tentatives de peinture.

Returns: int - le nombre maximal de tentatives de peinture.

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)

Définit le nombre maximal de tentatives de peinture. L’algorithme choisira la meilleure variante.

Valeur: le nombre maximal de tentatives de peinture.

Parameters:

ParamètreTypeDescription
valeurintle nombre maximal de tentatives de peinture.

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()

Obtient la zone où prélever les patches.

Valeur: la zone d’intérêt pour extraire des patches.

Returns: Rectangle - the area to take patches.

setInterestArea(Rectangle value)

public final void setInterestArea(Rectangle value)

Définit la zone où prélever les patches.

Valeur: la zone d’intérêt pour extraire des patches.

Parameters:

ParamètreTypeDescription
valueRectanglela zone pour extraire des patches.