Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating a single Image from two images.

 
Paul Dudek
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Paul Dudek
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou all very much. I think this will help.

Regards,

Paul.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic