画图四元组:
To draw something, you need 4 basic components:
- A Bitmap to hold the pixels,
- a Canvas to host the draw calls (writing into the bitmap),
- a drawing primitive (e.g. Rect, Path, text, Bitmap), and
- a paint (to describe the colors and styles for the drawing).
1. Bitmap format in memory:
4444
565
8888
alpha
2. Bitmap function:
图像的存储
图像在Bytebuffer之间传输
创建图像(可从已有图像缩放而来),可从颜色数组来,不能从文件,使用factory
图像的点内容获取和修改
3. BitmapDrawable
指定一个Bitmap如何画在画布上
拉伸
反走样
过滤
定位
密度
边界
透明度和alpha
4. Bitmap factory
创建bitmap from 文件,数组(存储压缩文件的内容)
5. BitmapFactory.Options
可以只取bitmap大小
可以进行density匹配
可以subsample
1. Paint
画图使用的颜色和风格(主要是文本和笔划)
2. 画布
Canvas:
画图画字体画基本几何图形
坐标变换