CrossGraphics aims to deliver a simple immediate mode interface for drawing graphics on a variety of platforms running .NET.
Currently the following platforms are supported:
- MonoTouch using CoreGraphicsGraphics.cs
- MonoDroid using DroidGraphics.cs
- Silverlight, Windows Phone 7, and Windows Metro (WinRT) using SilverlightGraphics.cs
- OpenGL using OpenGLGraphics.cs
- SVG using SvgGraphics.cs
CrossGraphics assumes that you have partitioned your project into parts that will be cross-platform and parts that are platform-specific.
Add a reference to the cross-platform file
Graphics.cs. This will expose the
CrossGraphics.IGraphics that is the recipient of all drawing commands.
You should now code your objects to be able to draw themselves by being passed and
Drawing commands include:
Rounded Rectangles using
DrawLineand the option
DrawStringand the associated font functions
Add a reference to the appropriate platform-specific implementation of
Create the appropriate graphics context and pass it to your objects that expect
The code is copyright Frank A. Krueger and is released under the MIT license.