android-Canvas


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类控制着绘图。为了绘图,你需要是个基本的组成部分。

1. 一个Bitmap来控制每个像素点

2. 一个Canvas来控制绘图(绘制到bitmap)

3. 一个绘制的图形(直角,线,文本,bitmap)

4. 一个画笔(描绘要画的颜色和风格)


个人理解如下。

Bitmap 实际对应着的是实际设备的界面,是实际的像素点。

Canvas 对应着的是一个虚拟设备界面。

有4中的这只笔在2中这个画布上绘制3这样的图形,最后显示到1这个屏幕上。


 public void drawColor(int color)

Fill the entire canvas' bitmap (restricted to the current clip) with the specified color, using srcover porterduff mode.

用指定的颜色填充整个canvas的bitmap。


 public void drawArc()

画弧线


public void drawARGB(int a, int r, int g, int b) 

用A透明度,RGB三原色填充canvas


public void drawBitmap()

画bitmap


public void drawCircle()

画圆


public void drawLine()

画线


 public void drawVertices()

Draw the array of vertices, interpreted as triangles (based on mode). 




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值