SoCoResource.Color
Contents
[
Hide
]SoCoResource.Color property
Gets the RGB color .
public Color Color { get; set; }
Return Value
The RGB Color
Examples
The following example demonstrates how you edit SoCoResource (Layer Resource for Color Fill Layer)
[C#]
string sourceFile = "ColorFillLayer.psd";
string outputFile = "SoCoResource_Edited.psd";
// Load an existing image into an instance of PsdImage class
var im = (PsdImage)Image.Load(sourceFile);
using (im)
{
foreach (var layer in im.Layers)
{
// Finding of FillLayer
if (layer is FillLayer)
{
var fillLayer = (FillLayer)layer;
foreach (var resource in fillLayer.Resources)
{
// Finding of SoCoResource in Layer Resource List
if (resource is SoCoResource)
{
var socoResource = (SoCoResource)resource;
var expectedColor = Color.FromArgb(63, 83, 141);
if ((expectedColor.R != socoResource.Color.R) ||
(expectedColor.G != socoResource.Color.G) ||
(expectedColor.B != socoResource.Color.B) ||
(expectedColor.A != socoResource.Color.A))
{
throw new Exception("Unexpected color");
}
// Setting the SoCoResource Color property
socoResource.Color = Color.Red;
break;
}
}
break;
}
im.Save(outputFile);
}
}
See Also
- struct Color
- class SoCoResource
- namespace Aspose.PSD.FileFormats.Psd.Layers.LayerResources
- assembly Aspose.PSD