VsmsResource Class
Class VsmsResource. This resource contains information about vector layer mask
Inheritance Hierarchy
SystemObject
  Aspose.PSD.FileFormats.Psd.LayersLayerResource
    Aspose.PSD.FileFormats.Psd.Layers.LayerResourcesVectorPathDataResource
      Aspose.PSD.FileFormats.Psd.Layers.LayerResourcesVsmsResource

Namespace: Aspose.PSD.FileFormats.Psd.Layers.LayerResources
Assembly: Aspose.PSD (in Aspose.PSD.dll) Version: 21.10
Syntax
public class VsmsResource : VectorPathDataResource

The VsmsResource type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyIsDisabled
Gets or sets a value indicating whether this instance is disabled.
(Inherited from VectorPathDataResource.)
Public propertyIsInverted
Gets or sets a value indicating whether this instance is inverted.
(Inherited from VectorPathDataResource.)
Public propertyIsNotLinked
Gets or sets a value indicating whether this instance is not linked.
(Inherited from VectorPathDataResource.)
Public propertyKey
Gets the layer resource key.
(Overrides LayerResourceKey.)
Public propertyLength
Gets the layer resource length in bytes.
(Inherited from VectorPathDataResource.)
Public propertyPaths
Gets or sets the path records.
(Inherited from VectorPathDataResource.)
Public propertyPsdVersion
Gets the psd version.
(Inherited from VectorPathDataResource.)
Public propertySignature
Gets the signature.
(Inherited from VectorPathDataResource.)
Public propertyVersion
Gets or sets the version.
(Inherited from VectorPathDataResource.)
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodSave
Saves the resource to the specified stream container.
(Inherited from VectorPathDataResource.)
Protected methodSaveResourceHeader
Saves the resource header.
(Inherited from LayerResource.)
Public methodToString
Returns a String that represents this instance.
(Inherited from LayerResource.)
Fields
  NameDescription
Public fieldStatic memberTypeToolKey
The type tool info key.
Examples
The following example demonstrates the support of VsmsResource resource loading. How works the editing of paths.
[C#]

[Test]
public void TestPsdNet140()
{
    // VsmsResource Support
    string sourceFileName = "EmptyRectangle.psd";
    string exportPath = "EmptyRectangle_changed.psd";
    var im = (PsdImage)Image.Load(sourceFileName);
    using (im)
    {
        var resource = GetVsmsResource(im);
        // Reading
        if (resource.IsDisabled != false ||
            resource.IsInverted != false ||
            resource.IsNotLinked != false ||
            resource.Paths.Length != 7 ||
            resource.Paths[0].Type != VectorPathType.PathFillRuleRecord ||
            resource.Paths[1].Type != VectorPathType.InitialFillRuleRecord ||
            resource.Paths[2].Type != VectorPathType.ClosedSubpathLengthRecord ||
            resource.Paths[3].Type != VectorPathType.ClosedSubpathBezierKnotUnlinked ||
            resource.Paths[4].Type != VectorPathType.ClosedSubpathBezierKnotUnlinked ||
            resource.Paths[5].Type != VectorPathType.ClosedSubpathBezierKnotUnlinked ||
            resource.Paths[6].Type != VectorPathType.ClosedSubpathBezierKnotUnlinked)
        {
            throw new Exception("VsmsResource was read wrong");
        }

        var pathFillRule = (PathFillRuleRecord)resource.Paths[0];
        var initialFillRule = (InitialFillRuleRecord)resource.Paths[1];
        var subpathLength = (LengthRecord)resource.Paths[2];

        // Path fill rule doesn't contain any additional information
        if (pathFillRule.Type != VectorPathType.PathFillRuleRecord ||
        initialFillRule.Type != VectorPathType.InitialFillRuleRecord ||
        initialFillRule.IsFillStartsWithAllPixels != false ||
        subpathLength.Type != VectorPathType.ClosedSubpathLengthRecord ||
        subpathLength.IsClosed != true ||
        subpathLength.IsOpen != false)
        {
            throw new Exception("VsmsResource paths were read wrong");
        }

        // Editing
        resource.IsDisabled = true;
        resource.IsInverted = true;
        resource.IsNotLinked = true;
        var bezierKnot = (BezierKnotRecord)resource.Paths[3];
        bezierKnot.Points[0] = new Point(0, 0);
        bezierKnot = (BezierKnotRecord)resource.Paths[4];
        bezierKnot.Points[0] = new Point(8039798, 10905191);
        initialFillRule.IsFillStartsWithAllPixels = true;
        subpathLength.IsClosed = false;
        im.Save(exportPath);
    }
}

private VsmsResource GetVsmsResource(PsdImage image)
{
    var layer = image.Layers[1];
    VsmsResource resource = null;
    var resources = layer.Resources;
    for (int i = 0; i < resources.Length; i++)
    {
        if (resources[i] is VsmsResource)
        {
            resource = (VsmsResource)resources[i];
            break;
        }
    }
    if (resource == null)
    {
        throw new Exception("VsmsResource not found");
    }
    return resource;
}
See Also