# Class Win32DPIUtils

java.lang.Object
org.eclipse.swt.internal.Win32DPIUtils

public class Win32DPIUtils extends Object
This class is used in the win32 implementation only to provide DPI related utility methods.

IMPORTANT: This class is not part of the public API for SWT. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms, and should never be called from application code.

Restriction:
  This class is not intended to be referenced by clients

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static final class`
`Win32DPIUtils.AutoScaleImageDataProvider`
AutoScale ImageDataProvider.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CUSTOM_DPI_AWARENESS_PROPERTY`
This property allows to customize the DPI awareness of the application's UI thread, such that different DPI awareness modes are supported via configuration and not only via the application's executable manifest.

## Constructor Summary

Constructors
Constructor
Description
`Win32DPIUtils()`

## Method Summary

Modifier and Type
Method
Description
`static int`
`getPrimaryMonitorZoomAtStartup()`
`static boolean`
`hasProperDpiAwarenessForMonitorSpecificScaling()`
`static boolean`
`initializeCustomDpiAwareness()`
`static float[]`
`pixelToPoint(float[] size, int zoom)`
`static float[]`
`pixelToPoint(Drawable drawable, float[] size, int zoom)`
`static float`
`pixelToPoint(Drawable drawable, float size, int zoom)`
`static int`
`pixelToPoint(Drawable drawable, int size, int zoom)`
`static Rectangle`
`pixelToPoint(Drawable drawable, Rectangle rect, int zoom)`
`static Rectangle`
`pixelToPoint(Rectangle rect, int zoom)`
`static Point`
`pixelToPointAsLocation(Drawable drawable, Point point, int zoom)`
`static Point`
`pixelToPointAsLocation(Point point, int zoom)`
`static Point`
`pixelToPointAsSize(Drawable drawable, Point point, int zoom)`
`static Point`
`pixelToPointAsSize(Point point, int zoom)`
`static Point`
`pixelToPointAsSufficientlyLargeSize(Drawable drawable, Point point, int zoom)`
`static Point`
`pixelToPointAsSufficientlyLargeSize(Point point, int zoom)`
`static Rectangle`
`pixelToPointWithSufficientlyLargeSize(Rectangle rect, int zoom)`
`static float`
`pointToPixel(float size, int zoom)`
`static int[]`
`pointToPixel(int[] pointArray, int zoom)`
`static float[]`
`pointToPixel(Drawable drawable, float[] values, int zoom)`
`static float`
`pointToPixel(Drawable drawable, float size, int zoom)`
`static int[]`
`pointToPixel(Drawable drawable, int[] pointArray, int zoom)`
`static int`
`pointToPixel(Drawable drawable, int size, int zoom)`
`static Rectangle`
`pointToPixel(Drawable drawable, Rectangle rect, int zoom)`
`static Rectangle`
`pointToPixel(Rectangle rect, int zoom)`
`static Point`
`pointToPixelAsLocation(Drawable drawable, Point point, int zoom)`
`static Point`
`pointToPixelAsLocation(Point point, int zoom)`
`static Point`
`pointToPixelAsSize(Drawable drawable, Point point, int zoom)`
`static Point`
`pointToPixelAsSize(Point point, int zoom)`
`static Point`
`pointToPixelAsSufficientlyLargeSize(Point point, int zoom)`
`static Rectangle`
`pointToPixelWithSufficientlyLargeSize(Rectangle rect, int zoom)`
`static <T> T`
`runWithProperDPIAwareness(Display display, Supplier<T> operation)`
`static Rectangle`
`scaleBounds(Rectangle rect, int targetZoom, int currentZoom)`
Returns a new rectangle as per the scaleFactor.
`static boolean`
`setDPIAwareness(long desiredDpiAwareness)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### CUSTOM_DPI_AWARENESS_PROPERTY

public static final String CUSTOM_DPI_AWARENESS_PROPERTY
This property allows to customize the DPI awareness of the application's UI thread, such that different DPI awareness modes are supported via configuration and not only via the application's executable manifest. Supported modes are "System", "PerMonitor", and "PerMonitorV2".

See Also:
  - Constant Field Values

## Constructor Details

### Win32DPIUtils

public Win32DPIUtils()

## Method Details

### initializeCustomDpiAwareness

public static boolean initializeCustomDpiAwareness()

### setDPIAwareness

public static boolean setDPIAwareness(long desiredDpiAwareness)

### hasProperDpiAwarenessForMonitorSpecificScaling

public static boolean hasProperDpiAwarenessForMonitorSpecificScaling()

### runWithProperDPIAwareness

public static <T> T runWithProperDPIAwareness(Display display, Supplier<T> operation)

### pixelToPoint

public static float[] pixelToPoint(float[] size, int zoom)

### pixelToPoint

public static float[] pixelToPoint(Drawable drawable, float[] size, int zoom)

### pixelToPoint

public static int pixelToPoint(Drawable drawable, int size, int zoom)

### pixelToPoint

public static float pixelToPoint(Drawable drawable, float size, int zoom)

### pixelToPointAsSize

public static Point pixelToPointAsSize(Drawable drawable, Point point, int zoom)

### pixelToPointAsSufficientlyLargeSize

public static Point pixelToPointAsSufficientlyLargeSize(Drawable drawable, Point point, int zoom)

### pixelToPointAsLocation

public static Point pixelToPointAsLocation(Drawable drawable, Point point, int zoom)

### pixelToPointAsSize

public static Point pixelToPointAsSize(Point point, int zoom)

### pixelToPointAsLocation

public static Point pixelToPointAsLocation(Point point, int zoom)

### pixelToPointAsSufficientlyLargeSize

public static Point pixelToPointAsSufficientlyLargeSize(Point point, int zoom)

### pixelToPoint

public static Rectangle pixelToPoint(Rectangle rect, int zoom)

### pixelToPointWithSufficientlyLargeSize

public static Rectangle pixelToPointWithSufficientlyLargeSize(Rectangle rect, int zoom)

### pixelToPoint

public static Rectangle pixelToPoint(Drawable drawable, Rectangle rect, int zoom)

### scaleBounds

public static Rectangle scaleBounds(Rectangle rect, int targetZoom, int currentZoom)
Returns a new rectangle as per the scaleFactor.

### pointToPixel

public static int[] pointToPixel(int[] pointArray, int zoom)

### pointToPixel

public static float[] pointToPixel(Drawable drawable, float[] values, int zoom)

### pointToPixel

public static int[] pointToPixel(Drawable drawable, int[] pointArray, int zoom)

### pointToPixel

public static int pointToPixel(Drawable drawable, int size, int zoom)

### pointToPixel

public static float pointToPixel(float size, int zoom)

### pointToPixel

public static float pointToPixel(Drawable drawable, float size, int zoom)

### pointToPixelAsSize

public static Point pointToPixelAsSize(Drawable drawable, Point point, int zoom)

### pointToPixelAsLocation

public static Point pointToPixelAsLocation(Drawable drawable, Point point, int zoom)

### pointToPixelAsSize

public static Point pointToPixelAsSize(Point point, int zoom)

### pointToPixelAsSufficientlyLargeSize

public static Point pointToPixelAsSufficientlyLargeSize(Point point, int zoom)

### pointToPixelAsLocation

public static Point pointToPixelAsLocation(Point point, int zoom)

### pointToPixel

public static Rectangle pointToPixel(Rectangle rect, int zoom)

### pointToPixelWithSufficientlyLargeSize

public static Rectangle pointToPixelWithSufficientlyLargeSize(Rectangle rect, int zoom)

### pointToPixel

public static Rectangle pointToPixel(Drawable drawable, Rectangle rect, int zoom)

### getPrimaryMonitorZoomAtStartup

public static int getPrimaryMonitorZoomAtStartup()