Class MagicWandSettings

Class MagicWandSettings

Το όνομα: Aspose.Imaging.MagicWand Συγκέντρωση: Aspose.Imaging.dll (25.4.0)

Μια μαγική μαγική επιλογή ρυθμίσεις τάξης.

public class MagicWandSettings

Inheritance

object MagicWandSettings

Κληρονομημένα μέλη

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

Examples

Το παράδειγμα δείχνει πώς να επιλέξετε μια απλή περιοχή μιας εικόνας με βάση τον τόνο και το χρώμα κάθε pixel χρησιμοποιώντας το εργαλείο 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 και την ικανότητα αλληλεπίδρασης με μάσκες (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(ΕΝΤ, ΕΝΤ)

Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Imaging.MagicWand.MagicWandSettings.

public MagicWandSettings(int x, int y)

Parameters

x int

Ο συντονιστής x του σημείου αναφοράς.

y int

Ο συντονισμός του σημείου αναφοράς.

Properties

AreaOfInterest

Αποκτά ή θέτει τα όρια της περιοχής για εργασία αλγόριθμου.

public Rectangle AreaOfInterest { get; set; }

Αξία ιδιοκτησίας

Rectangle

ColorCompareMode

Αποκτά ή ρυθμίζει το αλγόριθμο πώς τα χρώματα συγκρίνεται.

public ColorComparisonMode ColorCompareMode { get; set; }

Αξία ιδιοκτησίας

ColorComparisonMode

ColorComparisonDelegate

Αποκτήστε ή ρυθμίστε το προσαρμοσμένο αλγόριθμο σύγκρισης χρωμάτων αν το Aspose.Imaging.MagicWand.MagicWandSettings.ColorCompareMode ρυθμίζεται στο Aspose.Imaging.MagicWand.ColorComparisonMode.Custom.

public MagicWandSettings.ColorComparison ColorComparisonDelegate { get; set; }

Αξία ιδιοκτησίας

MagicWandSettings . ColorComparison

ContiguousMode

Παίρνει ή καθορίζει μια τιμή που υποδεικνύει αν η μαγική βάνδα θα καθορίσει μόνο τα συσσωρευμένα pixels.

public bool ContiguousMode { get; set; }

Αξία ιδιοκτησίας

bool

DirectionalMode

Αποκτήστε ή ρυθμίστε τη λειτουργία πλημμύρας συμπληρώστε τον αλγόριθμο αναζήτησης: τέσσερις από τις οκτώ κατευθύνσεις αναζήτησης.

public FloodFillDirectionalMode DirectionalMode { get; set; }

Αξία ιδιοκτησίας

FloodFillDirectionalMode

Point

Αποκτά ή καθορίζει το σημείο αναφοράς για εργασία αλγόριθμου.

public Point Point { get; }

Αξία ιδιοκτησίας

Point

Threshold

Αποκτά ή ρυθμίζει το επίπεδο ανοχής για τη σύγκριση χρώματος pixel.

public int Threshold { get; set; }

Αξία ιδιοκτησίας

int

 Ελληνικά