Class TourUtils

java.lang.Object
qupath.fx.controls.tour.TourUtils

public class TourUtils extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static javafx.geometry.Rectangle2D
    boundsToRect(javafx.geometry.Bounds bounds)
    Convert the 2D component of a bounds object to a rectangle.
    static javafx.geometry.Bounds
    computeScreenBounds(List<? extends javafx.scene.Node> nodes)
    Compute the bounding box for all specified nodes.
    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.
    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.
    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.
    static javafx.geometry.Bounds
    rectToBounds(javafx.geometry.Rectangle2D rect)
    Convert a rectangle to a bounds object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TourUtils

      public TourUtils()
  • Method Details

    • computeScreenBounds

      public static javafx.geometry.Bounds computeScreenBounds(List<? extends javafx.scene.Node> nodes)
      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 snapshot
      scale - 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 snapshot
      bounds - the bounds to snapshot; use null for the entire node
      scale - 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 snapshot
      screenBounds - the screen coordinates to snapshot; if null, the entire content of the window will be used
      scale - 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: