Stroke Effect With Color Fill
Stroke Effect With Color Fill
This article demonstrates how to render stroke effect with color fill. The Stroke effect is used to add strokes and borders to layers and shapes. It can be used to create solid-color lines, colorful gradients, as well as patterned borders.
The steps to render Stroke effect with Color fill are as simple as below:
- Set LoadEffectsResource property.
- Load a PSD file as an image using the factory method Load exposed by Image class and define PsdLoadOptions.
- Set settings properties of ColorFillSetting.
- Save the results.
The following code snippet shows you how to render Stroke effect with Color fill.
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_PSD(); | |
// Implement rendering of Stroke effect with Color Fill for export | |
string sourceFileName = dataDir + "StrokeComplex.psd"; | |
string exportPath = dataDir + "StrokeComplexRendering.psd"; | |
string exportPathPng = dataDir + "StrokeComplexRendering.png"; | |
var loadOptions = new PsdLoadOptions() | |
{ | |
LoadEffectsResource = true | |
}; | |
using (var im = (PsdImage)Image.Load(sourceFileName, loadOptions)) | |
{ | |
for (int i = 0; i < im.Layers.Length; i++) | |
{ | |
var effect = (StrokeEffect)im.Layers[i].BlendingOptions.Effects[0]; | |
var settings = (ColorFillSettings)effect.FillSettings; | |
settings.Color = Color.DeepPink; | |
} | |
// Save psd | |
im.Save(exportPath, new PsdOptions()); | |
// Save png | |
im.Save(exportPathPng, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha }); | |
} |