Get a HiDPI disposable Graphics Context

This seems pretty basic, but I have forgotten how to do this.

I need to get a graphics context in order to calculate the position of a string to draw in a canvas. I do NOT want to do this in the canvas paint event. The whole idea is to calculate the X and Y in advance in order to speed up the drawing.

The string to draw is a property of a subclassed Object2D. The problem is, calculating X and Y in advance of drawing require a graphics context. As I’ve read, this is also important now because of HiDPI, to use the graphics object because the screen pixel density can be different than other visually equal width and height properties.

So the question is: how do I get a HiDPI disposable graphics context?

make a picture and use it’s graphics property.

this function: Page Not Found — Xojo documentation

Ah, thank you. That helps. I had read the Xojo blog post about this and then promptly forgot it!

Just for completeness sake, here are the blog entries:

https://blog.xojo.com/2016/04/05/xojo-retinahidpi-the-journey-of-a-thousand-pixels/

https://blog.xojo.com/2016/04/07/advanced-retinahidpi-bitmapforcaching-and-scalefactorchanged/

and a German blog from Ulrich:

https://xojoblog.me/2017/01/07/schnell-scharf/