wood burning stoves 2.0*
The moose likes Java Micro Edition and the fly likes creating a single Image from two images. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "creating a single Image from two images." Watch "creating a single Image from two images." New topic
Author

creating a single Image from two images.

Paul Dudek
Greenhorn

Joined: Jul 21, 2006
Posts: 8
Hello there,
I have written a j2me camera application for a mobile phone. The snapshot is rendered on a Canvas. I then have a .png Image which I can navigate onto this snapshot. Could anyone tell me how to make these one Image?
I need to somehow change the pixels of the snapshot where I have positioned the .png
I would be most grateful if anyone can help.

Many Thanks,

Paul.
Rashid Mayes
Ranch Hand

Joined: Jan 11, 2006
Posts: 160
Paul, Although I am not certain of problem described, this article may help.

http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/java/p_video_overlay_draw_canvas.jsp

If you simply want to combine two images you can use something similar to the following



You can easily change the position of image2 to your (x,y). Perhaps I could offer better help if you could explain this sentence in more details

" I then have a .png Image which I can navigate onto this snapshot."

thanks
[ September 06, 2006: Message edited by: Rashid Mayes ]

Rashid Mayes
http://www.hostj2me.com/ - http://www.worlddeveloper.org/
Paul Dudek
Greenhorn

Joined: Jul 21, 2006
Posts: 8
Hi there,

Thanks for your time.

Step by step what I have no problem doing is :

1) take a snapshot and render it on the screen. (I can do this).
2) render a smaller image overlaid on top of the snapshot. (I can do this).

Clearly these are still two images just overlaid. I want them to become one merged Image in memory.

What I am trying to do is:

3) Modify the appropriate pixels of the snapshot, (so that if I chose to render to the screen later I would be painting one Image only).

Let me know if this is still unclear.
Thanks,

Paul.
Rashid Mayes
Ranch Hand

Joined: Jan 11, 2006
Posts: 160
if you are using videoControl.getSnapshot() and Image.createImage(bytes) the result will be an immutable image. In this case you must have to create a new image to store the merged images.

First, draw the snapshot image to the new image.
Second, draw the image you want to overlay the snapshot to the new image.

psuedocode:



Alternatively, if you have a canvas with the images arranged how you want them, you can simply paint the canvas to an image.


more psuedocode



remember paint is protected abstract.
Paul Dudek
Greenhorn

Joined: Jul 21, 2006
Posts: 8
Thankyou all very much. I think this will help.

Regards,

Paul.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating a single Image from two images.