Class PixelScaleSupportJFX
GLCanvasJFX.
Reads the current pixel scale from Window.getRenderScaleX() /
Window.getRenderScaleY() (the actual scale used by Prism — typically equal to the
screen output scale, but possibly capped by the JVM property prism.allowhidpi).
Falls back to Screen.getOutputScaleX() / Screen.getOutputScaleY() when the
canvas is not yet attached to a window — for example during construction.
Listeners are wired in cascade so that the scale-change events keep firing even when the
canvas is reparented to a different scene or stage:
canvas.sceneProperty -> scene.windowProperty -> window.renderScaleX/Y.
Unlike the AWT support, no polling is needed: JavaFX publishes a property change every time the render scale changes (e.g. monitor switch, OS scaling change).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(panamagl.canvas.PixelScaleListener l) panamagl.canvas.PixelScalecurrent()Last value reported to listeners.panamagl.canvas.PixelScaleread()Read the current pixel scale, walking the canvas->scene->window chain when possible.voidremoveListener(panamagl.canvas.PixelScaleListener l) voidstart()Wire the listener cascade.voidstop()
-
Constructor Details
-
PixelScaleSupportJFX
public PixelScaleSupportJFX(javafx.scene.canvas.Canvas canvas)
-
-
Method Details
-
read
public panamagl.canvas.PixelScale read()Read the current pixel scale, walking the canvas->scene->window chain when possible. -
current
public panamagl.canvas.PixelScale current()Last value reported to listeners. -
start
public void start()Wire the listener cascade. Idempotent. Must be called from the JavaFX application thread — which is whereGLCanvasJFXconstructs its support. -
stop
public void stop() -
addListener
public void addListener(panamagl.canvas.PixelScaleListener l) -
removeListener
public void removeListener(panamagl.canvas.PixelScaleListener l)
-