How to use stroke in a paragraph, or achieve a similar effect to stroke="purple" using other methods? #2271
-
The link provided is the effect implemented in SVG. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I've been looking for a method of doing this too and the best solution I can come up with is to add multiple shadows on the group layer as so:
This then produces this output: It's not particularly ideal as you need a blur on it otherwise the shadows create an ugly stepping effect (blurLevel = 0) It's a bit of a shame that Paragraph doesn't support the Style={'stroke'} like Text does (usage as suggested by this answer here: #2401) If anyone else has a better method then I would love to hear it. |
Beta Was this translation helpful? Give feedback.
-
As previously mentioned, I wasn't happy with the solution of using shadows to achieve this effect, so I did some more research and reading through the documents and I came across the Morphology Image Filter which should be applied on the Group Layer. By applying this on a text, and then overlaying a duplicate text over the top, you can create a pretty good outline/stroke effect. `
` with the result looking like this: I hope this has helped someone. |
Beta Was this translation helpful? Give feedback.
-
I've found a third, and much more performant method of doing this. When building a a paragraph you can use pushStyle() to add your style, a foreground and background paint (as demoed here) The foreground allows us to provide a Skia paint object which we can then set the stye of drawing - from the default of Fill to PaintStyle.Stroke, then you just have to set the stroke width and the colour.
The downsize of that is that you will just get an outlined piece of text with a transparent centre (which is cool if that's what you want). But to create a filled text just add another And this is what the result will look like: |
Beta Was this translation helpful? Give feedback.
I've been looking for a method of doing this too and the best solution I can come up with is to add multiple shadows on the group layer as so: