Package digilib.util

Class ImageSize

java.lang.Object
digilib.util.ImageSize

public class ImageSize extends Object
Class for image size (width, height). A width or height of 0 is treated as a 'wildcard' that matches any size.
Author:
casties
  • Field Details

    • width

      public int width
    • height

      public int height
  • Constructor Details

    • ImageSize

      public ImageSize()
    • ImageSize

      public ImageSize(int width, int height)
    • ImageSize

      public ImageSize(ImageSize i)
  • Method Details

    • setSize

      public void setSize(int width, int height)
    • isTotallySmallerThan

      public boolean isTotallySmallerThan(ImageSize is)
      Returns if the size of this image is smaller in every dimension than the other image.
      Parameters:
      is - the ImageSize
      Returns:
      is totally smaller
    • isSmallerThan

      public boolean isSmallerThan(ImageSize is)
      Returns if the size of this image is smaller in at least one dimension than the other image.
      Parameters:
      is - the ImageSize
      Returns:
      is smaller than
    • isTotallyBiggerThan

      public boolean isTotallyBiggerThan(ImageSize is)
      Returns if the size of this image is bigger in every dimension than the other image.
      Parameters:
      is - the ImageSize
      Returns:
      is totally bigger than
    • isBiggerThan

      public boolean isBiggerThan(ImageSize is)
      Returns if the size of this image is bigger in at least one dimension than the other image.
      Parameters:
      is - the ImageSize
      Returns:
      is bigger than
    • fitsIn

      public boolean fitsIn(ImageSize is)
      Returns if this image has the same size or height as the other image.
      Parameters:
      is - the ImageSize
      Returns:
      fits in
    • equals

      public boolean equals(ImageSize is)
      Returns if the size of this image is the same as the other image.
      Parameters:
      is - the ImageSize
      Returns:
      equals
    • getHeight

      public int getHeight()
      Returns:
      the height
    • setHeight

      public void setHeight(int height)
      Parameters:
      height - the height
    • getWidth

      public int getWidth()
      Returns:
      the width
    • setWidth

      public void setWidth(int width)
      Parameters:
      width - the width
    • getAspect

      public float getAspect()
      Returns the aspect ratio. Aspect ratio is (width/height). So it's <1 for portrait and >1 for landscape.
      Returns:
      the aspect ratio
    • getScaled

      public ImageSize getScaled(float scale)
      Returns a scaled copy of this image size.
      Parameters:
      scale - the scale
      Returns:
      the ImageSize
    • toString

      public String toString()
      Overrides:
      toString in class Object