Open lightgmco opened 1 year ago
Ok, so what's the problem?
I need to transform a flight map with thousands of lines and texts and little triangles frequently, so I saved all the lines by a path, so it's faster to transform the map,but text can't be included? If It's impossible to include the text in a path, is it possible to create a specified textPath collection for fast redraw? I just want to try.
You can convert a text line to a path using FontFace.ToPath("text")
. If you want transform a text box, you can use the Text.RenderAsPath(targetRenderer, matrix, resolution)
That's great!So I can merge text in the path!Even js can't achieve that. By the way ,which way is right to merge a path with another one? path1=path1.Join(path2)? path1=path1.Append(path2)?
Append
will simply merge two separate paths into two subpaths. Join
will join both paths by a line, this will leave only one subpath. Remember that using Append
or Join
will give different results when paths overlap then when drawing paths separately! Some parts may cancel out, but if you have no overlapping paths there should be no issue.
Append sounds safe. But if I have some lines in path1,now I want to append a circle with a center(x,y).I tried: path1.MoveTo(x,y) path1=path1.Append(canvas.circle(2)) This way didn't work,I lost those circles.Why?
Because canvas.Circle
creates a path that starts at MoveTo(r,0)
, so appending or joining both would result in MoveTo(x,y) MoveTo(r,0) ArcTo(-r,0) ArcTo(r,0)
which remove the first redundant MoveTo command. You need to translate the circle: canvas.Circle(2).Translate(x,y)
I'm looking for a method to re-draw hundreds of text as fast as I can.