Android之Canvas
16lz
2021-01-25
一、概述
The Canvas class holds the "draw" calls. 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).
Canvas类支持“draw”的调用,可以去绘制别的事物。你需要四种基本的组成成分:
(1)Bitmap(图像)
(2)Canvas(画布,主办描绘调用等,即等待绘制到bitmap中)
(3)primitive(绘制的原始事物(例如矩形、路径、文本、图像))
(4)paint(颜料,描述描绘的颜色和风格)
二、嵌套类
Nested Classes
enum
Canvas.EdgeType
enum
Canvas.VertexMode
三、常量
Constans
int
ALL_SAVE_FLAG
当restore()方法被调用时,恢复全部东西
int
CLIP_SAVE_FLAG
当restore()方法被调用时,恢复当前剪辑
int
CLIP_TO_LAYER_SAVE_FLAG
clip against the layer's bounds
剪辑对立层的边界
int
FULL_COLOR_LAYER_SAVE_FLAG
the layer needs to 8-bits per color component
int
HAS_ALPHA_LAYER_SAVE_FLAG
the layer needs to per-pixel alpha
int
MATRIX_SAVE_FLAG
restore the current matrix when restore() is called
当调用restore()方法时,恢复现有矩阵
四、公共构造函数
Public Constructors
Canvas()
Construct an empty raster canvas
Canvas(Bitmap bitmap)
Construct a canvas with the specified bitmap to draw into
Canvas(GL gl)
Construct a canvas with the specified gl context
The Canvas class holds the "draw" calls. 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).
Canvas类支持“draw”的调用,可以去绘制别的事物。你需要四种基本的组成成分:
(1)Bitmap(图像)
(2)Canvas(画布,主办描绘调用等,即等待绘制到bitmap中)
(3)primitive(绘制的原始事物(例如矩形、路径、文本、图像))
(4)paint(颜料,描述描绘的颜色和风格)
二、嵌套类
Nested Classes
enum
Canvas.EdgeType
enum
Canvas.VertexMode
三、常量
Constans
int
ALL_SAVE_FLAG
当restore()方法被调用时,恢复全部东西
int
CLIP_SAVE_FLAG
当restore()方法被调用时,恢复当前剪辑
int
CLIP_TO_LAYER_SAVE_FLAG
clip against the layer's bounds
剪辑对立层的边界
int
FULL_COLOR_LAYER_SAVE_FLAG
the layer needs to 8-bits per color component
int
HAS_ALPHA_LAYER_SAVE_FLAG
the layer needs to per-pixel alpha
int
MATRIX_SAVE_FLAG
restore the current matrix when restore() is called
当调用restore()方法时,恢复现有矩阵
四、公共构造函数
Public Constructors
Canvas()
Construct an empty raster canvas
Canvas(Bitmap bitmap)
Construct a canvas with the specified bitmap to draw into
Canvas(GL gl)
Construct a canvas with the specified gl context
更多相关文章
- Android之关于onSaveInstanceState和onRestoreInstanceState触发
- 移动数据流程
- Android实现ListView数据动态加载的方法
- Android(安卓)X86 获取不到ip的解决方法
- Android(安卓)图片OutOfMemory异常bitmap size exceeds VM budge
- Android中简单的日期格式化
- AndroidStudio旧模板使用方法
- Android(安卓)onMeasure(widthSpec, heightSpec)
- android 获取webView高度,设置webView高度