scaleFactorForOrigin static method
Calculates the DPI scale factor for the specified window dimensions
.
Implementation
static double scaleFactorForOrigin(math.Rectangle<int> dimensions) {
final point = calloc<POINT>();
point.ref
..x = dimensions.left
..y = dimensions.top;
final dpiX = calloc<UINT>();
final dpiY = calloc<UINT>();
final hmonitor = MonitorFromPoint(
point.ref, MONITOR_FROM_FLAGS.MONITOR_DEFAULTTONEAREST);
GetDpiForMonitor(hmonitor, MONITOR_DPI_TYPE.MDT_EFFECTIVE_DPI, dpiX, dpiY);
final dpi = dpiX.value;
free(point);
free(dpiX);
free(dpiY);
return dpi / 96.0;
}