magoffin.matt.ma2.image.awt
Class ScaleEffect

java.lang.Object
  extended by magoffin.matt.ma2.image.awt.BaseAwtMediaEffect
      extended by magoffin.matt.ma2.image.awt.ScaleEffect
All Implemented Interfaces:
AwtMediaEffect, MediaEffect

public class ScaleEffect
extends BaseAwtMediaEffect

Effect that scales an image to the size specified on the request.

Note this effect assumes a rotate effect has not been applied before this effect is applied.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
Matt Magoffin (spamsqr@msqr.us)

Field Summary
static java.awt.RenderingHints DEFAULT_RENDERING_HINTS
          The default RenderingHints applied to the scale operation.
static java.lang.String SCALE_KEY
          The key for this effect.
 
Fields inherited from class magoffin.matt.ma2.image.awt.BaseAwtMediaEffect
log
 
Fields inherited from interface magoffin.matt.ma2.image.awt.AwtMediaEffect
INPUT_BUFFERED_IMAGE_KEY
 
Fields inherited from interface magoffin.matt.ma2.MediaEffect
KEY_ROTATE, KEY_SCALE, KEY_WATERMARK, MEDIA_REQUEST_PARAM_ROTATE_DEGREES, MEDIA_REQUEST_PARAM_WATERMARK_RESOURCE
 
Constructor Summary
ScaleEffect()
           
 
Method Summary
 java.awt.image.BufferedImage applyEffect(MediaItem item, MediaRequest request, java.awt.image.BufferedImage source)
          Apply an effect on a BufferedImage and return the result as a new BufferedImage.
 java.lang.String getKey()
          Get the key for this effect.
 java.awt.RenderingHints getRenderingHints()
           
 void setRenderingHints(java.awt.RenderingHints renderingHints)
           
 
Methods inherited from class magoffin.matt.ma2.image.awt.BaseAwtMediaEffect
apply, getMediaBiz, setMediaBiz
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RENDERING_HINTS

public static final java.awt.RenderingHints DEFAULT_RENDERING_HINTS
The default RenderingHints applied to the scale operation.

The default hins contain:

RenderingHints.KEY_INTERPOLATION
RenderingHints.VALUE_INTERPOLATION_BICUBIC


SCALE_KEY

public static final java.lang.String SCALE_KEY
The key for this effect.

See Also:
Constant Field Values
Constructor Detail

ScaleEffect

public ScaleEffect()
Method Detail

applyEffect

public java.awt.image.BufferedImage applyEffect(MediaItem item,
                                                MediaRequest request,
                                                java.awt.image.BufferedImage source)
Description copied from interface: AwtMediaEffect
Apply an effect on a BufferedImage and return the result as a new BufferedImage.

If no change is made to the source BufferedImage then source can be returned from this method.

Parameters:
item - the MediaItem the effect is being applied to
request - the request
source - the source BufferedImage
Returns:
the updated BufferedImage

getKey

public java.lang.String getKey()
Description copied from interface: MediaEffect
Get the key for this effect.

Keys uniquely describe the implementation and function of the effect. The implementation key should come first, and the function key at the end. Some standard function key values are defined in this API: MediaEffect.KEY_SCALE for re-sizing and MediaEffect.KEY_ROTATE for rotating.

For example, a key might look like image.awt.rotate for an image rotation effect based on a Java AWT implementation.

Returns:
the effect key

getRenderingHints

public java.awt.RenderingHints getRenderingHints()
Returns:
Returns the renderingHints.

setRenderingHints

public void setRenderingHints(java.awt.RenderingHints renderingHints)
Parameters:
renderingHints - The renderingHints to set.