native paint

fober's icon

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

Joshua Kit Clayton's icon

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:

fober's icon

It works ! :-)
Thanks for the tip.