Interface ScalableSurface
-
- All Known Implementing Classes:
JAWTWindow
public interface ScalableSurface
Adding mutable surface pixel scale property to implementing class, usually to aNativeSurface
implementation, seesetSurfaceScale(float[])
.
-
-
Field Summary
Fields Modifier and Type Field Description static float
AUTOMAX_PIXELSCALE
Setting surface-pixel-scale of 0.0f, results in maximum platform dependent pixel-scale, i.e.static float
IDENTITY_PIXELSCALE
Setting surface-pixel-scale of 1.0f, results in same pixel- and window-units.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description float[]
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 Detail
-
IDENTITY_PIXELSCALE
static final float IDENTITY_PIXELSCALE
Setting surface-pixel-scale of 1.0f, results in same pixel- and window-units.- See Also:
- Constant Field Values
-
AUTOMAX_PIXELSCALE
static final float AUTOMAX_PIXELSCALE
Setting surface-pixel-scale of 0.0f, results in maximum platform dependent pixel-scale, i.e. pixel-units >> window-units where available.- See Also:
- Constant Field Values
-
-
Method Detail
-
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[] 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:
setSurfaceScale(float[])
-
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
-
-