ShapeLayer.Fill
Contents
[
Hide
]ShapeLayer.Fill property
Gets or sets Fill settings for internal area of Shapes in the Shape layer.
public IFillSettings Fill { get; set; }
Examples
The following code demonstrates the Fill property of ShapeLayer.
[C#]
string srcFile = "ShapeInternalSolid.psd";
string outFile = "ShapeInternalSolid.psd.out.psd";
using (PsdImage image = (PsdImage)Image.Load(
srcFile,
new PsdLoadOptions { LoadEffectsResource = true }))
{
ShapeLayer shapeLayer = (ShapeLayer)image.Layers[1];
ColorFillSettings fillSettings = (ColorFillSettings)shapeLayer.Fill;
fillSettings.Color = Color.Red;
shapeLayer.Update();
image.Save(outFile);
}
// Check saved changes
using (PsdImage image = (PsdImage)Image.Load(
outFile,
new PsdLoadOptions { LoadEffectsResource = true }))
{
ShapeLayer shapeLayer = (ShapeLayer)image.Layers[1];
ColorFillSettings fillSettings = (ColorFillSettings)shapeLayer.Fill;
AssertAreEqual(Color.Red, fillSettings.Color);
image.Save(outFile);
}
void AssertAreEqual(object expected, object actual, string message = null)
{
if (!object.Equals(expected, actual))
{
throw new Exception(message ?? "Objects are not equal.");
}
}
See Also
- interface IFillSettings
- class ShapeLayer
- namespace Aspose.PSD.FileFormats.Psd.Layers
- assembly Aspose.PSD