Class MagicWandSettings
Название пространства: Aspose.Imaging.MagicWand Ассоциация: Aspose.Imaging.dll (25.4.0)
Магическая класса отбора ванн.
public class MagicWandSettings
Inheritance
Наследованные члены
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Пример показывает, как выбрать простой участок изображения на основе тона и цвета любого пикселя с помощью инструмента 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
});
}
Пример показывает, как выбрать сложную область изображения с помощью инструмента 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 (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.
public MagicWandSettings(Point point)
Parameters
point
Point
Точка ссылки .
MagicWandSettings(Инт, Инт)
Инициализует новую инстанцию класса Aspose.Imaging.MagicWand.
public MagicWandSettings(int x, int y)
Parameters
x
int
X-координаты точки ссылки.
y
int
и-координаты точки ссылки.
Properties
AreaOfInterest
Получает или устанавливает границы зоны для работы алгоритма.
public Rectangle AreaOfInterest { get; set; }
Стоимость недвижимости
ColorCompareMode
Получает или устанавливает алгоритм, как сравниваются цвета.
public ColorComparisonMode ColorCompareMode { get; set; }
Стоимость недвижимости
ColorComparisonDelegate
Получить или установить персонализированный алгоритм сравнения цветов, если Aspose.Imaging.MagicWand.MAGICWANDSettings.ColorCompareMode устанавливается на WR17.
public MagicWandSettings.ColorComparison ColorComparisonDelegate { get; set; }
Стоимость недвижимости
MagicWandSettings . ColorComparison
ContiguousMode
Получается или устанавливается значение, указывающее на то, будет ли волшебная ванда определять только соприкосновения пикселей.
public bool ContiguousMode { get; set; }
Стоимость недвижимости
DirectionalMode
Получить или установить режим наводнения заполнить алгоритм поиска: четыре из восьми направлений поиска.
public FloodFillDirectionalMode DirectionalMode { get; set; }
Стоимость недвижимости
Point
Получается или устанавливается пункт ссылки на работу алгоритма.
public Point Point { get; }
Стоимость недвижимости
Threshold
Получает или устанавливает уровень толерантности для сравнения цвета пикселей.
public int Threshold { get; set; }