System.Drawing On MONO
Drawing From Mono
Mono provides two mechanism to draw. The first exposes theMicrosoft System.Drawing API and the second exposes the
Cairo (
http://www.cairographics.org) API:
System.Drawing The System.Drawing implementation in Mono is designed to becompatible with the Microsoft API. The imaging model is very similar tothe PDF 1.4 composition-based imaging model.
Our implementation is a C# wrapper around the GDI+ C API (also called the
"GDI+ Flat API" (
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusReference.asp)).This means that the C# code is the same for Windows and UNIX systems. The following graph explains the situation:
In Windows Mono uses the GDI+ library that is included with the operating system (GDIPLUS.DLL, while in UNIX we provide an implementation of this API in the libgdiplus.so shared library. Our
libgdiplus has the same C Flat API as the GDIPLUS.DLL. The C# code that implement System.Drawing is the same for Windows and UNIX builds.Since this is an implementation of an existing Microsoft API no architectural changes go here.
Our implementation currently exposes the 1.1 and 2.0 APIs, witha few limitations from the underlying GDI+ implementation. The detailsare tracked on the
GDI+ todo page (
http://anonsvn.mono-project.com/viewcvs/trunk/libgdiplus/TODO?view=markup).
Mono.Cairo
Cairo is a low-level 2D vector drawing library. Various renderingbackends (XRender, Win32) are already supported and more (ie. glitz --OpenGL hardware accelerated backend) are on the way. The Mono.Cairo.dllassembly exposes the Cairo API to managed applications. The mapping isa pretty straightforward one, and the programming model is very closeto the OpenGL model (although much simpler).
Information, tutorials, and examples can be found on the
Mono.Cairo page.