public class DPIUtil extends Object
The autoScaleUp(..)
methods convert from API coordinates (in
SWT points) to internal high DPI coordinates (in pixels) that interface with
native widgets.
The autoScaleDown(..)
convert from high DPI pixels to API coordinates
(in SWT points).
Modifier and Type | Class and Description |
---|---|
static class |
DPIUtil.AutoScaleImageDataProvider
AutoScale ImageDataProvider.
|
Constructor and Description |
---|
DPIUtil() |
Modifier and Type | Method and Description |
---|---|
static Rectangle |
autoScaleBounds(Rectangle rect,
int targetZoom,
int currentZoom)
Returns a new rectangle as per the scaleFactor.
|
static ImageData |
autoScaleDown(Device device,
ImageData imageData)
Auto-scale down ImageData
|
static float |
autoScaleDown(Drawable drawable,
float size)
Auto-scale down float dimensions if enabled for Drawable class.
|
static float[] |
autoScaleDown(Drawable drawable,
float[] size)
Auto-scale up float array dimensions if enabled for Drawable class.
|
static int |
autoScaleDown(Drawable drawable,
int size)
Auto-scale down int dimensions if enabled for Drawable class.
|
static int[] |
autoScaleDown(Drawable drawable,
int[] pointArray) |
static Point |
autoScaleDown(Drawable drawable,
Point point)
Returns a new scaled down Point if enabled for Drawable class.
|
static Rectangle |
autoScaleDown(Drawable drawable,
Rectangle rect)
Returns a new scaled down Rectangle if enabled for Drawable class.
|
static float |
autoScaleDown(float size)
Auto-scale down float dimensions.
|
static float[] |
autoScaleDown(float[] size)
Auto-scale up float array dimensions.
|
static int |
autoScaleDown(int size)
Auto-scale down int dimensions.
|
static int[] |
autoScaleDown(int[] pointArray) |
static Point |
autoScaleDown(Point point)
Returns a new scaled down Point.
|
static Rectangle |
autoScaleDown(Rectangle rect)
Returns a new scaled down Rectangle.
|
static ImageData |
autoScaleImageData(Device device,
ImageData imageData,
int targetZoom,
int currentZoom)
Auto-scale image with ImageData
|
static ImageData |
autoScaleUp(Device device,
ImageData imageData)
Auto-scale up ImageData
|
static float |
autoScaleUp(Drawable drawable,
float size) |
static int |
autoScaleUp(Drawable drawable,
int size)
Auto-scale up int dimensions if enabled for Drawable class.
|
static int[] |
autoScaleUp(Drawable drawable,
int[] pointArray) |
static Point |
autoScaleUp(Drawable drawable,
Point point)
Returns a new scaled up Point if enabled for Drawable class.
|
static Rectangle |
autoScaleUp(Drawable drawable,
Rectangle rect)
Returns a new scaled up Rectangle if enabled for Drawable class.
|
static float |
autoScaleUp(float size) |
static int |
autoScaleUp(int size)
Auto-scale up int dimensions.
|
static int[] |
autoScaleUp(int[] pointArray) |
static Point |
autoScaleUp(Point point)
Returns a new scaled up Point.
|
static Rectangle |
autoScaleUp(Rectangle rect)
Returns a new scaled up Rectangle.
|
static int |
getDeviceZoom() |
static int |
mapDPIToZoom(int dpi)
Compute the zoom value based on the DPI value.
|
static void |
setDeviceZoom(int nativeDeviceZoom) |
static ImageData |
validateAndGetImageDataAtZoom(ImageDataProvider provider,
int zoom,
boolean[] found)
Gets Image data at specified zoom level, if image is missing then
fall-back to 100% image.
|
static String |
validateAndGetImagePathAtZoom(ImageFileNameProvider provider,
int zoom,
boolean[] found)
Gets Image file path at specified zoom level, if image is missing then
fall-back to 100% image.
|
public static ImageData autoScaleDown(Device device, ImageData imageData)
public static int[] autoScaleDown(int[] pointArray)
public static int[] autoScaleDown(Drawable drawable, int[] pointArray)
public static float[] autoScaleDown(float[] size)
public static float[] autoScaleDown(Drawable drawable, float[] size)
public static int autoScaleDown(int size)
public static int autoScaleDown(Drawable drawable, int size)
public static float autoScaleDown(float size)
public static float autoScaleDown(Drawable drawable, float size)
public static Point autoScaleDown(Drawable drawable, Point point)
public static Rectangle autoScaleDown(Rectangle rect)
public static Rectangle autoScaleDown(Drawable drawable, Rectangle rect)
public static ImageData autoScaleImageData(Device device, ImageData imageData, int targetZoom, int currentZoom)
public static Rectangle autoScaleBounds(Rectangle rect, int targetZoom, int currentZoom)
public static ImageData autoScaleUp(Device device, ImageData imageData)
public static int[] autoScaleUp(int[] pointArray)
public static int[] autoScaleUp(Drawable drawable, int[] pointArray)
public static int autoScaleUp(int size)
public static int autoScaleUp(Drawable drawable, int size)
public static float autoScaleUp(float size)
public static float autoScaleUp(Drawable drawable, float size)
public static Point autoScaleUp(Drawable drawable, Point point)
public static Rectangle autoScaleUp(Drawable drawable, Rectangle rect)
public static int mapDPIToZoom(int dpi)
public static ImageData validateAndGetImageDataAtZoom(ImageDataProvider provider, int zoom, boolean[] found)
public static String validateAndGetImagePathAtZoom(ImageFileNameProvider provider, int zoom, boolean[] found)
public static int getDeviceZoom()
public static void setDeviceZoom(int nativeDeviceZoom)
Copyright © 2017. All Rights Reserved.