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 |
|---|---|
| public static class | DPIUtil.
AutoScale ImageDataProvider. |
| private static enum | |
| public static record | DPIUtil.
type of the element to be presented, e.g., T>ImageDataRepresents an element, such as some image data, at a specific zoom level. |
| Modifier and Type | Field and Description |
|---|---|
| private static DPIUtil. | |
| private static DPIUtil. | |
| private static String | |
| private static int | |
| private static final int | |
| private static int | |
| private static final String | SWT_AUTOSCALE
System property that controls the autoScale functionality. |
| private static final String | SWT_AUTOSCALE_METHOD
System property that controls the method for scaling images:
|
| private static boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static Rectangle | autoScaleBounds(Rectangle rect, int targetZoom, int currentZoom)
Returns a new rectangle as per the scaleFactor. |
| public static ImageData | |
| public static int[] | |
| public static int[] | |
| public static float[] | |
| public static float[] | autoScaleDown(Drawable drawable, float[] size)
Auto-scale down float array dimensions if enabled for Drawable class. |
| public static int | |
| public static int | autoScaleDown(Drawable drawable, int size)
Auto-scale down int dimensions if enabled for Drawable class. |
| public static float | |
| public static float | autoScaleDown(Drawable drawable, float size)
Auto-scale down float dimensions if enabled for Drawable class. |
| public static Point | |
| public static Point | autoScaleDown(Drawable drawable, Point point)
Returns a new scaled down Point if enabled for Drawable class. |
| public static Rectangle | |
| public static Rectangle | autoScaleDown(Drawable drawable, Rectangle rect)
Returns a new scaled down Rectangle if enabled for Drawable class. |
| public static ImageData | autoScaleImageData(Device device, final ImageData imageData, int targetZoom, int currentZoom)
Auto-scale image with ImageData |
| private static ImageData | |
| public static ImageData | autoScaleImageData(Device device, final ImageData imageData, int imageDataZoomFactor)
Auto-scale ImageData to device zoom that are at given zoom factor. |
| public static ImageData | autoScaleUp(Device device, final ImageData imageData)
Auto-scale up ImageData to device zoom that is at 100%. |
| public static int[] | |
| public static int[] | |
| public static int | |
| public static int | |
| public static float | |
| public static float | |
| public static Point | |
| public static Point | autoScaleUp(Drawable drawable, Point point)
Returns a new scaled up Point if enabled for Drawable class. |
| public static Rectangle | |
| public static Rectangle | autoScaleUp(Drawable drawable, Rectangle rect)
Returns a new scaled up Rectangle if enabled for Drawable class. |
| public static int | |
| public static int | |
| private static <T> DPIUtil. | |
| private static float | |
| public static int | |
| public static int | |
| public static void | |
| public static void | |
| public static boolean | |
| public static DPIUtil. | validateAndGetImageDataAtZoom(ImageDataProvider provider, int zoom)
Gets ImageData that are appropriate for the specified zoom level together with the zoom level at which the image data are. |
| public static DPIUtil. | validateAndGetImagePathAtZoom(ImageFileNameProvider provider, int zoom)
Gets the image file path that are appropriate for the specified zoom level together with the zoom level at which the image data are. |
| autoScaleMethod | back to summary |
|---|---|
| private static DPIUtil. | |
| autoScaleMethodSetting | back to summary |
|---|---|
| private static DPIUtil. | |
| autoScaleValue | back to summary |
|---|---|
| private static String autoScaleValue | |
| deviceZoom | back to summary |
|---|---|
| private static int deviceZoom | |
| DPI_ZOOM_100 | back to summary |
|---|---|
| private static final int DPI_ZOOM_100 | |
| nativeDeviceZoom | back to summary |
|---|---|
| private static int nativeDeviceZoom | |
| SWT_AUTOSCALE | back to summary |
|---|---|
| private static final String SWT_AUTOSCALE System property that controls the autoScale functionality.
| |
| SWT_AUTOSCALE_METHOD | back to summary |
|---|---|
| private static final String SWT_AUTOSCALE_METHOD System property that controls the method for scaling images:
| |
| useCairoAutoScale | back to summary |
|---|---|
| private static boolean useCairoAutoScale | |
| DPIUtil | back to summary |
|---|---|
| public DPIUtil() | |
| autoScaleBounds | back to summary |
|---|---|
| public static Rectangle autoScaleBounds(Rectangle rect, int targetZoom, int currentZoom) Returns a new rectangle as per the scaleFactor. | |
| autoScaleDown | back to summary |
|---|---|
| public static ImageData autoScaleDown(Device device, final ImageData imageData) Auto-scale down ImageData | |
| autoScaleDown | back to summary |
|---|---|
| public static int[] autoScaleDown(int[] pointArray) | |
| autoScaleDown | back to summary |
|---|---|
| public static int[] autoScaleDown(Drawable drawable, int[] pointArray) | |
| autoScaleDown | back to summary |
|---|---|
| public static float[] autoScaleDown(float[] size) Auto-scale down float array dimensions. | |
| autoScaleDown | back to summary |
|---|---|
| public static float[] autoScaleDown(Drawable drawable, float[] size) Auto-scale down float array dimensions if enabled for Drawable class. | |
| autoScaleDown | back to summary |
|---|---|
| public static int autoScaleDown(int size) Auto-scale down int dimensions. | |
| autoScaleDown | back to summary |
|---|---|
| public static int autoScaleDown(Drawable drawable, int size) Auto-scale down int dimensions if enabled for Drawable class. | |
| autoScaleDown | back to summary |
|---|---|
| public static float autoScaleDown(float size) Auto-scale down float dimensions. | |
| autoScaleDown | back to summary |
|---|---|
| public static float autoScaleDown(Drawable drawable, float size) Auto-scale down float dimensions if enabled for Drawable class. | |
| autoScaleDown | back to summary |
|---|---|
| public static Point autoScaleDown(Point point) Returns a new scaled down Point. | |
| autoScaleDown | back to summary |
|---|---|
| public static Point autoScaleDown(Drawable drawable, Point point) Returns a new scaled down Point if enabled for Drawable class. | |
| autoScaleDown | back to summary |
|---|---|
| public static Rectangle autoScaleDown(Rectangle rect) Returns a new scaled down Rectangle. | |
| autoScaleDown | back to summary |
|---|---|
| public static Rectangle autoScaleDown(Drawable drawable, Rectangle rect) Returns a new scaled down Rectangle if enabled for Drawable class. | |
| autoScaleImageData | back to summary |
|---|---|
| public static ImageData autoScaleImageData(Device device, final ImageData imageData, int targetZoom, int currentZoom) Auto-scale image with ImageData | |
| autoScaleImageData | back to summary |
|---|---|
| private static ImageData autoScaleImageData(Device device, final ImageData imageData, float scaleFactor) | |
| autoScaleImageData | back to summary |
|---|---|
| public static ImageData autoScaleImageData(Device device, final ImageData imageData, int imageDataZoomFactor) Auto-scale ImageData to device zoom that are at given zoom factor. | |
| autoScaleUp | back to summary |
|---|---|
| public static ImageData autoScaleUp(Device device, final ImageData imageData) Auto-scale up ImageData to device zoom that is at 100%. | |
| autoScaleUp | back to summary |
|---|---|
| public static int[] autoScaleUp(int[] pointArray) | |
| autoScaleUp | back to summary |
|---|---|
| public static int[] autoScaleUp(Drawable drawable, int[] pointArray) | |
| autoScaleUp | back to summary |
|---|---|
| public static int autoScaleUp(int size) Auto-scale up int dimensions. | |
| autoScaleUp | back to summary |
|---|---|
| public static int autoScaleUp(Drawable drawable, int size) Auto-scale up int dimensions if enabled for Drawable class. | |
| autoScaleUp | back to summary |
|---|---|
| public static float autoScaleUp(float size) | |
| autoScaleUp | back to summary |
|---|---|
| public static float autoScaleUp(Drawable drawable, float size) | |
| autoScaleUp | back to summary |
|---|---|
| public static Point autoScaleUp(Point point) Returns a new scaled up Point. | |
| autoScaleUp | back to summary |
|---|---|
| public static Point autoScaleUp(Drawable drawable, Point point) Returns a new scaled up Point if enabled for Drawable class. | |
| autoScaleUp | back to summary |
|---|---|
| public static Rectangle autoScaleUp(Rectangle rect) Returns a new scaled up Rectangle. | |
| autoScaleUp | back to summary |
|---|---|
| public static Rectangle autoScaleUp(Drawable drawable, Rectangle rect) Returns a new scaled up Rectangle if enabled for Drawable class. | |
| autoScaleUpUsingNativeDPI | back to summary |
|---|---|
| public static int autoScaleUpUsingNativeDPI(int size) Auto-scale up int dimensions using Native DPI | |
| getDeviceZoom | back to summary |
|---|---|
| public static int getDeviceZoom() | |
| getElementAtZoom | back to summary |
|---|---|
| private static <T> DPIUtil. | |
| getScalingFactor | back to summary |
|---|---|
| private static float getScalingFactor() Returns Scaling factor from the display
| |
| getZoomForAutoscaleProperty | back to summary |
|---|---|
| public static int getZoomForAutoscaleProperty(int nativeDeviceZoom) | |
| mapDPIToZoom | back to summary |
|---|---|
| public static int mapDPIToZoom(int dpi) Compute the zoom value based on the DPI value.
| |
| setDeviceZoom | back to summary |
|---|---|
| public static void setDeviceZoom(int nativeDeviceZoom) | |
| setUseCairoAutoScale | back to summary |
|---|---|
| public static void setUseCairoAutoScale(boolean cairoAutoScale) | |
| useCairoAutoScale | back to summary |
|---|---|
| public static boolean useCairoAutoScale() | |
| validateAndGetImageDataAtZoom | back to summary |
|---|---|
| public static DPIUtil. Gets ImageData that are appropriate for the specified zoom level together with the zoom level at which the image data are. If there is an image at the specified zoom level, it is returned. Otherwise the next larger image at 150% and 200% is returned, if existing. If none of these is found, the 100% image is returned as a fallback. If provider or fallback image is not available, an error is thrown. | |
| validateAndGetImagePathAtZoom | back to summary |
|---|---|
| public static DPIUtil. Gets the image file path that are appropriate for the specified zoom level together with the zoom level at which the image data are. If there is an image at the specified zoom level, it is returned. Otherwise the next larger image at 150% and 200% is returned, if existing. If none of these is found, the 100% image is returned as a fallback. If provider or fallback image is not available, an error is thrown. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv Device | |
| pack-priv ImageData |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ImageData | getImageData(int
The zoom level in % of the standard resolution (which is 1
physical monitor pixel == 1 SWT logical point). Typically 100,
150, or 200. zoom)Implements org. |
| currentZoom | back to summary |
|---|---|
| pack-priv int currentZoom | |
| device | back to summary |
|---|---|
| pack-priv Device device | |
| imageData | back to summary |
|---|---|
| pack-priv ImageData imageData | |
| AutoScaleImageDataProvider | back to summary |
|---|---|
| public AutoScaleImageDataProvider(Device device, ImageData data, int zoom) | |
| getImageData | back to summary |
|---|---|
| public ImageData getImageData(int zoom) Implements org. Doc from org. Returns the image data for the given zoom level.
If no image is available for a particular zoom level, this method should
return | |
| Modifier and Type | Field and Description |
|---|---|
| public static final DPIUtil. | |
| public static final DPIUtil. | |
| public static final DPIUtil. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static DPIUtil. | |
| public static DPIUtil. |
| AUTO | back to summary |
|---|---|
| public static final DPIUtil. | |
| NEAREST | back to summary |
|---|---|
| public static final DPIUtil. | |
| SMOOTH | back to summary |
|---|---|
| public static final DPIUtil. | |
| AutoScaleMethod | back to summary |
|---|---|
| private AutoScaleMethod() | |
| valueOf | back to summary |
|---|---|
| public static DPIUtil. | |
| values | back to summary |
|---|---|
| public static DPIUtil. | |
ImageData
| Modifier and Type | Field and Description |
|---|---|
| private final T | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public T | |
| public final boolean | equals(Object
the reference object with which to compare. o)Implements abstract java. |
| public final int | |
| public final String | toString()
Implements abstract java. |
| public int |
| element | back to summary |
|---|---|
| private final T element Record Component accessed by element(). | |
| zoom | back to summary |
|---|---|
| private final int zoom Record Component accessed by zoom(). | |
| ElementAtZoom | back to summary |
|---|---|
| public ElementAtZoom(T element, int zoom) | |
| element | back to summary |
|---|---|
| public T element() Record Component getter of element. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of
| |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.
| |
| zoom | back to summary |
|---|---|
| public int zoom() Record Component getter of zoom. | |