declare function CGContextConvertRectToDeviceSpace lib "AppKit" ( context as integer, rect as CGRect) as CGRect
Dim userRect as CGRect = CGRectMake( x,y,w,h )
Dim repRect as CGRect = CGContextConvertRectToDeviceSpace( g.Handle( g.HandleTypeCGContextRef ), userRect )
You’ll also need a CGRect structure, which is comprised of 4 singles, CGRectMake is just my shortcut for populating the structure.
Basically you pass in the rect you want to draw and it’ll return the actual rect, You can then use that rect to draw into or calculate the scale.