• Bitmap.Config 详解


    前言

      Android是一个内存相当吃紧的系统,那么在做程序的过程中使用内存就需要相当谨慎,而我们接触最大的大对象估计就是Bitmap了,那么下面就根据Bitmap.Config值的介绍来看下Bitmap在内存中存储的形式,那么在根据实际场景选择合适的配置进行Bitmap存储

    原文地址:http://www.cnblogs.com/luoaz/p/4374886.html

    Bitmap.Config

      Possible bitmap configurations. A bitmap configuration describes how pixels are stored. This affects the quality (color depth) as well as the ability to display transparent/translucent colors.

      首先这是一个枚举型,它代表了Bitmap可以的配置情况。一个配置描述的是这些像素信息是如何存储的。这个影响到了图片质量和透明度。

    ALPHA_8:Each pixel is stored as a single translucency (alpha) channel.

          每个像素信息只存储了alpha这一项信息。

    ARGB_4444:This field was deprecated in API level 13. Because of the poor quality of this configuration, it is advised to use ARGB_8888 instead. 

         这个值在level 13的时候就已经不被建议使用了,因为他是一个低质量的配置,它被建议使用ARGB_8888

    ARGB_8888:Each pixel is stored on 4 bytes. This configuration is very flexible and offers the best quality. It should be used whenever possible.

         每个像素信息占用4个字节(即32个二进制位)的存储空间,alpha、red、green、blue各占8个二进制位。这个配置项是非常灵活,并提供了最好的质量。他应该在可能的情况下尽量被使用。

    RGB_565:Each pixel is stored on 2 bytes and only the RGB channels are encoded: red is stored with 5 bits of precision (32 possible values), green is stored with 6 bits of precision (64 possible values) and blue is stored with 5 bits of precision.This configuration may be useful when using opaque bitmaps that do not require high color fidelity

         每个像素信息占用2个字节(即16位二进制位)并且至存储了RGB的信息没有alpha信息,其中Red5位,Green6位,Blue5位。这个配置项在不需要提供透明度的情况下更有用。

    后记

      以上就是配置项的详细介绍,有了这些知识那么我们在接下来出来图片的时候就会更加得心应手了

  • 相关阅读:
    as2 loadvars
    Playing with Content-Type – XXE on JSON Endpoints
    Hostile Subdomain Takeover using HerokuGithubDesk + more
    XSS for domain takeover
    XSS via XML POST
    dns 查询中的ANY类型
    crossDomain、allowDomain()、allowScriptAccess三者的关系
    ReadingWriting files with MSSQL's OPENROWSET
    Github html文件在线预览方法
    boostrap莫泰对话框宽度调整
  • 原文地址:https://www.cnblogs.com/luoaz/p/4374886.html
Copyright © 2020-2023  润新知