VectorPathDataResource

VectorPathDataResource class

Class VectorPathDataResource. This resource contains information about vector layer mask

public abstract class VectorPathDataResource : LayerResource, IVectorPathData

Properties

Name Description
IsDisabled { get; set; } Gets or sets a value indicating whether this instance is disabled.
IsInverted { get; set; } Gets or sets a value indicating whether this instance is inverted.
IsNotLinked { get; set; } Gets or sets a value indicating whether this instance is not linked.
abstract Key { get; } Gets the layer resource key.
override Length { get; } Gets the layer resource length in bytes.
Paths { get; set; } Gets or sets the path records.
override PsdVersion { get; } Gets the psd version.
override Signature { get; } Gets the signature.
Version { get; set; } Gets or sets the version.

Methods

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

Examples

The following example demonstrates the support of Layer Vector Masks processing. How works the editing of paths and how Aspose.PSD draw the final image.

[C#]

string sourceFileName = "DifferentLayerMasks_Source.psd";
string exportPath = "DifferentLayerMasks_Export.psd";
string exportPathPng = "DifferentLayerMasks_Export.png";

// Reading
using (PsdImage image = (PsdImage)Image.Load(sourceFileName))
{
    // Make changes to the vector path points
    foreach (var layer in image.Layers)
    {
        foreach (var layerResource in layer.Resources)
        {
            var resource = layerResource as VectorPathDataResource;
            if (resource != null)
            {
                foreach (var pathRecord in resource.Paths)
                {
                    var bezierKnotRecord = pathRecord as BezierKnotRecord;
                    if (bezierKnotRecord != null)
                    {
                        Point p0 = bezierKnotRecord.Points[0];
                        bezierKnotRecord.Points[0] = bezierKnotRecord.Points[2];
                        bezierKnotRecord.Points[2] = p0;
                        break;
                    }
                }
            }
        }
    }

    // Exporting
    image.Save(exportPath);
    image.Save(exportPathPng, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}

See Also