Package qupath.fx.controls.tour
Class TourUtils
java.lang.Object
qupath.fx.controls.tour.TourUtils
Utility methods for working with tours.
TODO: Since these methods are not tour-specific, it is intended to move them to qupath-fxtras.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.geometry.Rectangle2DboundsToRect(javafx.geometry.Bounds bounds) Convert the 2D component of a bounds object to a rectangle.static javafx.geometry.BoundscomputeScreenBounds(List<? extends javafx.scene.Node> nodes) Compute the bounding box for all specified nodes.static javafx.scene.image.ImagecreateScaledSnapshot(javafx.scene.Node node, double scale) Create a snapshot image of a node with a transparent background, scaled by the specified factor.static javafx.scene.image.ImagecreateScaledSnapshot(javafx.scene.Node node, javafx.geometry.Rectangle2D bounds, double scale) Create a snapshot image of a node with a transparent background, scaled by the specified factor and optionally cropping to the specified bounds.static javafx.scene.image.ImagecreateScaledSnapshot(javafx.stage.Window window, javafx.geometry.Rectangle2D screenBounds, double scale) Create a snapshot image of a portion of a window, using screen coordinates and a transparent background.static javafx.geometry.BoundsrectToBounds(javafx.geometry.Rectangle2D rect) Convert a rectangle to a bounds object.
-
Constructor Details
-
TourUtils
public TourUtils()
-
-
Method Details
-
computeScreenBounds
Compute the bounding box for all specified nodes.- Parameters:
nodes-- Returns:
-
createScaledSnapshot
public static javafx.scene.image.Image createScaledSnapshot(javafx.scene.Node node, double scale) Create a snapshot image of a node with a transparent background, scaled by the specified factor.This can be used as a convenient alternative to
node.snapshot(params, image)when we want a higher or lower-resolution image.- Parameters:
node- the node to snapshotscale- the scale factor; use 1.0 for the original size- Returns:
-
createScaledSnapshot
public static javafx.scene.image.Image createScaledSnapshot(javafx.scene.Node node, javafx.geometry.Rectangle2D bounds, double scale) Create a snapshot image of a node with a transparent background, scaled by the specified factor and optionally cropping to the specified bounds.This can be used as a convenient alternative to
node.snapshot(params, image)when we want a higher or lower-resolution image.- Parameters:
node- the node to snapshotbounds- the bounds to snapshot; use null for the entire nodescale- the scale factor; use 1.0 for the original size- Returns:
- the snapshot image
-
createScaledSnapshot
public static javafx.scene.image.Image createScaledSnapshot(javafx.stage.Window window, javafx.geometry.Rectangle2D screenBounds, double scale) Create a snapshot image of a portion of a window, using screen coordinates and a transparent background.Note that this will snapshot the content of the window only; it does not include window decorations.
- Parameters:
window- the window to snapshotscreenBounds- the screen coordinates to snapshot; if null, the entire content of the window will be usedscale- the scale factor; use 1.0 for the original size- Returns:
- the snapshot image
-
rectToBounds
public static javafx.geometry.Bounds rectToBounds(javafx.geometry.Rectangle2D rect) Convert a rectangle to a bounds object.- Parameters:
rect-- Returns:
-
boundsToRect
public static javafx.geometry.Rectangle2D boundsToRect(javafx.geometry.Bounds bounds) Convert the 2D component of a bounds object to a rectangle.- Parameters:
bounds-- Returns:
-