FeatheringSettings
内容
[
隐藏
]Inheritance: java.lang.Object
public class FeatheringSettings
羽化设置类。
构造函数
| 构造函数 | 描述 |
|---|---|
| FeatheringSettings() | 初始化一个新的 MagicWandSettings 类的实例。 |
方法
| 方法 | 描述 |
|---|---|
| getSize() | 获取羽化大小。 |
| setSize(int value) | 设置羽化大小。 |
| getMode() | 获取羽化算法模式。 |
| setMode(int value) | 设置羽化算法模式。 |
Example: The example shows how to select a complicated area of an image using Magic Wand tool and the ability to interact with masks (invert, union, subtract).
String imageFilePath = "input.png";
String outputFilePath = "masked-complex.png";
try (RasterImage image = (RasterImage)Image.load(imageFilePath))
{
// 使用魔棒工具基于像素 (845, 128) 的色调和颜色创建新掩码
MagicWandTool.select(image, new MagicWandSettings(845, 128))
// 将现有掩码与魔棒工具创建的指定掩码进行合并
.union(new MagicWandSettings(416, 387))
// 反转现有的遮罩
.invert()
// 从现有遮罩中减去使用魔棒工具并具有指定阈值创建的指定遮罩
.subtract(new MagicWandSettings(1482, 346) {{ setThreshold(69); }})
// 一次一次地从现有遮罩中减去四个指定的矩形遮罩
.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))
// 使用指定设置羽化遮罩
.getFeathered(new FeatheringSettings() {{ setSize(3); }})
// 将掩码应用于图像
.apply();
// 保存图像
image.save(outputFilePath);
}
FeatheringSettings()
public FeatheringSettings()
初始化一个新的 MagicWandSettings 类的实例。
getSize()
public final int getSize()
获取羽化大小。
值:羽化画笔的大小(像素)。
Returns: int - 羽化大小。
setSize(int value)
public final void setSize(int value)
设置羽化大小。
值:羽化画笔的大小(像素)。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 值 | int | 羽化大小。 |
getMode()
public final int getMode()
获取羽化算法模式。
值:羽化算法模式。
Returns: int - 羽化算法模式。
setMode(int value)
public final void setMode(int value)
设置羽化算法模式。
值:羽化算法模式。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 值 | int | 羽化算法模式。 |