暑期散热解疑 机箱风扇选购安装指南
2008-09-08 13:00
218 查看
使用drawPoints方法来绘制多个像素点 drawLines方法绘制多条直线,具体说明如下:
public void drawPoints(float[] pts, int offset, int count, Paint paint)
Since: API Level 1
Draw a series of points. Each point is centered at the coordinate specified by pts[], and its diameter is specified by the paint's stroke width (as transformed by the canvas' CTM), with special treatment for a stroke width of 0, which always draws exactly 1 pixel (or at most 4 if antialiasing is enabled). The shape of the point is controlled by the paint's Cap type. The shape is a square, unless the cap type is Round, in which case the shape is a circle.
Parameters
public void drawLines(float[] pts, int offset, int count, Paint paint)
Since: API Level 1
Draw a series of lines. Each line is taken from 4 consecutive values in the pts array. Thus to draw 1 line, the array must contain at least 4 values. This is logically the same as drawing the array as follows: drawLine(pts[0], pts[1], pts[2], pts[3]) followed by drawLine(pts[4], pts[5], pts[6], pts[7]) and so on.
Parameters
代码:
效果图:
本文出自 “学习中的注意事项” 博客,请务必保留此出处http://3599672.blog.51cto.com/3589672/942500
public void drawPoints(float[] pts, int offset, int count, Paint paint)
Since: API Level 1
Draw a series of points. Each point is centered at the coordinate specified by pts[], and its diameter is specified by the paint's stroke width (as transformed by the canvas' CTM), with special treatment for a stroke width of 0, which always draws exactly 1 pixel (or at most 4 if antialiasing is enabled). The shape of the point is controlled by the paint's Cap type. The shape is a square, unless the cap type is Round, in which case the shape is a circle.
Parameters
pts | Array of points to draw [x0 y0 x1 y1 x2 y2 ...] |
---|---|
offset | Number of values to skip before starting to draw. |
count | The number of values to process, after skipping offset of them. Since one point uses two values, the number of "points" that are drawn is really (count >> 1). |
paint | The paint used to draw the points |
Since: API Level 1
Draw a series of lines. Each line is taken from 4 consecutive values in the pts array. Thus to draw 1 line, the array must contain at least 4 values. This is logically the same as drawing the array as follows: drawLine(pts[0], pts[1], pts[2], pts[3]) followed by drawLine(pts[4], pts[5], pts[6], pts[7]) and so on.
Parameters
pts | Array of points to draw [x0 y0 x1 y1 x2 y2 ...] |
---|---|
offset | Number of values in the array to skip before drawing. |
count | The number of values in the array to process, after skipping "offset" of them. Since each line uses 4 values, the number of "lines" that are drawn is really (count >> 2). |
paint | The paint used to draw the points |
package com.app; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.view.View; public class DrawPointsView extends View{ public DrawPointsView(Context context) { super(context); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); paint.setColor(Color.RED); canvas.drawPoints(new float[]{10,10,30,30,50,50}, 0, 6, paint); canvas.drawPoints(new float[]{10,100,30,150,50,200}, 2, 4, paint); canvas.drawLines(new float[]{10,230,50,260,80,300,130,350}, 0, 8, paint); } }
效果图:
本文出自 “学习中的注意事项” 博客,请务必保留此出处http://3599672.blog.51cto.com/3589672/942500
相关文章推荐
- SCSI卡的安装与选购指南
- SCSI卡的安装与选购指南
- 机箱散热+悍甲蜥 5750 风扇改造
- Gentoo Linux x86快速安装指南
- Sitecore7.5 安装指南 -- 通过ZIP文件安装
- Linux下便捷安装 Pytorch命令指南
- 【PyTorch】PyTorch安装指南
- Microsoft Windows Server 2008 R2 IIS7.5安装指南
- hadoop 自学指南一之安装hadoop
- ntop网络监控-安装配置指南
- ControlTier_CentOS安装指南
- 一篇完整的关于rails 3 memcached capistrano nginx passenger的指南安装步骤
- Redhat9.0下mpich2的安装指南
- java即时通信解决方案openfire+spark完整安装指南
- Hadoop 安装指南: Ubuntu12.04 系统
- ZooKeeper-3.4.6分布式安装指南
- MySQL安装指南
- 办公电脑选购方案指南
- Redhat下Oracle9i安装全攻略-安装指南
- Cisco Nexus 1000V安装指南