ContentAwareFillWatermarkOptions

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

public class ContentAwareFillWatermarkOptions extends WatermarkOptions

Die gängigen Optionen des Content Aware Fill-Algorithmus.

Konstruktoren

KonstruktorBeschreibung
ContentAwareFillWatermarkOptions(Point[] mask)Initialisiert eine neue Instanz der ContentAwareFillWatermarkOptions Klasse.
ContentAwareFillWatermarkOptions(GraphicsPath mask)Initialisiert eine neue Instanz der ContentAwareFillWatermarkOptions Klasse.

Methoden

MethodeBeschreibung
getPatchSize()Gibt die Patch-Größe zurück (sollte ungerade sein).
setPatchSize(byte value)Legt die Patch-Größe fest (sollte ungerade sein).
getMaxPaintingAttempts()Gibt die maximale Anzahl von Malversuchen zurück.
setMaxPaintingAttempts(int value)Legt die maximale Anzahl von Malversuchen fest.
getInterestArea()Gibt den Bereich zum Entnehmen von Patches zurück.
setInterestArea(Rectangle value)Legt den Bereich zum Entnehmen von Patches fest.

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)

Initialisiert eine neue Instanz der ContentAwareFillWatermarkOptions Klasse.

Parameters:

ParameterTypBeschreibung
maskPoint[]Die Maske für den unbekannten Bereich.

ContentAwareFillWatermarkOptions(GraphicsPath mask)

public ContentAwareFillWatermarkOptions(GraphicsPath mask)

Initialisiert eine neue Instanz der ContentAwareFillWatermarkOptions Klasse.

Parameters:

ParameterTypBeschreibung
maskGraphicsPathDie Maske für den unbekannten Bereich.

getPatchSize()

public final byte getPatchSize()

Gibt die Patch-Größe zurück (sollte ungerade sein).

Wert: Die Größe des Patches.

Returns: byte - die Patch-Größe (sollte ungerade sein).

setPatchSize(byte value)

public final void setPatchSize(byte value)

Legt die Patch-Größe fest (sollte ungerade sein).

Wert: Die Größe des Patches.

Parameters:

ParameterTypBeschreibung
Wertbytedie Patch-Größe (sollte ungerade sein).

getMaxPaintingAttempts()

public final int getMaxPaintingAttempts()

Gibt die maximale Anzahl von Malversuchen zurück. Der Algorithmus wählt die beste Variante aus.

Wert: Die maximale Anzahl von Malversuchen.

Returns: int - die maximale Anzahl von Malversuchen.

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)

Legt die maximale Anzahl von Malversuchen fest. Der Algorithmus wählt die beste Variante.

Wert: Die maximale Anzahl von Malversuchen.

Parameters:

ParameterTypBeschreibung
Wertintdie maximale Anzahl von Malversuchen.

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

Gibt den Bereich zum Entnehmen von Patches zurück.

Wert: Das Interessengebiet zum Erfassen von Patches.

Returns: Rectangle - the area to take patches.

setInterestArea(Rectangle value)

public final void setInterestArea(Rectangle value)

Legt den Bereich zum Entnehmen von Patches fest.

Wert: Das Interessengebiet zum Erfassen von Patches.

Parameters:

ParameterTypBeschreibung
valueRectangleder Bereich zum Erfassen von Patches.