Displays an image view with the ability to zoom in, zoom out, zoom to fit. It can be also automatically resized to the parent's size. When zoomToFit is set to true, the image is sized to fit the parent scroll pane.
Sample usage (full detains in ImageDisplayDemoApp)
object ImageDisplayDemoApp extends JFXApp3 {
override def start(): Unit = {
private val imageDisplay = new ImageDisplay()
stage = new PrimaryStage {
scene = new Scene(640, 480) {
title = "ImageDisplay Demo"
root = new BorderPane {
top = new ToolBar {
items = Seq(
new Button("Open...") {
onAction = () => onFileOpen()
},
new Button("Zoom In") {
onAction = () => imageDisplay.zoomIn()
disable <== imageDisplay.zoomToFit
},
new Button("Zoom Out") {
onAction = () => imageDisplay.zoomOut()
disable <== imageDisplay.zoomToFit
},
new ToggleButton("Zoom to fit") {
selected <==> imageDisplay.zoomToFit
}
)
}
center = imageDisplay.view
}
}
}
}
}
Overlays displayed on the image. Changes in individual members of the overlay collection, like size or location, are not being observed. To force an update, you need to assign a new collection.
Overlays displayed on the image. Changes in individual members of the overlay collection, like size or location, are not being observed. To force an update, you need to assign a new collection.
Each rectangle represents individual overlay. Rectangle properties used to draw the overlay:
stroke - color/paint of the outline. If null, no outline will be drawn.
strokeWidth - width of the line in screen pixels. The width is maintained constant to the display, regardless of zoom.
fill - fill color/paint. If null, no outline will be drawn.
Note that the opacity of is controlled by opacity of the stroke and fill paint.
Controls image zoom when zoomToFit is off. The value of 1 means no scaling. Values larger than 1 make image larger. Values smaller than 1 make image smaller.
Controls image zoom when zoomToFit is off. The value of 1 means no scaling. Values larger than 1 make image larger. Values smaller than 1 make image smaller.