Class LsdkResource
LsdkResource class
The lsdk layer resource (nested layer section resource).
public class LsdkResource : BaseLayerSectionResource
Constructors
| Name | Description |
|---|
| LsdkResource() | Initializes a new instance of the LsdkResource class. |
Properties
| Name | Description |
|---|
| BlendModeKey { get; set; } | Gets or sets the blend mode key. |
| 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. |
| SectionType { get; set; } | Gets or sets the section type. |
| virtual Signature { get; } | Gets the signature. |
| Subtype { get; set; } | Gets or sets the subtype. |
Methods
| Name | Description |
|---|
| override Save(StreamContainer, int) | Saves the resource to the specified stream container. |
| override ToString() | Returns a String that represents this instance. |
Fields
| Name | Description |
|---|
| const TypeToolKey | The type tool info key. |
Examples
The following code demonstrates support of LsdkResource.
[C#]
void AssertAreEqual(object expected, object actual, string message = null)
{
if (!object.Equals(expected, actual))
{
throw new FormatException(message ?? "Objects are not equal.");
}
}
string srcFile = "123 1.psd";
string outFile = "output.psd";
using (var psdImage = (PsdImage)Image.Load(srcFile, new PsdLoadOptions() { LoadEffectsResource = true }))
{
AssertAreEqual((psdImage.Layers[8].Resources[3] as LsdkResource).Length, 4);
psdImage.Save(outFile);
}
// check after saving
using (var psdImage = (PsdImage)Image.Load(outFile, new PsdLoadOptions() { LoadEffectsResource = true }))
{
AssertAreEqual((psdImage.Layers[8].Resources[3] as LsdkResource).Length, 4);
}
See Also