praeclarum / NGraphics

NGraphics is a cross platform library for rendering vector graphics on .NET. It provides a unified API for both immediate and retained mode graphics using high quality native renderers.
MIT License
705 stars 133 forks source link

DrawText requires Brush on Android, Pen on Windows #85

Open charlesroddie opened 7 years ago

charlesroddie commented 7 years ago

Our testing indicates that DrawText requires a Brush on Android, a Pen on Windows, and probably a Brush on iOS (will confirm).

DrawText(string,Point,Font,Brush) therefore works on Android (and iOS?) and not Win8. DrawText(string,Point,Font,Color) and DrawText(string,Frame,Font,TextAlignment,Color) presumably sets a Brush and works on Android (and iOS?) and not Win8. DrawText(string,Frame,Font,?TextAlignment,?Pen,?Brush) works on Win8 with Pen set, and Android (and iOS?) with Brush set.

charlesroddie commented 7 years ago

This is based on the detailed results:

DrawText(string,Point,Font,Brush) Android works, Win8 doesn't (System.ArgumentException)

DrawText(string,Point,Font,Color) Android works, Win8 doesn't (System.ArgumentException)

DrawText(string,Frame,Font,TextAlignment,Color) Android work, Win8 doesn't (whit text)

DrawText(string,Frame,Font,?TextAlignment,?Pen,?Brush) Win8 works with Pen specified, Brush has no effect. Android works with Brush specified, otherwise blank. Pen has no effect. iOS doesn't work with Pen specified (wrong Color), need to test Brush.

mwpb commented 7 years ago

Some more data points:

DrawText(string,Point,Font,Brush) iOS: works.

DrawText(string,Point,Font,Color) iOS: works.

DrawText(string,Frame,Font,TextAlignment,Color) iOS: works.

DrawText(string,Frame,Font,?TextAlignment,?Pen,?Brush) iOS: works with all specified. iOS: if no brush then colours are wrong.

mwpb commented 7 years ago

So in summary if one uses method 4:

DrawText(string,Frame,Font,?TextAlignment,?Pen,?Brush)

and then sets all of the optional arguments then DrawText works as expected.