Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Blending images using arrays

 
John Jefferson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to blend images together and display them. Right now it is not displaying the images. I need help figuring out the blendImages method. Any help is appreciated.

 
Stephan van Hulst
Bartender
Pie
Posts: 5796
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're never actually blending pixels. You just create a new array, read all it's pixels to an int which you immediately discard, and then you return a new image of the new (black) array.

Maybe in your for loop, you should blend the pixels in the original two images, and then assign them to the corresponding cell in the new array, before you create an image out of it.

I would also suggest the new image's clip becomes the union of the original two images' clips. That means, make it's width the same as the widest of the two original images, and the same for the height.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic