SoCoResource 지원
Contents
[
Hide
]
SoCoResource 지원
SoCoResource은 컬러 채우기 레이어에 대한 정보를 포함하고 있습니다. 이 문서는 Aspose.PSD for .NET이 PSD 파일에서 SoCoResource를 지원하는 방법을 보여줍니다.
- Image 클래스에서 노출된 팩토리 메서드 Load를 사용하여 이미지로 PSD 파일을 로드합니다.
- 이미지 레이어에서 SoCoResource를 가져옵니다.
- 필요한 속성을 설정합니다.
- 결과를 저장합니다.
다음 코드 스니펫은 Aspose.PSD for .NET이 SoCoResource를 지원하는 방법을 보여줍니다.
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 | |
string sourceFileName = dataDir + "ColorFillLayer.psd"; | |
string exportPath = dataDir + "SoCoResource_Edited.psd"; | |
var im = (PsdImage)Image.Load(sourceFileName); | |
using (im) | |
{ | |
foreach (var layer in im.Layers) | |
{ | |
if (layer is FillLayer) | |
{ | |
var fillLayer = (FillLayer)layer; | |
foreach (var resource in fillLayer.Resources) | |
{ | |
if (resource is SoCoResource) | |
{ | |
var socoResource = (SoCoResource)resource; | |
if (socoResource.Color != Color.FromArgb(63, 83, 141)) | |
{ | |
throw new Exception("Color from SoCoResource was read wrong"); | |
} | |
socoResource.Color = Color.Red; | |
break; | |
} | |
} | |
break; | |
} | |
im.Save(exportPath); | |
} | |
} |