[Mono-osx] Draw Image and Font

De Santis Luca farolfo at hotmail.com
Fri Mar 9 23:19:37 UTC 2012

I've try solution with subclass of nsview and override the DrawRect and run well inside a normal application. But now I've moved the draw function inside an external DLL. I use a double buffer to draw to screen a NSImage.
I call this function, stored in and external DLL, from main application:
public static void DrawImage(ref NSImage mainBuffer, NSImageRep ImageAPIObj,Rectangle tmpRect,int BlendValue)
but I recive this error message:
<Error>: CGContextSetBlendMode: invalid context 0x0<Error>: CGContextGetBlendMode: invalid context 0x0<Error>: CGContextSetBlendMode: invalid context 0x0<Error>: CGContextDrawImage: invalid context 0x0
I can't understand how to use Graphic Context on mac applicanion with monomac.
Subject: Re: [Mono-osx] Draw Image and Font
From: jon.lipsky at elevenworks.com
Date: Mon, 6 Feb 2012 15:57:28 -0600
CC: mono-osx at lists.ximian.com
To: farolfo at hotmail.com

Hi Luca,
Create a subclass of NSView, and override the DrawRect method:
public override void DrawRect(RectangleF rect)
   var context = NSGraphicsContext.CurrentContext;

   ... do your drawing here ...   

You can then add your custom view to a window.
On Feb 6, 2012, at 3:48 PM, De Santis Luca wrote:I need draw image and font on a Cocoa Window with a loop, like videogame. I use NSImage to store images, but with monomac documentation I can't understad how to create a graphic context and draw all images on the window.
Mono-osx mailing list
Mono-osx at lists.ximian.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-osx/attachments/20120310/3eb2da46/attachment.html>

More information about the Mono-osx mailing list