Draw a graphic on a video canvas

Source: Internet
Author: User

We often use the features provided by MMAPI to play video or take pictures, and you may want to draw some menus or graphics on the canvas. This article describes how to complete the above features on a SonyEricsson model.
On the SonyEricsson JP7 model, it is easy to implement the above features. You only need to specify some specific parameters when initializing the Videocontrol. For example
Videocontrol.initdisplaymode (Videocontrol.use_direct_video | (Overlay << 8) | (Sprite.trans_rot90 << 4), canvas);
When the overlay=1 represents the drawing of the graphic overlay on the video, overlay=0 when the representative does not cover.
For JP6 or previous versions, there are a few tips to use if you want to achieve this effect. First of all, we're initializing Videocontrol,
Videocontrol.initdisplaymode (Videocontrol.use_direct_video, canvas);

The key to the problem is the processing of the paint method of canvas, in order to avoid the rendering of the content is covered we have to wait for the player to start and then draw our content, to achieve this can be done with Playerlistener, as follows:

public void Playerupdate (Player p, String event, Object obj) {
Switch (p.getstate ()) {
Case player.started:
initialized = true;
Break
}
}

You also need to call the Graphics.setclip (0,0,0,0) method after the drawing is complete.
public void Paint (Graphics g) {
if (camera!=null) {
if (camera.isinitialized () &&!update) {
Menu.draw (g);
G.setclip (0, 0, 0, 0);
}else if (update) {
Update = FALSE;
}
}
}

Run the results as shown above. This feature is more useful, when you read the SE developer community today, you can look at the original
http://developer.sonyericsson.com/site/global/techsupport/
tipstrickscode/java/p_video_overlay_draw_canvas.jsp

Uploadfiles/2007-1/18575526.zip this is code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.