VscgResource.Items
Contents
[
Hide
]VscgResource.Items property
Gets or sets the array of structure items. Warning: The Items
array values must match with the KeyForData
property, which determines the type of fill settings stored in the structures within Items
.
public OSTypeStructure[] Items { get; }
Property Value
The array of OSTypeStructure
items.
Examples
The following code demonstrates the support of VscgResource.
[C#]
string sourceFile = "StrokeInternalFill_src.psd";
string outputFile = "StrokeInternalFill_res.psd";
void AreEqual(double expected, double current, double tolerance = 0.1)
{
if (Math.Abs(expected - current) > tolerance)
{
throw new Exception(
$"Values is not equal.\nExpected:{expected}\nResult:{current}\nDifference:{expected - current}");
}
}
using (PsdImage image = (PsdImage)Image.Load(sourceFile))
{
VscgResource vscgResource = (VscgResource)image.Layers[1].Resources[0];
DescriptorStructure rgbColorStructure = (DescriptorStructure)vscgResource.Items[0];
AreEqual(89.8, ((DoubleStructure)rgbColorStructure.Structures[0]).Value);
AreEqual(219.6, ((DoubleStructure)rgbColorStructure.Structures[1]).Value);
AreEqual(34.2, ((DoubleStructure)rgbColorStructure.Structures[2]).Value);
((DoubleStructure)rgbColorStructure.Structures[0]).Value = 255d; // Red
((DoubleStructure)rgbColorStructure.Structures[1]).Value = 0d; // Green
((DoubleStructure)rgbColorStructure.Structures[2]).Value = 0d; // Blue
image.Save(outputFile);
}
// checking changes
using (PsdImage image = (PsdImage)Image.Load(outputFile))
{
VscgResource vscgResource = (VscgResource)image.Layers[1].Resources[0];
DescriptorStructure rgbColorStructure = (DescriptorStructure)vscgResource.Items[0];
AreEqual(255, ((DoubleStructure)rgbColorStructure.Structures[0]).Value);
AreEqual(0, ((DoubleStructure)rgbColorStructure.Structures[1]).Value);
AreEqual(0, ((DoubleStructure)rgbColorStructure.Structures[2]).Value);
}
See Also
- class OSTypeStructure
- class VscgResource
- namespace Aspose.PSD.FileFormats.Psd.Layers.LayerResources.StrokeResources
- assembly Aspose.PSD