When an image is opaque, it is dithered at loading time. You can use
BitmapFactory.Options to disable dithering. You can also force
BitmapFactory to load the image in ARGB_8888 format to avoid
dithering.

On Sun, Jul 11, 2010 at 12:31 PM, HaMMeReD <[email protected]> wrote:
> I'm trying to load a image, for the purpose of debugging I've made the
> image a solid grey #494949.
>
> I load it with the following code
>
> inputstream =
> context.getResources().openRawResource(R.drawable.level1_heightmap);
> level1_heightmap = BitmapFactory.decodeStream(inputstream);
>
>
> Although when I run getpixel on the image it does not give a uniform
> value, I put this debugging code in to confirm
> for (int i=0;i<100;i++)
> {
>                        Log.d("Debug", "COLOR"+level1_heightmap.getPixel((int)
> (Math.random()*level1_heightmap.getWidth()),(int)
> (Math.random()*level1_heightmap.getWidth())));
> }
>
>
> Which outputs the following colors
> COLOR-11908790 and COLOR 11383470
>
> Considering the image is a solid grey, shouldn't it just be outputting
> one number? Is there 2 levels of loading for BitmapFactory and how do
> I ensure that the image is fully loaded before working with it?
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to