Interface ScalableSurface
- All Known Subinterfaces:
Window
- All Known Implementing Classes:
GLCanvas
,GLJPanel
,GLWindow
,JAWTWindow
NativeSurface
implementation,
see setSurfaceScale(float[])
.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
Setting surface-pixel-scale of 0.0f, results in maximum platform dependent pixel-scale, i.e.static final float
Setting surface-pixel-scale of 1.0f, results in same pixel- and window-units. -
Method Summary
Modifier and TypeMethodDescriptionfloat[]
getCurrentSurfaceScale
(float[] result) Returns the current pixel scale of the associatedNativeSurface
.float[]
getMaximumSurfaceScale
(float[] result) Returns the maximum pixel scale of the associatedNativeSurface
.float[]
getMinimumSurfaceScale
(float[] result) Returns the minimum pixel scale of the associatedNativeSurface
.float[]
getRequestedSurfaceScale
(float[] result) Returns therequested
pixel scale of the associatedNativeSurface
.boolean
setSurfaceScale
(float[] pixelScale) Request a pixel scale in x- and y-direction for the associatedNativeSurface
, wheresize_in_pixel_units = pixel_scale * size_in_window_units
.
-
Field Details
-
IDENTITY_PIXELSCALE
static final float IDENTITY_PIXELSCALESetting surface-pixel-scale of 1.0f, results in same pixel- and window-units.- See Also:
-
AUTOMAX_PIXELSCALE
static final float AUTOMAX_PIXELSCALESetting surface-pixel-scale of 0.0f, results in maximum platform dependent pixel-scale, i.e. pixel-units >> window-units where available.- See Also:
-
-
Method Details
-
setSurfaceScale
boolean setSurfaceScale(float[] pixelScale) Request a pixel scale in x- and y-direction for the associatedNativeSurface
, wheresize_in_pixel_units = pixel_scale * size_in_window_units
.Default pixel scale request for both directions is
AUTOMAX_PIXELSCALE
.In case platform only supports uniform pixel scale, i.e. one scale for both directions, either
AUTOMAX_PIXELSCALE
or the maximum requested pixel scale component is used.The requested pixel scale will be validated against platform limits before native scale-setup, i.e. clipped to
IDENTITY_PIXELSCALE
if not supported or clipped to the platform maximum. It can be queried viagetRequestedSurfaceScale(float[])
.The actual realized pixel scale values of the
NativeSurface
can be queried viagetCurrentSurfaceScale(float[])
or computed viasurface.
convertToPixelUnits
(new int[] { 1, 1 })- Parameters:
pixelScale
- requested surface pixel scale float[2] values for x- and y-direction.- Returns:
true
if thecurrent pixel scale
has changed, otherwisefalse
.- See Also:
-
getRequestedSurfaceScale
float[] getRequestedSurfaceScale(float[] result) Returns therequested
pixel scale of the associatedNativeSurface
.- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the current pixelScale for chaining
- See Also:
-
getCurrentSurfaceScale
float[] getCurrentSurfaceScale(float[] result) Returns the current pixel scale of the associatedNativeSurface
.- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the current pixelScale for chaining
-
getMinimumSurfaceScale
float[] getMinimumSurfaceScale(float[] result) Returns the minimum pixel scale of the associatedNativeSurface
.- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the minimum pixelScale for chaining
-
getMaximumSurfaceScale
float[] getMaximumSurfaceScale(float[] result) Returns the maximum pixel scale of the associatedNativeSurface
.The maximum pixel scale maybe used to determine the proper dpi value of the monitor displaying this
NativeSurface
.surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale, with PpMM == pixel per millimeter
- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the maximum pixelScale for chaining
-