This will make the new Image the combination of the 2 given images, one next to the other.
If you want to draw only a part of an image use the Graphics.clipRect(x,y,width,height) to set the clipping rectangle before you draw...

If you have any questions or wish to clarify what you want, please post a comment.

Hope this helps, Sasha.

0

setaglibbAuthor Commented: 2000-05-11

To clarify:

I have two bitmaps (of equal dimensions) stored on my hard drive that I want to access during runtime and combine parts of them to produce a single image.

I would also like to save the combined image in the bmp format (if possible) on the fly.

The area to be replaced will be bounded by a sin wave so I don't think cliprect will help.

I am new to this image processing stuff so I'm not even sure how to access/store them in my program.

By what you have told me so far I assume they are stored internally as image objects?

Or do I have to use more advanced stuff like bufferedimage, bitmapinfoheaders, and copyoffscreenregion?

Ok, since the file is in bmp format, the easiest thing to do will be to open the file as regular binary file, read the contents into a matrix that will represent the image and perform all operations on that matrix. It would be very easy to copy portions of the matirx into another matrix, even if it involves complex functions... you just copy parts of an array by some rule. After you are done, again, if this was another format, it would have been more difficult, but since it's bmp, you can just write the file as binary on the hard disk...

Can you do that yourself or do you need examples in file I/O and copying matrices?

0

setaglibbAuthor Commented: 2000-05-12

That's a big help but I would appreciate some file I/O and copying matrices examples if you don't mind.

I am not sure what exactly is the bmp format, but I suppose its 2 numbers specifying width and height of the image and then the all the pixel colors, row by row. You should find the exact specification somewhere on the web.

Well, copying matrices is pretty straightforward, this method will take 2 matrices of same dimensions and return a new one which will be the combination of the given ones in such a way that the upper left triangle half of the 1st matrix will be combined with the lower right triangle half of the 2nd matrix: