|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MediaEffect
API for applying effects to media items.
The MediaEffect
is a way for Matte to apply effects to
media items during processing in a call to
MediaHandler.handleMediaRequest(magoffin.matt.ma2.domain.MediaItem, magoffin.matt.ma2.MediaRequest, magoffin.matt.ma2.MediaResponse)
. Standard
effects are resizing (scale) and rotating the media, and those effects
have constant keys defined in this API (KEY_SCALE
and
KEY_ROTATE
.
The getKey()
method should return a unique key for the
implementation and function of effect the code implements.
There might be several different implementations of a "scale" effect, but they
all should include the key KEY_SCALE
at the end of the value returned
by getKey()
.
Each effect implementation might require specific parameters to
function. Those parameters should be passed to the effect via the
MediaRequest.getParameters()
map. For example, a rotate effect
needs to know by how many degrees it should rotate an image. This
amount can be passed as a parameter (the MEDIA_REQUEST_PARAM_ROTATE_DEGREES
parameter is defined for this purpose).
Field Summary | |
---|---|
static java.lang.String |
KEY_ROTATE
The key for rotating the media item. |
static java.lang.String |
KEY_SCALE
The key for scaling the media item. |
static java.lang.String |
KEY_WATERMARK
The key for applying a watermark to a media item. |
static java.lang.String |
MEDIA_REQUEST_PARAM_ROTATE_DEGREES
A MediaRequest parameter key for a integer value representing a rotational degree to apply to the media item. |
static java.lang.String |
MEDIA_REQUEST_PARAM_WATERMARK_RESOURCE
A MediaRequest parameter key for a Spring Resource instance
that should be used as a watermark image. |
Method Summary | |
---|---|
void |
apply(MediaItem item,
MediaRequest request,
MediaResponse response)
Apply the effect. |
java.lang.String |
getKey()
Get the key for this effect. |
Field Detail |
---|
static final java.lang.String KEY_SCALE
static final java.lang.String KEY_ROTATE
static final java.lang.String KEY_WATERMARK
static final java.lang.String MEDIA_REQUEST_PARAM_ROTATE_DEGREES
static final java.lang.String MEDIA_REQUEST_PARAM_WATERMARK_RESOURCE
Resource
instance
that should be used as a watermark image.
Method Detail |
---|
java.lang.String getKey()
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: KEY_SCALE
for re-sizing and 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.
void apply(MediaItem item, MediaRequest request, MediaResponse response)
MediaHandler
and MediaEffect
implementations can utilize
the MediaRequest.getParameters()
map to keep track of request
processing state during processing. Different implementations of
MediaHandler
will support different implementations of
MediaEffects
.
item
- the item being processedrequest
- the current requestresponse
- the current response
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |