Class ArtBResource

ArtBResource class

The Artboard info data for Resources.

public sealed class ArtBResource : BaseArtboardInfoResource

Constructors

NameDescription
ArtBResource()The default constructor.

Properties

NameDescription
ArtboardBackgroundType { get; set; }Gets or sets the ArtboardBackgroundType
Color { get; set; }Gets or sets the Color
Items { get; set; }Gets or sets the OSTypeStructure items.
Key { get; }Gets the layer resource key.
override Length { get; }
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 resource to 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 the support of Artboard resources.

[C#]

string srcFile = "artboard1.psd";

using (PsdImage psdImage = (PsdImage)Image.Load(srcFile))
{
    ArtDResource artDResource = (ArtDResource)psdImage.GlobalLayerResources[2];

    ArtBResource artBResource1 = (ArtBResource)psdImage.Layers[2].Resources[7];
    ArtBResource artBResource2 = (ArtBResource)psdImage.Layers[5].Resources[7];

    LyvrResource lyvrResource1 = (LyvrResource)psdImage.Layers[2].Resources[9];
    LyvrResource lyvrResource2 = (LyvrResource)psdImage.Layers[5].Resources[9];

    var countStruct = (IntegerStructure)artDResource.Items[0];
    AssertAreEqual(2, countStruct.Value);

    var presetNameStruct1 = (StringStructure)artBResource1.Items[2];
    AssertAreEqual("iPhone X\0", presetNameStruct1.Value);

    var presetNameStruct2 = (StringStructure)artBResource2.Items[2];
    AssertAreEqual("iPhone X\0", presetNameStruct2.Value);

    AssertAreEqual(160, lyvrResource1.Version);
    AssertAreEqual(160, lyvrResource2.Version);
}

void AssertAreEqual(object expected, object actual)
{
    if (!object.Equals(expected, actual))
    {
        throw new Exception("Objects are not equal.");
    }
}

See Also