Class MagicWandSettings
Nazwa przestrzeń: Aspose.Imaging.MagicWand Zgromadzenie: Aspose.Imaging.dll (25.4.0)
Magiczne ustawienia wyboru wand klasy.
public class MagicWandSettings
Inheritance
Dziedziczeni członkowie
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Przykład pokazuje, jak wybrać prosty obszar obrazu w oparciu o ton i kolor każdego piksela za pomocą narzędzia Magic Wand.
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
});
}
Przykład pokazuje, jak wybrać skomplikowaną powierzchnię obrazu za pomocą narzędzia Magic Wand i zdolność do interakcji z maskami (invert, union, substrata).
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)
Inicjalizuje nową instancję klasy Aspose.Imaging.MagicWand.
public MagicWandSettings(Point point)
Parameters
point
Point
To punkt odniesienia.
MagicWandSettings(i int, int)
Inicjalizuje nową instancję klasy Aspose.Imaging.MagicWand.
public MagicWandSettings(int x, int y)
Parameters
x
int
x-koordynacja punktu referencyjnego.
y
int
i-koordynacja punktu odniesienia.
Properties
AreaOfInterest
Uzyskuje lub ustawia granice obszaru do pracy algorytmowej.
public Rectangle AreaOfInterest { get; set; }
Wartość nieruchomości
ColorCompareMode
Otrzymuje lub ustawia algorytm, w jaki sposób kolory są porównywane.
public ColorComparisonMode ColorCompareMode { get; set; }
Wartość nieruchomości
ColorComparisonDelegate
Otrzymasz lub ustawisz algorytm porównania kolorów, jeśli Aspose.Imaging.MagicWand.MagiSettings.ColorCompareMode jest ustawiony na _www.magi.
public MagicWandSettings.ColorComparison ColorComparisonDelegate { get; set; }
Wartość nieruchomości
MagicWandSettings . ColorComparison
ContiguousMode
Otrzymuje lub ustawia wartość wskazującą, czy magiczny wand zdefiniuje tylko kontyngentne piksele.
public bool ContiguousMode { get; set; }
Wartość nieruchomości
DirectionalMode
Zdobądź lub ustaw tryb powodzi wypełnij algorytm wyszukiwania: cztery z ośmiu kierunków poszukiwań.
public FloodFillDirectionalMode DirectionalMode { get; set; }
Wartość nieruchomości
Point
Otrzymuje lub ustawia punkt odniesienia do pracy algorytmowej.
public Point Point { get; }
Wartość nieruchomości
Threshold
Otrzymuje lub ustawia poziom tolerancji dla porównania kolorów pikseli.
public int Threshold { get; set; }