【问题标题】:discripencies while compressing a bitmap on Google nexus在 Google Nexus 上压缩位图时出现差异
【发布时间】:2010-06-19 14:19:17
【问题描述】:

我正在使用 "Compress" 函数将位图对象压缩到 OutputStream。这是我的代码:

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;
                }

当我在 G1 和 hero 上运行此代码时,我得到了正确的输出流(我稍后将其保存到 sdcard 上的图像文件中)。但是当我在 Google nexus 上测试这段代码时,在将输出流转换为图像文件后,我得到了一个模糊的图像。

仅供参考

操作系统:Android 1.5; G1 和 Hero 使用 1.5 操作系统,nexus 使用 2.0

请帮助.. nexus 中是否存在已知问题?还是我做错了什么??

【问题讨论】:

    标签: android nexus-one nexus-s


    【解决方案1】:

    检查Game Development for Android: A Quick Primer

    来自Step Three: Carefully Design the Best Game Ever

    纹理压缩的问题 是那个不同的显卡 供应商支持不同的纹理 格式。 G1 和其他 MSM7k 设备支持 ATI 的 ATITC 压缩格式。机器人支持 PowerVR 的 PVRTC 格式。英伟达的 Tegra2平台支持DXT 格式。坏消息是,这些格式 不兼容。好消息是, 所有 OpenGL ES 2.0 设备(包括 基于 Snapdragon 的 Nexus One, 基于 OMAP3 的 Droid 和 Tegra2 设备) 支持一种称为 ETC1 的通用格式。 ETC1 不是最好的纹理格式(它 缺乏对 Alpha 通道的支持),以及 第一个不支持 代设备,但它是最 支持的通用格式(Android SDK 提供了一个压缩器实用程序(请参阅 sdk/tools/etc1tool) 和运行时工具 对于这种格式)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-16
      • 2014-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多