Class ColorFillSettings
内容
[
隐藏
]ColorFillSettings class
颜色填充效果设置
public class ColorFillSettings : BaseFillSettings, IColorFillSettings
特性
姓名 | 描述 |
---|---|
Color { get; set; } | 获取或设置颜色。 |
override FillType { get; } | 填充类型 |
例子
以下代码演示了对填充类型为 Color 的笔触效果图层的支持。
[C#]
void AssertAreEqual(object expected, object actual, string message = null)
{
if (!object.Equals(expected, actual))
{
throw new FormatException(message ?? "Objects are not equal.");
}
}
var sourceFileName = "Stroke.psd";
var exportPath = "StrokeColorChanged.psd";
var loadOptions = new PsdLoadOptions()
{
LoadEffectsResource = true
};
using (var im = (PsdImage)Image.Load(sourceFileName, loadOptions))
{
var colorStroke = (StrokeEffect)im.Layers[1].BlendingOptions.Effects[0];
AssertAreEqual(BlendMode.Normal, colorStroke.BlendMode);
AssertAreEqual((byte)255, colorStroke.Opacity);
AssertAreEqual(true, colorStroke.IsVisible);
var fillSettings = (ColorFillSettings)colorStroke.FillSettings;
AssertAreEqual(Color.Black, fillSettings.Color);
AssertAreEqual(FillType.Color, fillSettings.FillType);
fillSettings.Color = Color.Yellow;
colorStroke.Opacity = 127;
colorStroke.BlendMode = BlendMode.Color;
im.Save(exportPath);
}
// 编辑后的测试文件
using (var im = (PsdImage)Image.Load(exportPath, loadOptions))
{
var colorStroke = (StrokeEffect)im.Layers[1].BlendingOptions.Effects[0];
AssertAreEqual(BlendMode.Color, colorStroke.BlendMode);
AssertAreEqual((byte)127, colorStroke.Opacity);
AssertAreEqual(true, colorStroke.IsVisible);
var fillSettings = (ColorFillSettings)colorStroke.FillSettings;
AssertAreEqual(Color.Yellow, fillSettings.Color);
AssertAreEqual(FillType.Color, fillSettings.FillType);
}
也可以看看
- class BaseFillSettings
- interface IColorFillSettings
- 命名空间 Aspose.PSD.FileFormats.Psd.Layers.FillSettings
- 部件 Aspose.PSD