divide
Function
Common
fun Path.divide(contours: MutableList<Path> = mutableListOf()): MutableList<Path>
Divides this path into a list of paths. Each contour inside this path is returned as a separate
Path
. For instance the following code snippet creates two rectangular contours:
val p = Path()
p.addRect(...)
p.addRect(...)
val contours = p.divide()
The list returned by calling p.divide()
will contain two Path
instances, each representing
one of the two rectangles.
Empty contours (contours with no lines/curves) are omitted from the resulting list.
Parameters
contours | An optional mutable list of Path that will hold the result of the division. |
Returns
A list of Path representing all the contours in this path. The returned list is either a newly allocated list if the contours parameter was left unspecified, or the contours parameter. |