canvas.drawPoint(x,y,paint);//绘制点
canvas.drawLine(startX,startY,endX,endY);//绘制直线
float[] pts={
startX1,startY1,endX1,endY1
.......
startXn.startYn.endXn.endYn
}
canvas,drawLines(pts,paint);//绘制多条直线
canvas.drawRect(left,top,right,botttom.paint);//绘制矩形
canvas,drawCircle(circleX,circleY,radius,paint);//绘制圆
//绘制弧形和扇形 包括实心和空心
paint.setStyle(Paint.Style.STROKE);
paint.drawArc(left,top,right,bottom,startAngle,sweepAngle,userCenter,paint);
//如下参数组合
Paint.Style.STROKE+useCenter(true) //扇形
Paint.Style.STTOKE+userCenter(false);//弧形
Paint.Style.FILL+userCenter(true);//实心扇形
Paint.Style.FILL+userCenter(false)//实心弧形
canvas.drawOval(left,top,right,bottom,paint);//椭圆
canvas.drawText(text,startX,startY,paint);//绘制文本
canvas.drawPosTexr(text,new float[]{x1,y1,...,Xn,Yn},paint);//在指定位置绘制文本
//绘制路径
Path path=new Path();
path.moveTo(50,50);
path.lineTo(100,100);
path.lineTo(100,300);
path.lineTo(100,50);
canvas.drawPath(path,paint);
android 绘图基础 内含各种基本api
最新推荐文章于 2022-07-19 10:05:39 发布