Class MagicWandSettings
ชื่อพื้นที่: Aspose.Imaging.MagicWand การประกอบ: Aspose.Imaging.dll (25.4.0)
A Magic Wand การเลือกการตั้งค่าคลาส
public class MagicWandSettings
Inheritance
อนุญาโตตุลาการ
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
ตัวอย่างนี้แสดงให้เห็นวิธีการเลือกพื้นที่ที่เรียบง่ายของภาพขึ้นอยู่กับสีและสีของ pixels โดยใช้เครื่องมือ 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 และความสามารถในการโต้ตอบกับ mask (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
public MagicWandSettings(Point point)
Parameters
point
Point
จุดหมายเลข
MagicWandSettings(int, int)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Imaging.MagicWand.MagicWandSettings
public MagicWandSettings(int x, int y)
Parameters
x
int
หลักสูตร X ของจุดคํานวณ
y
int
องค์ประกอบ Y ของจุดหมายความ
Properties
AreaOfInterest
รับหรือตั้งข้อ จํากัด ของพื้นที่สําหรับงานอัลกอริทึม
public Rectangle AreaOfInterest { get; set; }
คุณสมบัติมูลค่า
ColorCompareMode
รับหรือตั้งค่าแอลกอฮอร์โมนวิธีการเปรียบเทียบสี
public ColorComparisonMode ColorCompareMode { get; set; }
คุณสมบัติมูลค่า
ColorComparisonDelegate
รับหรือตั้งค่าการเปรียบเทียบสีที่กําหนดเองหาก Aspose.Imaging.MagicWand.MagicWandSettings.ColorCompareMode จะตั้งค่าเป็น Aspose.Imaging.MagicWand.ColorComparisonMode.Custom
public MagicWandSettings.ColorComparison ColorComparisonDelegate { get; set; }
คุณสมบัติมูลค่า
MagicWandSettings . ColorComparison
ContiguousMode
รับหรือตั้งค่าหมายความว่า Wanda Magic จะกําหนดพิกเซลที่เข้ากันได้เท่านั้น
public bool ContiguousMode { get; set; }
คุณสมบัติมูลค่า
DirectionalMode
รับหรือตั้งค่าโหมดการทํารองการค้นหาอัลกอริทึมการค้นหา: สี่ของสี่การค้นหาทิศทาง
public FloodFillDirectionalMode DirectionalMode { get; set; }
คุณสมบัติมูลค่า
Point
ได้รับหรือตั้งค่าจุดคําแนะนําสําหรับงานอัลกอริทึม
public Point Point { get; }
คุณสมบัติมูลค่า
Threshold
รับหรือตั้งค่าระดับความต้านทานสําหรับการเปรียบเทียบสีพิกเซล
public int Threshold { get; set; }