Hi folks!
After some struggle loading semi-transparent png files, I have come to
realize there (probably) is something wrong with the
android.graphics.Bitmap get and setPixel functions. When I run the
following code:
Bitmap b = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888);
b.setPixel(0, 0, 0xFF00FF00);
Log.v("pixel", "1. " + Integer.toHexString(b.getPixel(0, 0)));
b.setPixel(0, 1, 0x8000FF00);
Log.v("pixel", "2. " + Integer.toHexString(b.getPixel(0, 1)));
b.setPixel(1, 0, 0x0000FF00);
Log.v("pixel", "3. " + Integer.toHexString(b.getPixel(1, 0)));
I get
10-17 10:24:30.028: VERBOSE/pixel(926): 1. ff00ff00
10-17 10:24:30.058: VERBOSE/pixel(926): 2. 80000100
10-17 10:24:30.068: VERBOSE/pixel(926): 3. 0
*note: ints are ARGB where the first byte specifies the alpha, second
the red component etc.
Why does my green component dissappear? I should have 8 bits for both
green and alpha, and
I see no reason why it should be cleared, and even less understandable
why it is set to when
there is 50% transparency (2nd output).
So, is this a bug or have I missed out on the fundamentals?
Kris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---