native paint

Aug 24, 2010 at 5:05pm

native paint

Hi,

I would like to develop an external to display music scores, based on the Guido Engine library (http://guidolib.sourceforge.net/). My problem is that the Guido library has already its own graphic device abstraction and needs to be initialized with native devices (CGContextRef on MacOS, HDC on Windows).
Can my external get a native graphic device (for example from a t_jgraphics) ?

Thanks in advance for any help.
Dom

#51949
Aug 24, 2010 at 8:24pm

I would suggest that you render to an offscreen bitmap (CGBitmapContextCreate() for CGContextRef(), and CreateCompatibleBitmap()/SelectObject() for HDC).

Then create a t_jsurface with the pixels via jgraphics_image_surface_create_for_data (you might need to swap the pixel plane ordering). And draw the image in the t_jgraphics.

There’s example usage of jgraphics_image_surface_create_for_data() in Tim’s taptool blue project:

http://code.google.com/p/ttblue/source/browse/branches/active/examples/MaxMSP/tt.graphicsui/tt.graphicsui.cpp?r=1096

#186408
Aug 26, 2010 at 2:27pm

It works ! :-)
Thanks for the tip.

#186409

You must be logged in to reply to this topic.