Class MlstResource

MlstResource class

The mlst resource. This class, among other things, contains information about the position of the layer on the timeline.

public class MlstResource : LayerResource

Constructors

NameDescription
MlstResource()The default constructor.

Properties

NameDescription
DescriptorVersion { get; }Gets or sets the descriptor version.
Items { get; }Gets or sets the structures.
Key { get; }Gets the layer resource key.
override Length { get; }Gets the layer resource length in bytes.
PsdVersion { get; }Gets the minimal psd version required for layer resource. 0 indicates no restrictions.
virtual Signature { get; }Gets the signature.

Methods

NameDescription
override Save(StreamContainer, int)Saves the specified stream container.
override ToString()Returns a String that represents this instance.

Fields

NameDescription
const TypeToolKeyThe type tool info key.

Examples

The following code demonstrates support of MlstResource resource that gives a low-level mechanism to manipulate the layer states.

[C#]

string sourceFile = "image1219.psd";
string outputPsd = "output_image1219.psd";

using (PsdImage image = (PsdImage)Image.Load(sourceFile))
{
    Layer layer1 = image.Layers[1];
    ShmdResource shmdResource = (ShmdResource)layer1.Resources[8];
    MlstResource mlstResource = (MlstResource)shmdResource.SubResources[0];

    ListStructure layerStatesList = (ListStructure)mlstResource.Items[1];
    DescriptorStructure layersStateOnFrame1 = (DescriptorStructure)layerStatesList.Types[1];
    BooleanStructure layerEnabled = (BooleanStructure)layersStateOnFrame1.Structures[0];

    // Disable layer 1 on frame 1
    layerEnabled.Value = false;

    image.Save(outputPsd);
}

See Also