Using System.Drawing to render to a cocoa NSView

View: New views
2 Messages — Rating Filter:   Alert me  

Using System.Drawing to render to a cocoa NSView

by Martin Smith-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I would like to render to a cocoa NSView using a Graphics object.
I've played around with System.Drawing a bit, and haven't found an
easy way to do this.  I was wondering if anybody knew the best way to
go about doing this.  I'm bouncing between creating my own layer that
does rendering and eschewing Mono's System.Drawing layer altogether,
but I was wondering if there might be an easier way to leverage Cairo
to render to a CGContextRef that's backed by an NSView.

Thanks in advance,
Martin
_______________________________________________
Mono-osx mailing list
Mono-osx@...
http://lists.ximian.com/mailman/listinfo/mono-osx

Re: Using System.Drawing to render to a cocoa NSView

by Ben Martin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Martin,

I am doing this with my app.  I found the easiest way is by using monobjc http://www.monobjc.net/.  It allows you to cast between most Obj-C and .NET classes.

I draw everything to a system.drawing.bitmap and then cast to NSImage.

Ben