info.magnolia.dam.util
Class ImageSize

java.lang.Object
  extended by info.magnolia.dam.util.ImageSize

public final class ImageSize
extends Object

Represents the size of an image. This class is immutable.


Constructor Summary
ImageSize(long width, long height)
           
 
Method Summary
 boolean equals(Object o)
           
 long getHeight()
           
 long getWidth()
           
 int hashCode()
           
 ImageSize scaleToFitIfLarger(long boundingWidth, long boundingHeight)
          Scales the size to fit inside a bounding rectangle keeping the aspect ratio as is.
static ImageSize valueOf(File file)
           
static ImageSize valueOf(InputStream inputStream)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageSize

public ImageSize(long width,
                 long height)
Method Detail

getWidth

public long getWidth()

getHeight

public long getHeight()

scaleToFitIfLarger

public ImageSize scaleToFitIfLarger(long boundingWidth,
                                    long boundingHeight)
Scales the size to fit inside a bounding rectangle keeping the aspect ratio as is. If this image is smaller than the bounding rectangle no change occurs.


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

valueOf

public static ImageSize valueOf(File file)
                         throws FileNotFoundException
Throws:
FileNotFoundException

valueOf

public static ImageSize valueOf(InputStream inputStream)


Copyright © 2014 Magnolia International Ltd.. All Rights Reserved.