[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-02 Thread Koush
And as I said, decodeByteArray is for compressed images, such as PNG and JPG. It does not work with uncompressed byte buffers that are in R8G8B8A8 or R5G6B5 formats. What is needed are the lockPixels and unlockPixels methods on a mutable Bitmap. On Dec 2, 1:15 am, Christine [EMAIL PROTECTED]

[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-02 Thread Koush
Also, the Bitmap class internally (in the C++ JNI atleast) supports the all familiar lockPixels and unlockPixels methods, which allows direct access to the byte buffer. I would suggest extending the Java API to include those methods. On Dec 2, 1:00 am, Koush [EMAIL PROTECTED] wrote: Dianne

[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-02 Thread Koush
{ SkImageDecoder_GIF_Factory, SkImageDecoder::kGIF_Format }, { SkImageDecoder_PNG_Factory, SkImageDecoder::kPNG_Format }, { SkImageDecoder_ICO_Factory, SkImageDecoder::kICO_Format }, { SkImageDecoder_WBMP_Factory, SkImageDecoder::kWBMP_Format }, {

[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-02 Thread Christine
As John says, why don't you use BitmapFactory.decodeByteArray? On Dec 2, 10:03 am, Koush [EMAIL PROTECTED] wrote: Also, the Bitmap class internally (in the C++ JNI atleast) supports the all familiar lockPixels and unlockPixels methods, which allows direct access to the byte buffer. I would

[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-02 Thread Koush
Dianne Hackborn: I am asking this in the context of how to create a screenshot application. Taking screenshots is not possible on the G1 anyways, because reading from /dev/graphics/fb0 is only available to root and shell and not available to actual applications. Thus is only works on hacked

[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-02 Thread Mike Reed
The only ways to specify the pixels directly are via: - consing up a BMP in memory - using setPixels(...) api (which takes 32bit ARGB ints) I apologize there there is no direct API that takes 565 values as input. On Dec 2, 2008, at 4:41 AM, Koush wrote: { SkImageDecoder_GIF_Factory,

[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-02 Thread Dianne Hackborn
If that's the case, then this discussion shouldn't be on android-developers, which is for developing with the SDK. Let's move it to one of the open source platform groups. On Tue, Dec 2, 2008 at 1:00 AM, Koush [EMAIL PROTECTED] wrote: Dianne Hackborn: I am asking this in the context of how to

[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-01 Thread Koush
I inspected Bitmap.cpp and found this function: static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject, const SkBitmap* bitmap, jboolean isMutable, jobject parcel) { if (parcel == NULL) { SkDebugf(---

[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-01 Thread Dianne Hackborn
DO NOT DO THIS. This marshalling format is private to the system and class, and can change arbitrarily across releases. On Mon, Dec 1, 2008 at 2:58 PM, Koush [EMAIL PROTECTED] wrote: I inspected Bitmap.cpp and found this function: static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,

[android-developers] Re: Loading a bitmap from a byte buffer

2008-12-01 Thread John Spurlock
BitmapFactory.decodeByteArray ? http://code.google.com/android/reference/android/graphics/BitmapFactory.html On Dec 1, 5:58 pm, Koush [EMAIL PROTECTED] wrote: I inspected Bitmap.cpp and found this function: static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,