|
1.0: Final Release | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
OverlayControl
controls the setting of
overlay images on top of video or still image. This is useful,
for instance, when adding frames to a photograph.
Images are referenced as Object
s in order to support multiple UI technologies.
For example, in MIDP lcdui the Object
is javax.microedition.lcdui.Image
and in AWT it is java.awt.Image
.
Overlayed images can be placed partially or totally outside the video or image which the overlay is done for in which case the overlayed images will be cropped and the parts left outside will be ignored.
OverlayControl
of a video Player
only affects the viewfinder. Overlayed images
for recorded video and captured images can be added by using MediaProcessor
to post-process
the media.
Image
s in OverlayControl
have an order. When Image
s are rendered
on top of the content,
the drawing is started from the Image
which has the lowest order
and the Image
drawn last has
the highest order.
An Image
inserted with an order
that already contains an Imag
e,
causes the new Image
to be
inserted in that place and the order of the previous Image
is increased by one.
For example, two images are added to OverlayControl
so that the inner frame will be
drawn on top of the outer frame.
Image outerFrame = Image.createImage("/outerFrame.png"); Image innerFrame = Image.createImage("/innerFrame.png"); OverlayControl overlay = myMediaProcessor.getControl ("javax.microedition.media.control.imageeffect.OverlayControl"); overlay.insertImage(innerFrame, 0,0,1); // order = 1 overlay.insertImage(outerFrame, 0,0,0); // order = 0
The alpha channel and transparency of the overlayed images will remain when they are rendered
on top of the content. It is also possible to define one color for each overlayed image
to be fully transparent by setting the transparentColor
to the RGB value that
represents transparency in the image.
Mutable Image
s can be used for overlays but the modifications to the Image
are not effective to the overlay. The contents of the Image
are copied when the Image
is added and it has to be removed and added again to make later changes effective.
Image
,
EffectControl
,
MediaProcessor
Field Summary |
Fields inherited from interface javax.microedition.amms.control.EffectControl |
SCOPE_LIVE_AND_RECORD, SCOPE_LIVE_ONLY, SCOPE_RECORD_ONLY |
Method Summary | |
void |
clear()
Remove all Image s from the Control . |
java.lang.Object |
getImage(int order)
Gets the overlay Imag e. |
int |
insertImage(java.lang.Object image,
int x,
int y,
int order)
Adds an overlay Image to the Control . |
int |
insertImage(java.lang.Object image,
int x,
int y,
int order,
int transparentColor)
Adds an overlay Image to the specified position in the drawing list
and to the specified position on the picture. |
int |
numberOfImages()
Return the number of Image s in the Control . |
void |
removeImage(java.lang.Object image)
Removes the overlay Imag e. |
Methods inherited from interface javax.microedition.amms.control.EffectControl |
getPreset, getPresetNames, getScope, isEnabled, isEnforced, setEnabled, setEnforced, setPreset, setScope |
Method Detail |
public int insertImage(java.lang.Object image, int x, int y, int order) throws java.lang.IllegalArgumentException
Image
to the Control
. The coordinates of the Image
refer to the top left corner of
the video or image which the overlay is done for.
image
- Image
object containing the overlay imagex
- the x-coordinate of the processed image where the top left corner of the overlayed image will be renderedy
- the y-coordinate of the processed image where the top left corner of the overlayed image will be renderedorder
- the place where the image will be added in the drawing list
Image
after the insertion
java.lang.IllegalArgumentException
- when overlayImage
is not an Image
object or is null
java.lang.IllegalArgumentException
- if order
< 0public int insertImage(java.lang.Object image, int x, int y, int order, int transparentColor) throws java.lang.IllegalArgumentException
Image
to the specified position in the drawing list
and to the specified position on the picture. The coordinates of the image refer to the top left corner of
the video or image which the overlay is done for.
image
- Image
object containing the overlay imagex
- the x-coordinate of the processed image where the top left corner of the overlayed image will be renderedy
- the y-coordinate of the processed image where the top left corner of the overlayed image will be renderedorder
- the place where the image will be added in the drawing listtransparentColor
- RGB value of the color that is intended to be transparent. The format for storing the RGB
into int is 0xXXRRGGBB where the high order byte (XX) is ignored and the remaining bytes contain red,
green and blue, respectively.
Image
after the insertion
java.lang.IllegalArgumentException
- when overlayImage
is not an Image
object
or is null
java.lang.IllegalArgumentException
- if order
< 0public void removeImage(java.lang.Object image)
Imag
e.
image
- Image
object to be removed
java.lang.IllegalArgumentException
- if the image
is not in this OverlayControl
or is null
public java.lang.Object getImage(int order)
Imag
e.
order
- number of the requested Image
Image
or null
if the requested Image
does not exist
java.lang.IllegalArgumentException
- if order
< 0public int numberOfImages()
Image
s in the Control
.
Image
s in the Control
public void clear()
Image
s from the Control
.
|
1.0: Final Release | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |