Class MagicWandSettings

Class MagicWandSettings

Der Name: Aspose.Imaging.MagicWand Versammlung: Aspose.Imaging.dll (25.4.0)

Eine magische Wand Auswahl Einstellungen Klasse.

public class MagicWandSettings

Inheritance

object MagicWandSettings

Vererbte Mitglieder

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Das Beispiel zeigt, wie man ein einfaches Gebiet eines Bildes auf der Grundlage des Tons und der Farbe eines Pixels mit dem Tool Magic Wand auswählt.

var imageFilePath = "input.png"; 
                                                                                                                                using (RasterImage image = (RasterImage)Image.Load(inputFilePath))
                                                                                                                                {
                                                                                                                                    // Create a new mask using magic wand tool based on tone and color of pixel (120, 100) with custom threshold equal to 150
                                                                                                                                    MagicWandTool
                                                                                                                                        .Select(image, new MagicWandSettings(120, 100) { Threshold = 150 })
                                                                                                                                        // Apply mask to the image
                                                                                                                                        .Apply();

                                                                                                                                    // Save image with forced transparency color type option
                                                                                                                                    image.Save(outputFilePath, new ImageOptions.PngOptions()
                                                                                                                                    {
                                                                                                                                        ColorType = PngColorType.TruecolorWithAlpha
                                                                                                                                    });
                                                                                                                                }

Das Beispiel zeigt, wie man ein kompliziertes Bildbereich mit dem Magic Wand-Tool auswählt und die Fähigkeit, mit Masken (Invert, Union, Substrat) zu interagieren).

var imageFilePath = "input.png"; 
                                                                                                                                                                  using (RasterImage image = (RasterImage)Image.Load(inputFilePath))
                                                                                                                                                                  {
                                                                                                                                                                      // Create a new mask using magic wand tool based on tone and color of pixel (845, 128)
                                                                                                                                                                      MagicWandTool.Select(image, new MagicWandSettings(845, 128))
                                                                                                                                                                          // Union the existing mask with the specified one created by magic wand tool
                                                                                                                                                                          .Union(new MagicWandSettings(416, 387))
                                                                                                                                                                          // Invert the existing mask
                                                                                                                                                                          .Invert()
                                                                                                                                                                          // Subtract the specified mask created by magic wand tool with specified threshold from the existing one 
                                                                                                                                                                          .Subtract(new MagicWandSettings(1482, 346) { Threshold = 69 })
                                                                                                                                                                          // Subtract four specified rectangle masks from the existing mask one by one
                                                                                                                                                                          .Subtract(new RectangleMask(0, 0, 800, 150))
                                                                                                                                                                          .Subtract(new RectangleMask(0, 380, 600, 220))
                                                                                                                                                                          .Subtract(new RectangleMask(930, 520, 110, 40))
                                                                                                                                                                          .Subtract(new RectangleMask(1370, 400, 120, 200))
                                                                                                                                                                          // Feather mask with specified settings
                                                                                                                                                                          .GetFeathered(new FeatheringSettings() { Size = 3 })
                                                                                                                                                                          // Apply mask to the image
                                                                                                                                                                          .Apply();

                                                                                                                                                                      // Save image
                                                                                                                                                                      image.Save(outputFilePath);
                                                                                                                                                                  }

Constructors

MagicWandSettings(Point)

Initialisiert eine neue Instanz der Aspose.Imaging.MagicWand.MagicWandSettings Klasse.

public MagicWandSettings(Point point)

Parameters

point Point

Der Referenzpunkt.

MagicWandSettings(und int, int)

Initialisiert eine neue Instanz der Aspose.Imaging.MagicWand.MagicWandSettings Klasse.

public MagicWandSettings(int x, int y)

Parameters

x int

Die X-Koordinate des Referenzpunkts.

y int

Die Y-Koordinate des Referenzpunkts.

Properties

AreaOfInterest

Erhält oder legt die Grenzen des Bereichs für die Arbeit des Algorithms fest.

public Rectangle AreaOfInterest { get; set; }

Eigentumswert

Rectangle

ColorCompareMode

Erhält oder legt den Algorithmus fest, wie Farben verglichen werden.

public ColorComparisonMode ColorCompareMode { get; set; }

Eigentumswert

ColorComparisonMode

ColorComparisonDelegate

Erhalten Sie oder setzen Sie den benutzerdefinierten Farbvergleichs-Algorithmus, wenn Aspose.Imaging.MagicWand.MagicWandSettings.ColorCompareMode auf Aspose.Imaging.MagicWand.ColorComparisonMode.Custom eingestellt wird.

public MagicWandSettings.ColorComparison ColorComparisonDelegate { get; set; }

Eigentumswert

MagicWandSettings . ColorComparison

ContiguousMode

Gibt oder setzt einen Wert an, der darauf hindeutet, ob die magische Wand nur kontextuelle Pixel definiert.

public bool ContiguousMode { get; set; }

Eigentumswert

bool

DirectionalMode

Erhalten oder setzen Sie den Flood-Modus, um den Suchalgoritmus zu füllen: vier von acht Richtungen.

public FloodFillDirectionalMode DirectionalMode { get; set; }

Eigentumswert

FloodFillDirectionalMode

Point

Erhält oder stellt den Referenzpunkt für die Arbeit des Algorithms fest.

public Point Point { get; }

Eigentumswert

Point

Threshold

Erhalten oder festlegen Sie das Toleranzniveau für die Pixelfarbenvergleich.

public int Threshold { get; set; }

Eigentumswert

int

 Deutsch