Class ToDimensions


public class ToDimensions extends ScaleCalculator
Calculates a scaling-factor to make the source image have identical dimensions as dimensionsTarget.

If preserveAspectRatio is true, then the aspect ratio is preserved, and both dimensions may not be identical to dimensionsTarget, but at least one will be, and the other will not be exceed that of dimensionsTarget.

Author:
Owen Feehan
  • Constructor Details

    • ToDimensions

      public ToDimensions(int sizeX, int sizeY)
      Create with specific lengths for X and Y dimensions.
      Parameters:
      sizeX - the size of the X-dimension.
      sizeY - the size of the X-dimension.
    • ToDimensions

      public ToDimensions(DimensionsProvider dimensions)
      Create with specific dimensions.
      Parameters:
      dimensions - the dimensions the source image/entity is desired to be scaled to.
    • ToDimensions

      public ToDimensions(int sizeX, int sizeY, boolean preserveAspectRatio)
      Create with specific lengths for X and Y dimensions and preserveAspectRatio.
      Parameters:
      sizeX - the size of the X-dimension.
      sizeY - the size of the X-dimension.
      preserveAspectRatio - if true, the ratio between x and y is kept constant when scaling.
    • ToDimensions

      public ToDimensions(DimensionsProvider dimensions, boolean preserveAspectRatio)
      Create with specific dimensions and preserveAspectRatio.
      Parameters:
      dimensions - the dimensions the source image/entity is desired to be scaled to.
      preserveAspectRatio - if true, the ratio between x and y is kept constant when scaling.
    • ToDimensions

      public ToDimensions()
  • Method Details