1
0

dpi.h 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. /*#ifndef _WA_DPI_H
  3. #define _WA_DPI_H*/
  4. #ifdef __cplusplus
  5. extern "C"
  6. {
  7. #endif
  8. #include <windows.h>
  9. // DPI awareness based on http://msdn.microsoft.com/en-US/library/dd464660.aspx
  10. // Definition: relative pixel = 1 pixel at 96 DPI and scaled based on actual DPI.
  11. // Get screen DPI.
  12. int GetDPIX();
  13. int GetDPIY();
  14. // Convert between raw pixels and relative pixels.
  15. int ScaleX(int x);
  16. int ScaleY(int y);
  17. int UnscaleX(int x);
  18. int UnscaleY(int y);
  19. int _ScaledSystemMetricX(int nIndex);
  20. int _ScaledSystemMetricY(int nIndex);
  21. // Determine the screen dimensions in relative pixels.
  22. int ScaledScreenWidth();
  23. int ScaledScreenHeight();
  24. // Scale rectangle from raw pixels to relative pixels.
  25. void ScaleRect(__inout RECT *pRect);
  26. // Determine if screen resolution meets minimum requirements in relative pixels.
  27. BOOL IsResolutionAtLeast(int cxMin, int cyMin);
  28. // Convert a point size (1/72 of an inch) to raw pixels.
  29. int PointsToPixels(int pt);
  30. #ifdef __cplusplus
  31. } // extern "C"
  32. #endif
  33. //#endif