Drawable和Bitmap的区别
Bitmap - 称作位图,一般位图的文件格式后缀为bmp,当然编码器也有很多如RGB565、RGB888。作为一种逐像素的显示对象执行效率高,但是缺点也很明显存储效率低。我们理解为一种存储对象比较好。
Drawable - 作为Android平下通用的图形对象,它可以装载常用格式的图像,比如GIF、PNG、JPG,当然也支持BMP,当然还提供一些高级的可视化对象,比如渐变、图形等。
A bitmap is a Drawable. A Drawable is not necessarily a bitmap. Like all thumbs are fingers but not all fingers are thumbs.
Bitmap是Drawable . Drawable不一定是Bitmap .就像拇指是指头,但不是所有的指头都是拇指一样.
The API dictates: API规定:
Though usually not visible to the application, Drawables may take a variety of forms: 尽管通常情况下对于应用是不可见的,Drawables 可以采取很多形式:
Bitmap: the simplest Drawable, a PNG or JPEG image. Bitmap: 简单化的Drawable, PNG 或JPEG图像.
Nine Patch: an extension to the PNG format allows it to specify information about how to stretch it and place things inside of it.
Shape: contains simple drawing commands instead of a raw bitmap, allowing it to resize better in some cases.
Layers: a compound drawable, which draws multiple underlying drawables on top of each other.
States: a compound drawable that selects one of a set of drawables based on its state.
Levels: a compound drawable that selects one of a set of drawables based on its level.
Scale: a compound drawable with a single child drawable, whose overall size is modified based on the current level.
小结:
对比项 显示清晰度 占用内存 支持缩放 支持色相色差调整 支持旋转 支持透明色 绘制速度 支持像素操作
Bitmap 相同 大 是 是 是 是 慢 是
Drawable 相同 小 是 否 是 是 快 否
Drawable在内存占用和绘制速度这两个非常关键的点上胜过Bitmap
转自:http://iaiai.iteye.com/blog/1991225
Drawable和Bitmap的区别相关推荐
- drawable 和 mipmap的区别
drawable和mipmap的区别: 应用图标的图片资源存放在mipmap系列文件夹中,而其余图片存放在drawable系列文件夹中. drawable文件夹存储bitmap文件(png, jpeg ...
- R.drawable 转 bitmap
引用:http://zhidao.baidu.com/question/291703800.html Bitmap bmp=BitmapFactory.decodeResource(r, R.draw ...
- 【Android】图像中Drawable向Bitmap的两种转换方法
Drawable和Bitmap转换 方法一: private void drawableToBitamp(Drawable drawable){int w = drawable.getIntrinsi ...
- android 获取资源文件 r.drawable中的图片转换为drawable、bitmap
1.R-Drawable 1 Resources resources = mContext.getResources(); 2 Drawable drawable = resources.getDra ...
- android bitmap 占用内存大小,drawable与bitmap内存占用大小
1, 比较Drawable与Bitmap占用内存大小 2, 比较BitmapFactory类的decodeResource方法与decodeStream方法的效率 好吧,先来看第1个测试! 以下这个是 ...
- Android 将图片网址url转化为bitmap,drawable转bitmap,file转bitmap,bitmap转file
file转bitmap File param = new File(); Bitmap bitmap= BitmapFactory.decodeFile(param.getPath()); drawa ...
- Drawable转换为Bitmap两种方法
如果通过网络加载了一张位图,想拿到这张位图的Bitmap,有两种办法,至于那种好,可能要看是在什么情况下了 1,根据已有的Drawable创建一个新的Bitmap: private Bitmap bi ...
- Drawable转Bitmap,Bitmap#getPixel像素为0的解决办法
/*** Drawable转Bitmap** @param d Drawable* @return Bitmap*/public static Bitmap drawable2Bitmap(Drawa ...
- Android(四十二):Drawable 转 Bitmap
源码 /// <summary> /// Drawable 转 Bitmap /// </summary> /// <param name="drawable& ...
最新文章
- php编译7教程,PHP7 快速编译安装
- 数据仓库专题18-数据建模语言IDEF(转载)
- [BZOJ1079][SCOI2008]着色方案 dp
- LeetCode week252
- ios开发ocr识别_车牌识别技术
- “90后”变“韭零后”,大数据告诉你谁是基民主力军?
- python期末设计作品_期末作品检查
- HTML+CSS+JS实现 ❤️仿切水果小游戏❤️
- Oracle Webcenter Portal Framework应用程序功能–页面和页面层次结构
- [PCB设计] 1、硬件原理图设计规范(一)——基本原则
- 支持向量机(Support Vector Machine,SVM)
- MAC CPU温度监视及风扇速度控制软件
- 颈椎病的成因及治疗预防方法
- 删除计算机硬盘中的文件,硬盘上数据如何彻底删除 硬盘上数据彻底删除方法【详解】...
- 【目标】新学期计划与目标
- HTTP中Get、Post、Put与Delete的区别
- open_source_team
- 笔记本电脑属于个人计算机吗,黄真真:笔记本电脑属于个人计算机的一种形式莫?...
- ncut算法python实现
- 域名——host配置