Stop using System.Drawing
opcon opened this issue · comments
Patrick Yates-Jones commented
The System.Drawing namespace always causes problems with Mono, and while QuickFont works okay now, it is a good idea to move away from System.Drawing altogether.
The following is a list of ways System.Drawing is used in the current codebase, and a replacement:
Use | Alternative |
---|---|
Bitmap manipulation | ImageSharp, a cross-platform image manipulation library. Still in early alpha, but probably usable enough. |
Size/Rectangle/Point structs | Can just implement these as standalone structs - see OpenTK |
Text Rendering hints for bitmaps | Not sure if this is needed or will make a difference |
Converting SharpFont FTBitmaps to GDIBitmaps | Can replace this conversion mechanism with one using ImageSharp |
Loading fonts in the GDIFont class | No alternative, this method of loading uses System.Drawing specifically for loading the fonts and so will be removed along with System.Drawing |
Color class/list | OpenTK has Color4, could use that instead. What does ImageSharp use? |
Font Style | Can create a simple enumeration for this |
Brushes | Can probably use ImageSharp |
Patrick Yates-Jones commented
ImageSharp contains the Size
, Rectangle(F)
, Point
structures, as well as an equivalent of the System.Drawing.Color
struct. There is also some form of brush support.