'Release' 个来自 CompoundPath 的形状
'Release' shapes from CompoundPath
我有一个复杂的形状,它是使用 CompoundPath
和多个 Path
子项生成的。这是一个示例形状:
我想知道 paperjs
上是否有某种方法或其他一些方法可以生成简单的 Paths
以及由 Paths
中所有 Paths
的组合生成的不同形状=11=],类似于 Release
操作 Adobe Illustrator
,如 here.
所述
我需要这个以便能够使用 fillColor
属性 填充不同的 Path
颜色,这在 CompoundPath
中是不可能的.
compoundPath.parent.addChildren(compoundPath.children)
与 paperjs 中的 Release
类似。
我创建an example.
我终于按照说明解决了here. Quoting @iconexperience:
I think what you need to do is to call setClockwise(true) on your
CompoundPath and then call reorient(). This will set the orientation
(clockwise/counter-clockwise) of each child path so that if several
paths are stacked above each other, their orientation will be
alternating. starting with clockwise for the bottom path. After that,
if the orientation of a child in the CompoundPath is clockwise it
represents a 'hole' or white area in your image. a clockwise
orientation means that the path is filled.
If you then clone the children of the CompoundPath and fill the ones
with clockwise orientation in brown color and the other ones in white
color, you should have a result that will look like the original.
reorient() will only work if there are no intersections between the
paths. Also, please note that reorient() is only available in the
development version of Paper.js.
我有一个复杂的形状,它是使用 CompoundPath
和多个 Path
子项生成的。这是一个示例形状:
我想知道 paperjs
上是否有某种方法或其他一些方法可以生成简单的 Paths
以及由 Paths
中所有 Paths
的组合生成的不同形状=11=],类似于 Release
操作 Adobe Illustrator
,如 here.
我需要这个以便能够使用 fillColor
属性 填充不同的 Path
颜色,这在 CompoundPath
中是不可能的.
compoundPath.parent.addChildren(compoundPath.children)
与 paperjs 中的 Release
类似。
我创建an example.
我终于按照说明解决了here. Quoting @iconexperience:
I think what you need to do is to call setClockwise(true) on your CompoundPath and then call reorient(). This will set the orientation (clockwise/counter-clockwise) of each child path so that if several paths are stacked above each other, their orientation will be alternating. starting with clockwise for the bottom path. After that, if the orientation of a child in the CompoundPath is clockwise it represents a 'hole' or white area in your image. a clockwise orientation means that the path is filled.
If you then clone the children of the CompoundPath and fill the ones with clockwise orientation in brown color and the other ones in white color, you should have a result that will look like the original.
reorient() will only work if there are no intersections between the paths. Also, please note that reorient() is only available in the development version of Paper.js.