Saftpresse99
Saftpresse99

Reputation: 979

Convert System.Drawing.Pen to SkiaSharp Type

i have an old asp.net project which uses heavily system.drawing types. But for performance reasons (process wide locking etc.) i will switch to skia/skiasharp. As a first migration step i am looking for a way to convert Pens, Brushes and Fonts to equivalent skiasharp types. Is this possible?
I only find extension methods for Color etc.

Upvotes: 0

Views: 1225

Answers (1)

Particleman
Particleman

Reputation: 679

Yes, you should find SkiaSharp to be a suitable replacement for System.Drawing. Pens and Brushes are condensed into the SKPaint object. See the examples here.

https://developer.xamarin.com/guides/xamarin-forms/advanced/skiasharp/basics/text/

As for fonts you use the static SKTypeface class to create an instance of an SKTypeface. There are a variety of ways to bring in fonts for example:

SKTypeface.FromFamilyName(String, SKFontStyleWeight, SKFontStyleWidth, SKFontStyleSlant) 

https://developer.xamarin.com/api/type/SkiaSharp.SKTypeface/

Upvotes: 2

Related Questions