Class MagicWandTool

Class MagicWandTool

A név: Aspose.Imaging.MagicWand Összefoglaló: Aspose.Imaging.dll (25.4.0)

Az osztály a mágikus wand algoritmus fő logika.

public class MagicWandTool : IPartialArgb32PixelLoader

Inheritance

object MagicWandTool

Implements

IPartialArgb32PixelLoader

Örökletes tagok

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

Examples

A példa azt mutatja, hogyan válasszon egy egyszerű területen egy kép alapján a hang és a szín bármely pixel segítségével Magic Wand eszköz.

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
                                                                                                                                    });
                                                                                                                                }

A példa azt mutatja, hogyan kell kiválasztani egy bonyolult területen egy kép segítségével Magic Wand eszköz és a képesség, hogy kölcsönhatásba maszkok (invert, union, szubsztrakt).

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);
                                                                                                                                                                  }

Methods

Process(Székesfehérvár, int[], pont, pont)

feldolgozza a feltöltött pixeleket.

public void Process(Rectangle pixelsRectangle, int[] pixels, Point start, Point end)

Parameters

pixelsRectangle Rectangle

A pixelek rektangulálnak.

pixels int []

A 32 bites ARGB pixel.

start Point

Ha nem egyenlő (balra, felső) azt jelenti, hogy nem teljes rektangul van.

end Point

Ha nem egyenlő (jobb, alsó) azt jelenti, hogy nem teljes rektangul van.

Select(Térképek, MagicWandSettings)

Hozzon létre egy új Aspose.Imaging.MagicWand.ImageMasks.ImagicBitMask alapján a Wl17.Mágic Wand és forráskezelések és a szerkezet _www.rasterimage.

public static ImageBitMask Select(RasterImage source, MagicWandSettings settings)

Parameters

source RasterImage

Raster kép, hogy az algoritmus dolgozzon tovább.

settings MagicWandSettings

A mágikus wand algoritmus beállításait a maszk létrehozásában használják.

Returns

ImageBitMask

Új Aspose.Imaging.MagicWand.ImageMasks. ImageBitMask.

 Magyar