Class VogkResource

VogkResource class

The Vector Origination Data resource.

public sealed class VogkResource : LayerResource

Constructors

NameDescription
VogkResource()Initializes a new instance of the VogkResource class.

Properties

NameDescription
override Key { get; }Gets the layer resource key.
override Length { get; }Gets the layer resource length in bytes.
override PsdVersion { get; }Gets the minimal psd version required for layer resource. 0 indicates no restrictions.
ShapeOriginSettings { get; set; }Gets or sets the shape origin settings.
override Signature { get; }Gets the layer resource signature.
Version { get; set; }Gets or sets the version.

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 example demonstrates the support of VogkResource resource.

[C#]

VogkResource GetVogkResource(PsdImage image)
{
    var layer = image.Layers[1];

    VogkResource resource = null;
    var resources = layer.Resources;
    for (int i = 0; i < resources.Length; i++)
    {
        if (resources[i] is VogkResource)
        {
            resource = (VogkResource)resources[i];
            break;
        }
    }

    if (resource == null)
    {
        throw new Exception("VogkResourcenot found.");
    }

    return resource;
}

string sourceFilePath = "VectorOriginationDataResource.psd";
string outputFilePath = "out_VectorOriginationDataResource_.psd";

using (var psdImage = (PsdImage)Image.Load(sourceFilePath))
{
    var resource = GetVogkResource(psdImage);

    // Reading
    if (resource.ShapeOriginSettings.Length != 1 ||
        !resource.ShapeOriginSettings[0].IsShapeInvalidated ||
        resource.ShapeOriginSettings[0].OriginIndex != 0)
    {
        throw new Exception("VogkResource were read wrong.");
    }

    // Editing
    resource.ShapeOriginSettings = new[]
    {
        resource.ShapeOriginSettings[0],
        new VectorShapeOriginSettings(true, 1)
    };

    psdImage.Save(outputFilePath);
}

See Also