How to draw a line on the camera screen using j2me?
Unfortunately, this is not as easy as it sounds. If you have a preview from your phone camera, it is often shown as an overlay. This means that the camera preview image is not actually part of any part of your application canvas, and you cannot interact with the pixels directly. The phone just draws the preview on top of your app, completely out of your control.
If you draw a line on the screen, it will be drawn below the preview image.
The way around this is not very good. You must actually capture an image from the camera. Unfortunately this means capturing a JPEG or PNG file into a byte buffer. Then you load this image using Image.createImage and render it on the screen. Then you can paint safely on top of that.
It also has an unwanted drawback that gives you terrible frame rates. You might want to list all the possible file formats you can capture and try them all to see which is the fastest.
source to share
You can do this using OverlayControl , which will cause your target devices to support it. I think I remember a good example of the Sony Ericsson Developer Forum.
Edit: Found this (doesn't require using OverlayControl)
source to share