Monday, December 10, 2012

Re: [android-developers] Re: [ICS] Did Canvas / drawBitmap change in ICS ?

The Bitmap was created in the Java layer: https://github.com/gjtorikian/Earthbound-Battle-Backgrounds/blob/1684ac485c934813f97653d798f16f4c967f4247/src/com/miadzin/livewallpaper/earthbound/EarthboundLiveWallpaper.java#L258

Then, I pass it over to JNI to do some math and pixels manipulation: https://github.com/gjtorikian/Earthbound-Battle-Backgrounds/blob/master/jni/distort_bmp.c#L245

On Sunday, December 9, 2012 11:28:46 PM UTC-8, Romain Guy (Google) wrote:

How do you allocate the bitmap exactly?

On Dec 9, 2012 7:38 PM, "GJTorikian" <gjtor...@gmail.com> wrote:
Sure, but why do I need to do this in the first place? In native JNI code I am modifying each pixel directly. Pre-ICS I did not need to "blank out" the bitmap.

On Sunday, December 9, 2012 3:15:05 PM UTC-8, Romain Guy (Google) wrote:
Instead of writing a loop like this you can just call Bitmap.eraseColor(). It's much more efficient.


On Sun, Dec 9, 2012 at 11:55 AM, GJTorikian <gjtor...@gmail.com> wrote:
All right, so after days I finally figured it out.

After creating my bitmap, I need to set every pixel in Java:

            for (int x = 0; x < 254; x++) {
                for (int y =0; y < 254; y++) {
                    bmp.setPixel(x, y, Color.argb(255, 0, 0, 0));
                }
            }


The question is: WHY only for ICS?

On Wednesday, December 5, 2012 4:07:38 PM UTC-8, GJTorikian wrote:
Hi there—

I'm making updates to a live wallpaper I've developed. The wallpaper is currently running correctly on a 2.2 device, but NOT on my 4.2 device.

On the ICS device, it seems that only the last column is being correctly drawn. For example, in a coordinate system, if my phone is 420 x 720 (not sure of the exact dimensions), then only pixels (420, 0) through (420, 720) are being drawn. The rest is black / transparent.


First, I draw a 256 x 256 bitmap. Then, I use a matrix to scale it.

Again, this works fine on a non-ICS device. Another tricky aspect is that I'm using the JNI to do some of the bitmap math, but I still think the problem is in this canvas code somewhere.

Thanks for any help!

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



--
Romain Guy
Android framework engineer
roma...@android.com

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

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate