Class GUIUtils
org.pepsoft.util.GUIUtils.disableScaling - set to true to force the scale to 100%
org.pepsoft.snapshotVersion - set to true to cause the UI scale preference to be loaded from a
separate, snapshot setting
Created by pepijn on 13-Jan-17.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intHow many times to scale pixel sizes to display at approximately the originally intended size for assets which were designed for 92-96 dpi screens.static final floatThe detected system default UI scale. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatHow many times to scale pixel sizes to display at approximately the originally intended size for assets which were designed for 96 dpi screens.static intHow many times to scale pixel sizes to display at approximately the originally intended size for assets which were designed for 92-96 dpi screens.static voidscaleLookAndFeel(float scale) Adjusts theUIManagerdefaults to show the Java 2D UI at the specified scale.static voidstatic BufferedImageScale an image according toUI_SCALE.static BufferedImageScale an image according toUI_SCALE_FLOATorUI_SCALE.static voidscaleWindow(Window window) static voidsetUIScale(float uiScale) Override the detected system default UI scale.
-
Field Details
-
SYSTEM_UI_SCALE_FLOAT
public static final float SYSTEM_UI_SCALE_FLOATThe detected system default UI scale.Note: for now UI scaling is only activated on Windows, until the current support on Mac and Linux can be investigated.
-
SYSTEM_UI_SCALE
public static final int SYSTEM_UI_SCALEHow many times to scale pixel sizes to display at approximately the originally intended size for assets which were designed for 92-96 dpi screens.This is
UI_SCALE_FLOATrounded to the nearest integer and is intended for small images that don't scale well to non integer factors such as icons.Note: for now UI scaling is only activated on Windows, until the current support on Mac and Linux can be investigated.
-
-
Constructor Details
-
GUIUtils
public GUIUtils()
-
-
Method Details
-
scaleToUI
Scale an image according toUI_SCALE. Nearest neighbour scaling is used, in other words no smoothing or interpolation is applied.- Parameters:
image- The image to scale.- Returns:
- The original image if
UI_SCALEis 1, or an appropriately scaled copy otherwise.
-
scaleToUI
Scale an image according toUI_SCALE_FLOATorUI_SCALE.- Parameters:
image- The image to scale.smooth- Whether to do smooth scaling. When this istrue, the image is scaled to the floating point UI scale using bicubic scaling. When it isfalse, it is scaled to the UI scale rounded to the nearest integer, using nearest neighbour scaling.- Returns:
- The original image if
UI_SCALEis 1, or an appropriately scaled copy otherwise.
-
scaleToUI
-
scaleWindow
-
scaleLookAndFeel
public static void scaleLookAndFeel(float scale) Adjusts theUIManagerdefaults to show the Java 2D UI at the specified scale. -
setUIScale
public static void setUIScale(float uiScale) Override the detected system default UI scale.- Parameters:
uiScale- The UI scale to use instead of the detected system default.
-
getUIScale
public static float getUIScale()How many times to scale pixel sizes to display at approximately the originally intended size for assets which were designed for 96 dpi screens.Note: for now UI scaling is only activated on Windows, until the current support on Mac and Linux can be investigated.
-
getUIScaleInt
public static int getUIScaleInt()How many times to scale pixel sizes to display at approximately the originally intended size for assets which were designed for 92-96 dpi screens.This is
getUIScale()rounded to the nearest integer and is intended for small images that don't scale well to non integer factors such as icons.Note: for now UI scaling is only activated on Windows, until the current support on Mac and Linux can be investigated.
-