Class MagicWandTool
이름 공간 : Aspose.Imaging.MagicWand 모임: Aspose.Imaging.dll (25.4.0)
마법의 밴드 알고리즘의 클래스는 주요 논리입니다.
public class MagicWandTool : IPartialArgb32PixelLoader
Inheritance
Implements
상속 회원들
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 도구를 사용하여 이미지의 복잡한 영역을 선택하는 방법과 마스크와 상호 작용 할 수있는 능력을 보여줍니다 (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);
}
Methods
Process(오른쪽, int[ ] [ [ ], 포인트, 포인트)
충전된 픽셀을 처리합니다.
public void Process(Rectangle pixelsRectangle, int[] pixels, Point start, Point end)
Parameters
pixelsRectangle
Rectangle
픽셀은 오른쪽으로 움직인다.
pixels
int
[ ] [ [ ]
32비트 ARGB 픽셀
start
Point
시작 픽셀 포인트. (왼쪽, 상단)와 동일하지 않으면 우리가 가지고있는 완전한 직경이 아니라는 것을 의미합니다.
end
Point
끝 픽셀 포인트. (오른쪽, 아래쪽)와 동일하지 않으면 우리가 가지고있는 완전한 직경이 아니라는 것을 의미합니다.
Select(모델 번호:MagicWandSettings)
새로운 Aspose.Imaging.MagicWand.ImageMasks.ImageBitMask를 Aspose.Imaging.MagicWand.MagicWandSettings 및 소스 Aspose.Imaging.RasterImage를 기반으로 만듭니다.
public static ImageBitMask Select(RasterImage source, MagicWandSettings settings)
Parameters
source
RasterImage
알고리즘이 작동하기 위해 그림을 뿌리십시오.
settings
MagicWandSettings
마법 밴드 알고리즘의 설정은 마스크를 만드는 데 사용됩니다.
Returns
새로운 Aspose.Imaging.MagicWand.ImageMasks.ImageBitMask.