Forums > Dev

native paint

August 24, 2010 | 5:05 pm

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


August 24, 2010 | 8:24 pm

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


August 26, 2010 | 2:27 pm

It works ! :-)
Thanks for the tip.


Viewing 3 posts - 1 through 3 (of 3 total)