PathItem
一个路径或绘图对象,如一个形状的轮廓或一条直线或弧线。 它包含定义其几何形状的子路径。
通过集合中的 Document.pathItems 属性。例如,这就选择了一个命名的路径项目。
Copied to your clipboard1const currentPathItem = app.activeDocument.pathItems.getByName("myPath");2currentPathItem.select()
创建这些对象的方法是:通过传递一组 SubPathInfo 对象调用 PathItems.add() 方法。这个方法创建了 SubPathItem 对象,为每个 SubPathInfo 对象,并创建和返回一个新的 PathItem 对象为 所有子路径所代表的路径。
Properties
名称 | 类型 | 访问 | 最低版本 | 描述 |
---|---|---|---|---|
docId | number | R | 23.3 | 这个 pathItem 的文档ID |
id | number | R | 23.3 | 用于批处理播放操作。这个pathItem ID和它的文档ID可以在这个文档的生命周期内用来代表这个pathItem |
kind | PathKind | R W | 23.3 | 具体的路径种类。 |
name | string | R W | 23.3 | 该路径的名称 |
parent | Document | R | 23.3 | 该路径所在的文件。 |
subPathItems | SubPathItems | R | 23.3 | 包含的内容 SubPathItems 在这一路径中。 |
typename | string | R | 23.3 | 被引用对象的类名: "PathItem". |
Methods
deselect
23.3Promise<void>
取消选择这个 pathItem
对象.
duplicate
23.3Promise<PathItem>
复制了 pathItem
对象的新名称,并返回其副本
Parameters
名称 | 类型 |
---|---|
name? | string |
fillPath
23.3Promise<void>
填充此路径所包围的区域.
opacity
是一个百分比,在 [0.0 ... 100.0]
范围.
feather
是以像素为单位,在 [0.0 ... 250.0]
范围.
如果 wholePath
为true,在进行填充时将使用所有子路径。
Parameters
名称 | 类型 | 默认值 |
---|---|---|
fillColor? | SolidColor | - |
mode? | ColorBlendMode | - |
opacity | number | 100.0 |
preserveTransparency | boolean | false |
feather | number | 0.0 |
wholePath | boolean | true |
antiAlias | boolean | true |
makeClippingPath
23.3Promise<void>
使之成为该文件的剪切路径。
flatness
告诉PostScript打印机如何接近路径中的曲线。
Parameters
名称 | 类型 |
---|---|
flatness? | number |
makeSelection
23.3Promise<void>
制作一个选择对象,其边界为该路径。
feather
是以像素为单位,范围为 [0.0...250.0]
operation
, 默认情况下,是 SelectionType.REPLACE
Parameters
名称 | 类型 |
---|---|
feather? | number |
antiAlias? | boolean |
operation? | SelectionType |
remove
23.3Promise<void>
删除这个对象。
select
23.3Promise<void>
使其成为活动或选定的 PathItem
对象.
strokePath
23.3Promise<void>
用指定的工具描边路径
tool
是可选的,默认情况下将使用 ToolType.PENCIL
simulatePressure
默认为false。
如果工具 ToolType.CLONESTAMP
或ToolType.HEALINGBRUSH
, sourceOrigin
必须作为
具有x和y属性(以像素为单位)的对象,用于指示笔画源的位置。source ceLayer
是可选的,默认情况下将使用文档中的活动层。
Parameters
名称 | 类型 | 默认值 |
---|---|---|
tool | ToolType | - |
simulatePressure | boolean | false |
sourceOrigin? | object | - |
sourceOrigin.x | number | - |
sourceOrigin.y | number | - |
sourceLayer? | Layer | - |