|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object magoffin.matt.ma2.image.jmagick.BaseJMagickMediaEffect magoffin.matt.ma2.image.jmagick.ScaleEffect
public class ScaleEffect
Effect that scales an image to the size specified on the request.
Different scaling algorithms can be specified for thumbnail and non-thumbnail sized images, with the idea that thumbnails could use a faster (but uglier) algorithm while non-thumbnails could use a slower (but prettier) one. By default the thumbnail algorithm is set to triangle and the non-thumbnail algorithm is sinc.
Note this effect assumes a rotate effect has not been applied before this effect is applied.
The configurable properties of this class are:
FilterType
constant values.
This map is populated by default with each FilterType constant
name, minus the "Filter" ending. For example the
FilterType.BesselFilter
constant is named Bessel
.DEFAULT_THUMBNAIL_FILTER_NAME
DEFAULT_NORMAL_FILTER_NAME
.MediaSize
for which to treat as thumbnail sizes
and scale with the thumbnailFilterName
as opposed to
the normalFilterName
. Defaults to a set containing
MediaSize.THUMB_SMALL
, MediaSize.THUMB_NORMAL
,
and MediaSize.THUMB_BIG
. The MediaSize.THUMB_BIGGER
is intentionally left out so that the normalFilterName
will be used for this size to achieve higher quality.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_NORMAL_FILTER_NAME
The default value for the normalFilterName property. |
static java.lang.String |
DEFAULT_THUMBNAIL_FILTER_NAME
The default value for the thumbnailFilterName property. |
static java.lang.String |
SCALE_KEY
The key for this effect. |
Fields inherited from class magoffin.matt.ma2.image.jmagick.BaseJMagickMediaEffect |
---|
log |
Fields inherited from interface magoffin.matt.ma2.image.jmagick.JMagickMediaEffect |
---|
INPUT_IMAGE_INFO_KEY, INPUT_MAGICK_IMAGE_KEY, OUTPUT_MAGICK_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()
Constructor. |
Method Summary | |
---|---|
magick.MagickImage |
applyEffect(MediaItem item,
MediaRequest request,
magick.ImageInfo inInfo,
magick.MagickImage image)
Apply effect with ImageMagick. |
protected java.util.Map<java.lang.String,java.lang.Integer> |
getFilterNameMap()
|
java.lang.String |
getKey()
Get the key for this effect. |
protected java.lang.String |
getNormalFilterName()
|
protected java.lang.String |
getThumbnailFilterName()
|
protected java.util.Set<MediaSize> |
getThumbnailSizes()
|
protected void |
setFilterNameMap(java.util.Map<java.lang.String,java.lang.Integer> filterNameMap)
|
protected void |
setNormalFilterName(java.lang.String normalFilterName)
|
protected void |
setThumbnailFilterName(java.lang.String thumbnailFilterName)
|
protected void |
setThumbnailSizes(java.util.Set<MediaSize> thumbnailSizes)
|
Methods inherited from class magoffin.matt.ma2.image.jmagick.BaseJMagickMediaEffect |
---|
apply, getMediaBiz, setMediaBiz |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_THUMBNAIL_FILTER_NAME
thumbnailFilterName
property.
public static final java.lang.String DEFAULT_NORMAL_FILTER_NAME
normalFilterName
property.
public static final java.lang.String SCALE_KEY
Constructor Detail |
---|
public ScaleEffect()
Method Detail |
---|
public magick.MagickImage applyEffect(MediaItem item, MediaRequest request, magick.ImageInfo inInfo, magick.MagickImage image)
JMagickMediaEffect
item
- the MediaItem the effect is being applied torequest
- the requestinInfo
- the ImageInfo used to open the imageimage
- the current ImageMagick MagickImage
public java.lang.String getKey()
MediaEffect
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.
protected java.util.Map<java.lang.String,java.lang.Integer> getFilterNameMap()
protected void setFilterNameMap(java.util.Map<java.lang.String,java.lang.Integer> filterNameMap)
filterNameMap
- the filterNameMap to setprotected java.lang.String getThumbnailFilterName()
protected void setThumbnailFilterName(java.lang.String thumbnailFilterName)
thumbnailFilterName
- the thumbnailFilterName to setprotected java.lang.String getNormalFilterName()
protected void setNormalFilterName(java.lang.String normalFilterName)
normalFilterName
- the normalFilterName to setprotected java.util.Set<MediaSize> getThumbnailSizes()
protected void setThumbnailSizes(java.util.Set<MediaSize> thumbnailSizes)
thumbnailSizes
- the thumbnailSizes to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |