Stroke Effect With Color Fill
Contents
[
Hide
]
색 채우기 스트로크 효과
이 문서에서는 색 채우기 스트로크 효과를 렌더하는 방법을 보여줍니다. 스트로크 효과는 레이어 및 모양에 테두리 및 외곽선을 추가하는 데 사용됩니다. 이를 사용하여 단색 선, 다채로운 그라데이션, 그리고 패턴이 있는 테두리를 만들 수 있습니다.
색 채우기 스트로크 효과를 렌더하는 단계는 다음과 같습니다:
- LoadEffectsResource 속성 설정.
- PsdLoadOptions를 정의하고 Image 클래스에 의해 노출된 Load 팩토리 메서드를 사용하여 PSD 파일을 이미지로 로드.
- ColorFillSetting의 설정 속성 설정.
- 결과 저장.
다음 코드 스니펫은 색 채우기 스트로크 효과를 렌더하는 방법을 보여줍니다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 }); | |
} |