תוקף הכוונת עם מילוי צבע

תוקף הכוונת עם מילוי צבע

מאמר זה מדגים איך לעשות את תוקף הכוונת עם מילוי צבע. תוקף הכוונת משמש להוספת הקווים והמסגרות לשכבות ולצורות. ניתן להשתמש בו כדי ליצור קווים בצבע מוצק, עבורי גוונים צבעוניים, וגם מסגרות משופצות.

השלבים לעשות תוקף הכוונת עם מילוי צבע הם פשוטים כך:

  • הגדר את נכס ה- LoadEffectsResource.
  • טען קובץ PSD כתמונה באמצעות שיטת הפקורי Load המוצגת על ידי Image‏ והגדר את ‏PsdLoadOptions.
  • הגדר מאפייני הסטטינג של ‏‎ColorFillSetting.
  • שמור את התוצאות.

הקטע הבא מראה לך איך לעשות את תוקף הכוונת עם מילוי צבע.

// 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 });
}