Open stcmz opened 1 year ago
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Description
Back in the times of System.Drawing.Graphics, we can pass any brush to the DrawString method. This includes LinearGradientBrush. In Maui Graphics, DrawString/DrawText takes the FontColor property instead of the stroke or paint in drawing a string. Unlike other Draw*** and Fill*** pairs, there are also no FillString or FillText variants.
So, I would love to have some new FillString/FillText and StrokeString/StrokeText APIs be added to the ICanvas interface. To ensure the backward compatibility, the behavior of the existing DrawString/DrawText methods will not be changed. The FillString/FillText APIs shall make use of the paint set with SetFillPaint while the StrokeString/StrokeText APIs shall make use of the stroke settings (StrokeColor, StrokeSize, etc.)
Public API Changes
Intended Use-Case
This will enhance the ability of text/string drawing in Microsoft.Maui.Graphics. Effects like gradient color filled text or hollow out text will be achievable. Without the proposed APIs, one has to use SkiaSharp to convert the text to SKPath and then convert back to PathF, which will be consumed by the ICanvas to draw the text. Custom extension methods can be implemented. However, since the Font and FontSize properties are not readable in ICanvas, additional parameters for the font have to be passed in.