当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Differences between Bitmaps and BufferedImages

问题描述:

I am trying to port some code from a regular java program into the android platform. Unfortunately, a significant part of the program involves manipulating images, and java's awt was taken away from me. I am trying to replace awt.BufferedImage with a Bitmap, and was hoping that the only differences between the two classes would be their interfaces. I read some of the documentation, and it looked like that is true, but after wrapping all of the image stuff into a nice little class and testing almost-the-same code on both my development machine and an actual phone, one program works, and the other does not. So:

The encoding for color does not change- right? it is still 0xAARRGGBB- right?

The images themselves are not changed- right? When I put an image into res/drawable, it is exactly the same image. Most notably- they don't alter the resolution in any way-right?

Accessing the pixels is essentially the same-right? I essentially replaced all of my get/setRGB(x,y,RGB) with get/setPixel(x,y,color). There are no changes to the method of indexing into the grid- is there?

网友答案:

Solved: when opening the image, I failed to create a BitmapFactory.Options() with inDither set to false. The BitmapFactory then failed to produce an exact copy, putting some alterations in the resulting Bitmap in order to make it more pleasing for display.

分享给朋友:
您可能感兴趣的文章:
随机阅读: