Is it possible to create a new path given an existing Skia Path? #949
-
The only ways to create a SkPath are the following (from export interface PathFactory {
Make(): SkPath;
/**
* Creates a new path from the provided SVG string. If this fails, null will be
* returned instead.
* @param str
*/
MakeFromSVGString(str: string): SkPath | null;
/**
* Creates a new path by combining the given paths according to op. If this fails, null will
* be returned instead.
* @param one
* @param two
* @param op
*/
MakeFromOp(one: SkPath, two: SkPath, op: PathOp): SkPath | null;
/**
* Creates a new path from the given list of path commands. If this fails, null will be
* returned instead.
* @param cmds
*/
MakeFromCmds(cmds: PathCommand[]): SkPath | null;
/**
* Converts the text to a path with the given font at location x / y.
*/
MakeFromText(text: string, x: number, y: number, font: SkFont): SkPath | null;
} If I have an existing The only thing I can think of is something like: const basePath = Skia.Path.Make();
basePath.moveTo(0, 100);
basePath.lineTo(200,200);
const newPath = Skia.Path.MakeFromOp(basePath, Skia.Path.Make(), PathOp.Union);
newPath.lineTo(50, 50) since |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Just realised I can do |
Beta Was this translation helpful? Give feedback.
-
there is |
Beta Was this translation helpful? Give feedback.
there is
path.copy()
which does just that, I hope this helps.