Is it possible to create a Graphics class from a CGContextRef

As the title suggests, I’m looking to use the RB Graphics class to work on a CGContext.


hmmm… That’s going to make this a little more interesting then :slight_smile:

if this would be possible, I’d probably have 10 places where I would create such a graphics object for various graphics contexts.

I was kinda hoping you might be my fallback!

Well, you can make CGcontextMBS from a context ref and use all the methods I added to the plugin there.

Thanks Christian, I was hoping you might have some magic up your sleeve so I didn’t have to use CG commands to do the drawing this time. Don’t get me wrong, I love CoreGraphics, but I also want to support Windows and don’t want to have to use two different graphics toolboxes… But it’s looking like I will have to anyway, to be able to create PDF on Windows.

I should add that I much prefer to use the Xojo text system over CoreText any day, I can get CoreText to kinda of work, but nowhere near as elegantly as Xojo text.

The thing is I’m designing an app, for Mac, Windows and when we can for iOS as well. So I’m trying to avoid declares for the main drawing. It’s wysiwyg editor, so I’d like to use the same code to display on screen, print, export as picture and export as vector PDF on all three platforms. Trying to make a decision is hard. CG will handle everything on the Mac (and I suspect) iOS, but for Windows I guess I must use Xojo for screen, print and bitmap image, which still leaves vector PDF. I know Christian has PDF classes, but again that’s a different graphics toolbox.