info.magnolia.imaging.operations.cropresize
Class BoundedResize

java.lang.Object
  extended by info.magnolia.imaging.operations.cropresize.AbstractCropAndResize
      extended by info.magnolia.imaging.operations.cropresize.BoundedResize
All Implemented Interfaces:
ImageOperation

public class BoundedResize
extends AbstractCropAndResize

A CropAndResize implementation which will never crop, and resize to either maxHeight or maxWidth while keeping the original image's ratio.

Version:
$Id$

Constructor Summary
BoundedResize()
           
 
Method Summary
protected  Coords getCroopCoords(BufferedImage source, ParameterProvider params)
          Determines the coordinates of the cropping to apply on the source image.
protected  Size getEffectiveTargetSize(BufferedImage source, Coords cropCoords, ParameterProvider params)
          Determines the actual size for the resized image based on the source image, the crop coordinates calculated by AbstractCropAndResize.getCroopCoords(java.awt.image.BufferedImage, P) and the given ParameterProvider.
 int getMaxHeight()
           
 int getMaxWidth()
           
 void setMaxHeight(int maxHeight)
           
 void setMaxWidth(int maxWidth)
           
 
Methods inherited from class info.magnolia.imaging.operations.cropresize.AbstractCropAndResize
apply, getResizer, resize, setResizer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundedResize

public BoundedResize()
Method Detail

getCroopCoords

protected Coords getCroopCoords(BufferedImage source,
                                ParameterProvider params)
                         throws ImagingException
Description copied from class: AbstractCropAndResize
Determines the coordinates of the cropping to apply on the source image. If no cropping needs to happen, return new Coords(0, 0, source.getWidth(), source.getHeight()).

Specified by:
getCroopCoords in class AbstractCropAndResize
Throws:
ImagingException

getEffectiveTargetSize

protected Size getEffectiveTargetSize(BufferedImage source,
                                      Coords cropCoords,
                                      ParameterProvider params)
Description copied from class: AbstractCropAndResize
Determines the actual size for the resized image based on the source image, the crop coordinates calculated by AbstractCropAndResize.getCroopCoords(java.awt.image.BufferedImage, P) and the given ParameterProvider.

Specified by:
getEffectiveTargetSize in class AbstractCropAndResize

getMaxWidth

public int getMaxWidth()

setMaxWidth

public void setMaxWidth(int maxWidth)

getMaxHeight

public int getMaxHeight()

setMaxHeight

public void setMaxHeight(int maxHeight)


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