ObjectArrayStructure.ObjectArrayStructure
inhoud
[
verbergen
]ObjectArrayStructure(string, string, OSTypeStructure[])
Initialiseert een nieuw exemplaar van hetObjectArrayStructure
klasse.
public ObjectArrayStructure(string keyName, string classIdName, OSTypeStructure[] structures)
Parameter | Type | Beschrijving |
---|---|---|
keyName | String | Naam van de sleutel. |
classIdName | String | Naam van de klasse-ID. |
structures | OSTypeStructure[] | De structuren. |
Voorbeelden
De volgende code demonstreert de ondersteuning van de ObAr- en UnFl-handtekeningen.
[C#]
void AssertAreEqual(object actual, object expected)
{
if (!object.Equals(actual, expected))
{
throw new FormatException(string.Format("Actual value {0} are not equal to expected {1}.", actual, expected));
}
}
var sourceFilePath = "LayeredSmartObjects8bit2.psd";
using (PsdImage image = (PsdImage)Image.Load(sourceFilePath))
{
UnitArrayStructure verticalStructure = null;
foreach (Layer imageLayer in image.Layers)
{
foreach (var imageResource in imageLayer.Resources)
{
var resource = imageResource as PlLdResource;
if (resource != null && resource.IsCustom)
{
foreach (OSTypeStructure structure in resource.Items)
{
if (structure.KeyName.ClassName == "customEnvelopeWarp")
{
AssertAreEqual(typeof(DescriptorStructure), structure.GetType());
var custom = (DescriptorStructure)structure;
AssertAreEqual(custom.Structures.Length, 1);
var mesh = custom.Structures[0];
AssertAreEqual(typeof(ObjectArrayStructure), mesh.GetType());
var meshObjectArray = (ObjectArrayStructure)mesh;
AssertAreEqual(meshObjectArray.Structures.Length, 2);
var vertical = meshObjectArray.Structures[1];
AssertAreEqual(typeof(UnitArrayStructure), vertical.GetType());
verticalStructure = (UnitArrayStructure)vertical;
AssertAreEqual(verticalStructure.UnitType, UnitTypes.Pixels);
AssertAreEqual(verticalStructure.ValueCount, 16);
break;
}
}
}
}
}
AssertAreEqual(true, verticalStructure != null);
}
Zie ook
- class OSTypeStructure
- class ObjectArrayStructure
- naamruimte Aspose.PSD.FileFormats.Psd.Layers.LayerResources.TypeToolInfoStructures
- montage Aspose.PSD
ObjectArrayStructure(int, ClassID, ClassID, string, OSTypeStructure[])
Initialiseert een nieuw exemplaar van hetObjectArrayStructure
klasse.
public ObjectArrayStructure(int key, ClassID keyName, ClassID classID, string className,
OSTypeStructure[] structures)
Parameter | Type | Beschrijving |
---|---|---|
key | Int32 | De integer-sleutel. |
keyName | ClassID | De sleutelnaam. |
classID | ClassID | De klasse-ID. |
className | String | Naam van de klas. |
structures | OSTypeStructure[] | De structuren. |
Uitzonderingen
uitzondering | voorwaarde |
---|---|
ArgumentNullException | classID is null |
Voorbeelden
De volgende code demonstreert de ondersteuning van de ObAr- en UnFl-handtekeningen.
[C#]
void AssertAreEqual(object actual, object expected)
{
if (!object.Equals(actual, expected))
{
throw new FormatException(string.Format("Actual value {0} are not equal to expected {1}.", actual, expected));
}
}
var sourceFilePath = "LayeredSmartObjects8bit2.psd";
using (PsdImage image = (PsdImage)Image.Load(sourceFilePath))
{
UnitArrayStructure verticalStructure = null;
foreach (Layer imageLayer in image.Layers)
{
foreach (var imageResource in imageLayer.Resources)
{
var resource = imageResource as PlLdResource;
if (resource != null && resource.IsCustom)
{
foreach (OSTypeStructure structure in resource.Items)
{
if (structure.KeyName.ClassName == "customEnvelopeWarp")
{
AssertAreEqual(typeof(DescriptorStructure), structure.GetType());
var custom = (DescriptorStructure)structure;
AssertAreEqual(custom.Structures.Length, 1);
var mesh = custom.Structures[0];
AssertAreEqual(typeof(ObjectArrayStructure), mesh.GetType());
var meshObjectArray = (ObjectArrayStructure)mesh;
AssertAreEqual(meshObjectArray.Structures.Length, 2);
var vertical = meshObjectArray.Structures[1];
AssertAreEqual(typeof(UnitArrayStructure), vertical.GetType());
verticalStructure = (UnitArrayStructure)vertical;
AssertAreEqual(verticalStructure.UnitType, UnitTypes.Pixels);
AssertAreEqual(verticalStructure.ValueCount, 16);
break;
}
}
}
}
}
AssertAreEqual(true, verticalStructure != null);
}
Zie ook
- class ClassID
- class OSTypeStructure
- class ObjectArrayStructure
- naamruimte Aspose.PSD.FileFormats.Psd.Layers.LayerResources.TypeToolInfoStructures
- montage Aspose.PSD