Class MagicWandSettings

Class MagicWandSettings

Nom dels espais: Aspose.Imaging.MagicWand Assemblea: Aspose.Imaging.dll (25.4.0)

Una màgia de la selecció d’instàncies de classe.

public class MagicWandSettings

Inheritance

object MagicWandSettings

Membres heretats

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

Examples

L’exemple mostra com triar una simple àrea d’una imatge basada en el to i el color de qualsevol píxel utilitzant l’eina 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
                                                                                                                                    });
                                                                                                                                }

L’exemple mostra com seleccionar una àrea complicada d’una imatge utilitzant l’eina Magic Wand i la capacitat per interactuar amb les màscares (invert, union, substrats).

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)

Inicialitza una nova instància de la classe Aspose.Imaging.MagicWand.

public MagicWandSettings(Point point)

Parameters

point Point

El punt de referència.

MagicWandSettings(Int, Int)

Inicialitza una nova instància de la classe Aspose.Imaging.MagicWand.

public MagicWandSettings(int x, int y)

Parameters

x int

El x-coordinat del punt de referència.

y int

La coordenada del punt de referència.

Properties

AreaOfInterest

Obté o posa els límits de l’àrea per al treball algorítmic.

public Rectangle AreaOfInterest { get; set; }

Valor de la propietat

Rectangle

ColorCompareMode

Obté o estableix l’algoritme com es comparen els colors.

public ColorComparisonMode ColorCompareMode { get; set; }

Valor de la propietat

ColorComparisonMode

ColorComparisonDelegate

Obtenir o configurar l’algoritme de comparació de colors personalitzat si Aspose.Imaging.MagicWand.MàgicsSettings.ColorCompareMode s’estableix a __ WL16__ .MagikWan.

public MagicWandSettings.ColorComparison ColorComparisonDelegate { get; set; }

Valor de la propietat

MagicWandSettings . ColorComparison

ContiguousMode

Obtén o estableix un valor que indiqui si la cistella màgica definirà només els píxels contenidors.

public bool ContiguousMode { get; set; }

Valor de la propietat

bool

DirectionalMode

Obtenir o configurar el mode d’inundació omplir l’algoritme de cerca: quatre de vuit direccions de recerca.

public FloodFillDirectionalMode DirectionalMode { get; set; }

Valor de la propietat

FloodFillDirectionalMode

Point

Obté o estableix el punt de referència per al treball de l’algoritme.

public Point Point { get; }

Valor de la propietat

Point

Threshold

Obté o fixa el nivell de tolerància per a la comparació de color de píxels.

public int Threshold { get; set; }

Valor de la propietat

int

 Català