Packages

 

com.aspose.psd.fileformats.psd.layers.layerresources.vectorpaths

Class LengthRecord



  • public class LengthRecord
    extends VectorPathRecord

    Subpath Length Record Class

    Code example:

    An example of changing path operations when working with shapes. The program reads a predefined vector path records (LengthRecord) and changes their path operations then saves a modified copy of the document as a new PSD file.


                
    String inPsdFilePath = "PathOperationsShape.psd";
    String outPsdFilePath = "out_" + inPsdFilePath;
                
    // Load a PSD file containing a predefined vsms resource
    PsdImage psdImage = (PsdImage)Image.load(inPsdFilePath);
    try
    {
        // Find first VsmsResource in resources of the predefined layer
        VsmsResource resource = null;
        for (LayerResource layerResource : psdImage.getLayers()[1].getResources())
        {
            if (layerResource instanceof VsmsResource)
            {
                resource = (VsmsResource)layerResource;
                break;
            }
        }
                
        LengthRecord lengthRecord0 = (LengthRecord)resource.getPaths()[2];
        LengthRecord lengthRecord1 = (LengthRecord)resource.getPaths()[7];
        LengthRecord lengthRecord2 = (LengthRecord)resource.getPaths()[11];
                
        // Change the way in which shapes are combined
        lengthRecord0.setPathOperations(PathOperations.ExcludeOverlappingShapes);
        lengthRecord1.setPathOperations(PathOperations.IntersectShapeAreas);
        lengthRecord2.setPathOperations(PathOperations.SubtractFrontShape);
                
        // Save a modified copy of loaded PSD file on the path
        psdImage.save(outPsdFilePath);
    }
    finally
    {
        psdImage.dispose();
    }
    

    • Constructor Detail

      • LengthRecord

        public LengthRecord(byte[] data)

        Initializes a new instance of the LengthRecord class.

        Parameters:
        data - The record data.
        Throws:
        PsdImageArgumentException - Incorrect data for LengthRecord creation
      • LengthRecord

        public LengthRecord()

        Initializes a new instance of the LengthRecord class.

    • Method Detail

      • isClosed

        public final boolean isClosed()

        Gets or sets a value indicating whether this instance is closed.

        Value: true if this instance is closed; otherwise, false.
      • setClosed

        public final void setClosed(boolean value)

        Gets or sets a value indicating whether this instance is closed.

        Value: true if this instance is closed; otherwise, false.
      • isOpen

        public final boolean isOpen()

        Gets or sets a value indicating whether this instance is open.

        Value: true if this instance is open; otherwise, false.
      • setOpen

        public final void setOpen(boolean value)

        Gets or sets a value indicating whether this instance is open.

        Value: true if this instance is open; otherwise, false.
      • getRecordCount

        public final int getRecordCount()

        Gets or sets the record count.

        Value: The record count.
      • setRecordCount

        public final void setRecordCount(int value)

        Gets or sets the record count.

        Value: The record count.
      • getType

        public short getType()

        Gets the type.

        Value: The type.
        Specified by:
        getType in class VectorPathRecord
      • getBezierKnotRecordsCount

        public final int getBezierKnotRecordsCount()

        Gets or sets the bezier knot records count.

      • setBezierKnotRecordsCount

        public final void setBezierKnotRecordsCount(int value)

        Gets or sets the bezier knot records count.

      • getPathOperations

        public final int getPathOperations()

        Gets or sets the path operations.

      • setPathOperations

        public final void setPathOperations(int value)

        Gets or sets the path operations.

      • getShapeIndex

        public final int getShapeIndex()

        Gets or sets the index of current path shape in layer.

      • setShapeIndex

        public final void setShapeIndex(int value)

        Gets or sets the index of current path shape in layer.