Class MagicWandSettings
İsim alanı : Aspose.Imaging.MagicWand Toplantı: Aspose.Imaging.dll (25.4.0)
Bir sihirli wand seçim ayarları sınıf.
public class MagicWandSettings
Inheritance
mirasçı üyeleri
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Örnek, Magic Wand aracılığıyla herhangi bir piksel tonuna ve rengine dayalı bir görüntü alanını nasıl seçeceğinizi gösterir.
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
});
}
Örnek Magic Wand aracını kullanarak bir görüntü karmaşık bir alanı nasıl seçileceğini ve maskelerle etkileşim kurma yeteneğini gösterir (invert, union, substract).
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)
Aspose.Imaging.MagicWand.MagicWandSettings sınıfının yeni bir örneğini başlatır.
public MagicWandSettings(Point point)
Parameters
point
Point
Referans noktası için.
MagicWandSettings(int , int , int)
Aspose.Imaging.MagicWand.MagicWandSettings sınıfının yeni bir örneğini başlatır.
public MagicWandSettings(int x, int y)
Parameters
x
int
Referans noktasının x-koordinasyonu
y
int
referans noktasının y-koordinasyonu.
Properties
AreaOfInterest
Algorithm çalışması için alan sınırlarını alır veya ayarlar.
public Rectangle AreaOfInterest { get; set; }
Mülkiyet Değer
ColorCompareMode
Renklerin nasıl karşılaştırıldığı algoritmasını alır veya ayarlar.
public ColorComparisonMode ColorCompareMode { get; set; }
Mülkiyet Değer
ColorComparisonDelegate
Aspose.Imaging.MagicWand.MagicWandSettings.ColorCompareMode Aspose.Imaging.MagicWand.ColorComparisonMode.
public MagicWandSettings.ColorComparison ColorComparisonDelegate { get; set; }
Mülkiyet Değer
MagicWandSettings . ColorComparison
ContiguousMode
Magic Wand’ın yalnızca tutarlı pikselleri tanımlayacağını gösteren bir değer alır veya ayarlar.
public bool ContiguousMode { get; set; }
Mülkiyet Değer
DirectionalMode
Arama algoritmasını doldurma modunu alır veya ayarlar: sekiz yön arama dört.
public FloodFillDirectionalMode DirectionalMode { get; set; }
Mülkiyet Değer
Point
Algorithm çalışması için referans noktası alır veya ayarlar.
public Point Point { get; }
Mülkiyet Değer
Threshold
Pixel renk karşılaştırması için tolerans seviyesi alır veya ayarlar.
public int Threshold { get; set; }