tags:

views:

26

answers:

1

Hi all,

I am compressing a bitmap object to OutputStream using "Compress" function. Here is my code:

try {
                    if (bitmap != null) {
                        bitmap.compress(Bitmap.CompressFormat.JPEG, 100,
                                bytes);
                    } else {
                        Message message = handler.obtainMessage(1, "false");
                        handler.sendMessage(message);
                        return;
                    }
                } catch (OutOfMemoryError oom) {
                    System.gc();
                    Message message=handler.obtainMessage(1,"false");
                    handler.sendMessage(message);
                    return;
                } catch (NullPointerException npe) {
                    System.gc();
                    Message message = handler.obtainMessage(1, "false");
                    handler.sendMessage(message);
                    return;
                } catch (Exception e) {
                    System.gc();
                    Message message = handler.obtainMessage(1, "false");
                    handler.sendMessage(message);
                    return;
                }

when i am running this code on G1 and hero, i am getting a proper output stream( which i later save to a image file on sdcard). But when i test this code on Google nexus, i am getting a blurry image after converting the output stream in an image file.

FYI

OS: Android 1.5; G1 and Hero are on 1.5 OS and nexus is on 2.0

Please help.. is there a known issue in nexus?? or am i doing something wrong??

+1  A: 

Check Game Development for Android: A Quick Primer.

From Step Three: Carefully Design the Best Game Ever:

The problem with texture compression is that different graphics card vendors support different texture formats. The G1 and other MSM7k devices support ATI’s ATITC compression format. The Droid supports PowerVR’s PVRTC format. Nvidia’s Tegra2 platform supports the DXT format. The bad news is, these formats are not compatible. The good news is, all OpenGL ES 2.0 devices (including the Snapdragon-based Nexus One, the OMAP3-based Droid, and Tegra2 devices) support a common format called ETC1. ETC1 isn’t the best texture format (it lacks support for alpha channels), and it isn’t supported on the first generation devices, but it’s the most common format supported (the Android SDK provides a compressor utility (see sdk/tools/etc1tool) and runtime tools for this format).

Macarse