LinkedLayersManager.GetLayersByLinkGroupId
Contents
[
Hide
]LinkedLayersManager.GetLayersByLinkGroupId method
Gets layers by link group id.
public Layer[] GetLayersByLinkGroupId(short linkGroupId)
Parameter | Type | Description |
---|---|---|
linkGroupId | Int16 | The link group id. |
Return Value
The layers array.
Examples
The following example demonstrates how you can manipulate Linked Layers in Aspose.PSD
[C#]
string sourceFile = "example.psd";
string outputFile = "psdnet11_output.psd";
// Load an existing image into an instance of PsdImage class
using (var psd = (PsdImage)Image.Load(sourceFile))
{
Layer[] layers = psd.Layers;
// link all layers in one linked group
short layersLinkGroupId = psd.LinkedLayersManager.LinkLayers(layers);
// gets id for one layer
short linkGroupId = psd.LinkedLayersManager.GetLinkGroupId(layers[0]);
if (layersLinkGroupId != linkGroupId)
{
throw new Exception("layersLinkGroupId and linkGroupId are not equal.");
}
// gets all linked layers by link group id.
Layer[] linkedLayers = psd.LinkedLayersManager.GetLayersByLinkGroupId(linkGroupId);
// unlink each layer from group
foreach (var linkedLayer in linkedLayers)
{
psd.LinkedLayersManager.UnlinkLayer(linkedLayer);
}
// retrieves NULL for a link group ID that has no layers in the group.
linkedLayers = psd.LinkedLayersManager.GetLayersByLinkGroupId(linkGroupId);
if (linkedLayers != null)
{
throw new Exception("The linkedLayers field is not NULL.");
}
psd.Save(outputFile);
}
See Also
- class Layer
- class LinkedLayersManager
- namespace Aspose.PSD.FileFormats.Psd.Layers
- assembly Aspose.PSD