I'm starting to write a small application for Linux under the Mono framework, the application will essentially be a small kiosk front-end with very minimal user interaction. This is to replace a previous version of the same application which was 100% text / console based.
As this will run on a Raspberry Pi, I want to avoid running X and have my application talk to the Framebuffer directly. I'm set on using the Mono framework and C# as my development language since I know C# very well. Portability is not an issue in this instance.
I'm having some trouble finding appropriate libraries and bindings to let me access the Framebuffer from Mono however. The GTK#
libraries all bind explicitly to the X11 interface, and in any case, there don't appear to be pre-built GtkFB libraries in Debian Wheezy for the ARM Soft-Float (armel) architecture.
The Mono.Cairo
library exposes a DirectFBSurface
type, however the constructor for that surface takes two IntPtr
arguments and is not documented so I don't know what should be passed into the constructor to properly initialise the Framebuffer as a Cairo Surface.
Has anyone worked with Mono and C# to talk to the Linux Framebuffer, and if so, can you provide basic examples to initialise and start drawing onto the FB, or point to online documentation to assist?
Update 1
I thought I'd try instantiating the DirectFBSurface with null
for both constructor parameters, with the following code:
public static void Main(string[] args)
{
// ...
DirectFBSurface surface = new DirectFBSurface(((IntPtr)null), ((IntPtr)null));
// ...
}
I expected this to generate an exception indicating that null
parameter values were not permitted, however it instead looks as if the DirectFBSurface is either not implemented in Mono.Cairo
or is not compiled into the library shipped with Debian Wheezy (armel):
Unhandled Exception: System.EntryPointNotFoundException: cairo_directfb_surface_create
at (wrapper managed-to-native) Cairo.NativeMethods:cairo_directfb_surface_create (intptr,intptr)
at Cairo.DirectFBSurface..ctor (IntPtr dfb, IntPtr dfb_surface) [0x00000] in <filename unknown>:0
at Info.Insch.SandBox.TestCairo.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
So it appears that the Mono.Cairo
approach probably won't work for my needs, and as noted above, GTK#
Framebuffer library doesn't seem to be part of Debian Wheezy for armel. Is there another set of libraries which I could use to access the Linux Framebuffer from Mono?