UXP Toolkit
    Preparing search index...

    A path or drawing object, such as the outline of a shape or a straight or curved line, which contains sub paths defining its geometry.

    Access through the collection in the Document.pathItems property. For example, this selects a named path item:

    const currentPathItem = app.activeDocument.pathItems.getByName("myPath");
    currentPathItem.select()

    Create these objects by passing a set of SubPathInfo objects to the PathItems.add() method. This method creates a SubPathItem object for each SubPathInfo object, and creates and returns a new PathItem object for the path represented by all of the subpaths.

    23.3

    Index

    Accessors

    Methods

    • Fills the area enclosed by this path.

      opacity is a percentage, in the [0.0 ... 100.0] range.

      feather is in pixels, in the [0.0 ... 250.0] range.

      If wholePath is true, all subpaths are used when doing the fill.

      Parameters

      • OptionalfillColor: SolidColor
      • Optionalmode: ColorBlendMode
      • Optionalopacity: number
      • OptionalpreserveTransparency: boolean
      • Optionalfeather: number
      • OptionalwholePath: boolean
      • OptionalantiAlias: boolean

      Returns Promise<void>

      const path = app.activeDocument.pathItems[0];
      const fillColor = new SolidColor();
      fillColor.rgb.red = 255;
      fillColor.rgb.green = 0;
      fillColor.rgb.blue = 0;
      await path.fillPath(fillColor, constants.ColorBlendMode.NORMAL, 100, false, 0, true, true);

      23.3

    • Strokes the path with the specified tool

      tool is optional, and by default will use ToolType.PENCIL

      simulatePressure is false by default.

      If the tool is ToolType.CLONESTAMP or ToolType.HEALINGBRUSH, sourceOrigin must be provided as a an object with x and y properties (in pixels) to indicate the location of the stroke source. sourceLayer is optional, and by default will use the active layer in the document.

      Parameters

      • Optionaltool: ToolType
      • OptionalsimulatePressure: boolean
      • OptionalsourceOrigin: { x: number; y: number }
      • OptionalsourceLayer: Layer

      Returns Promise<void>

      // Stroke a path with the brush tool
      const path = app.activeDocument.pathItems[0];
      await path.strokePath(constants.ToolType.BRUSH, false);
      // Stroke with clone stamp tool
      const path = app.activeDocument.pathItems[0];
      await path.strokePath(
      constants.ToolType.CLONESTAMP,
      false,
      {x: 100, y: 100},
      app.activeDocument.layers[0]
      );

      23.3