public class Grow extends BoxAligner
Grow the bounding-box to fill larger as much as possible.

Depending on preserveAspectRatio, the aspect-ratio of smaller is preserved or not.

When preserveAspectRatio==false, the smaller bounding-box is guaranteed to become identical to the larger.

Growth never occurs in the z-dimension, and the size in this dimension should be equal for both smaller and larger.

  • Constructor Details

    • Grow

      public Grow(boolean preserveAspectRatio)
      Create to preserve the aspect-ratio or not.
      Parameters:
      preserveAspectRatio - whether to preserve the aspect-ratio of the smaller image when growing.
    • Grow

      public Grow()
    • Grow

      public Grow(boolean preserveAspectRatio, Align align)
      Creates a new Grow instance.
      Parameters:
      preserveAspectRatio - Whether to preserve the aspect-ratio of the smaller image when growing.
      align - How to align the box after it is grown, as much as possible.
  • Method Details

    • alignAfterCheck

      protected BoundingBox alignAfterCheck(BoundingBox smaller, BoundingBox larger) throws OperationFailedException
      Description copied from class: BoxAligner
      Determines a BoundingBox to use for smaller BoundingBox so that it fits inside larger BoundingBox.
      Specified by:
      alignAfterCheck in class BoxAligner
      Parameters:
      smaller - the smaller bounding-box, relative to the minimum-corner of larger. Often this is (0, 0, 0) if it sits at the minimum corner of larger.
      larger - the larger bounding-box absolute coordinates.
      Returns:
      absolute coordinates for smaller, while remaining inside larger.
      Throws:
      OperationFailedException - if an unrecognized parameter or illegal state exists preventing successful alignment.
    • alignAfterCheck

      protected BoundingBox alignAfterCheck(Extent smaller, Extent larger) throws OperationFailedException
      Description copied from class: BoxAligner
      Determines a BoundingBox to use for smaller Extent so that it fits inside larger Extent.
      Specified by:
      alignAfterCheck in class BoxAligner
      Parameters:
      smaller - the smaller bounding-box, relative to the minimum-corner of larger. Often this is (0, 0, 0) if it sits at the minimum corner of larger.
      larger - the larger bounding-box absolute coordinates.
      Returns:
      absolute coordinates for smaller, while remaining inside larger.
      Throws:
      OperationFailedException - if an unrecognized parameter or illegal state exists preventing successful alignment.
    • alignAfterCheck

      protected BoundingBox alignAfterCheck(Extent smaller, BoundingBox larger) throws OperationFailedException
      Description copied from class: BoxAligner
      Determines a BoundingBox to use for smaller Extent so that it fits inside larger BoundingBox.
      Specified by:
      alignAfterCheck in class BoxAligner
      Parameters:
      smaller - the smaller bounding-box, relative to the minimum-corner of larger. Often this is (0, 0, 0) if it sits at the minimum corner of larger.
      larger - the larger bounding-box absolute coordinates.
      Returns:
      absolute coordinates for smaller, while remaining inside larger.
      Throws:
      OperationFailedException - if an unrecognized parameter or illegal state exists preventing successful alignment.
    • isPreserveAspectRatio

      public boolean isPreserveAspectRatio()
      Whether to preserve the aspect-ratio of the smaller image when growing.
    • setPreserveAspectRatio

      public void setPreserveAspectRatio(boolean preserveAspectRatio)
      Whether to preserve the aspect-ratio of the smaller image when growing.
    • getAlign

      public Align getAlign()
      How to align the box after it is grown, as much as possible.
    • setAlign

      public void setAlign(Align align)
      How to align the box after it is grown, as much as possible.