Class ColorFillSettings
Contents
[
Hide
]ColorFillSettings class
Color fill effect settings
public class ColorFillSettings : BaseFillSettings, IColorFillSettings
Constructors
Name | Description |
---|---|
ColorFillSettings() | The default constructor. |
Properties
Name | Description |
---|---|
Color { get; set; } | Gets or sets the color. |
override FillType { get; } | The fill type |
Examples
The following code demonstrates support of the stroke effect layer with fill type - 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);
}
// Test file after edit
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);
}
See Also
- class BaseFillSettings
- interface IColorFillSettings
- namespace Aspose.PSD.FileFormats.Psd.Layers.FillSettings
- assembly Aspose.PSD