net.sourceforge.openutils.mgnlmedia.media.processors
Class BaseImageResolutionProcessor

java.lang.Object
  extended by net.sourceforge.openutils.mgnlmedia.media.processors.BaseImageResolutionProcessor
All Implemented Interfaces:
ImageResolutionProcessor
Direct Known Subclasses:
FitInAndFillWithBandsImageResolutionProcessor, FitInImageResolutionProcessor, ResizeCropCenteredImageResolutionProcessor, ResizeNoCropImageResolutionProcessor

public abstract class BaseImageResolutionProcessor
extends Object
implements ImageResolutionProcessor

Base implementation of ImageResolutionProcessor.

Version:
$Id: $
Author:
molaschi

Constructor Summary
BaseImageResolutionProcessor()
           
 
Method Summary
 BufferedImage fill(BufferedImage original, int x, int y, boolean cropCentered)
          Resize an image to fill x or y and (if set) center and if cropCentered is true crop what outfit
 BufferedImage fitIn(BufferedImage original, int x, int y)
          Resize an image to fit into x,y not changing image original side proportion
 BufferedImage fitIn(BufferedImage original, int x, int y, Color background)
          Resize an image to fit into the rect x, y and fill empty spaces with given background color
protected  BufferedImage resizeInOut(BufferedImage original, int x, int y, boolean fit, Color background)
          Resize image to fit in x,y.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.openutils.mgnlmedia.media.processors.ImageResolutionProcessor
getImageForResolution
 

Constructor Detail

BaseImageResolutionProcessor

public BaseImageResolutionProcessor()
Method Detail

fitIn

public BufferedImage fitIn(BufferedImage original,
                           int x,
                           int y)
Resize an image to fit into x,y not changing image original side proportion

Parameters:
original - original image
x - max width
y - max height
Returns:
resized image

fitIn

public BufferedImage fitIn(BufferedImage original,
                           int x,
                           int y,
                           Color background)
Resize an image to fit into the rect x, y and fill empty spaces with given background color

Parameters:
original - original image
x - max width
y - max height
background - background to color empty spaces
Returns:
resized image

resizeInOut

protected BufferedImage resizeInOut(BufferedImage original,
                                    int x,
                                    int y,
                                    boolean fit,
                                    Color background)
Resize image to fit in x,y. If fit is true the resulting image is x,y and if there are two empty bands they are filled with backgroung color.

Parameters:
original - original image
x - max width
y - max height
fit - fully fit x,y?
background - color to fill empty bands if fit is true
Returns:
image

fill

public BufferedImage fill(BufferedImage original,
                          int x,
                          int y,
                          boolean cropCentered)
Resize an image to fill x or y and (if set) center and if cropCentered is true crop what outfit

Parameters:
original - original image
x - min width
y - min height
cropCentered - crop image?
Returns:
resized image


Copyright © 2008-2010 Openmind. All Rights Reserved.