1、有关画笔(Paint)的方法
Paint mPaint= new Paint()
mPaint.setAntiAlias(true)
mPaint.setStrokeWidth(mCircleWidth)
mPaint.setStrokeCap(Paint.Cap.ROUND)
mPaint.setAntiAlias(true)
mPaint.setStyle(Paint.Style.STROKE)
mPaint.descent()
mPaint.ascent()
2、有关画布(Canvas)的方法
新建画布的方法
Canvas canvas = new Canvas();
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher);
Canvas canvas2 = new Canvas(bitmap);
画布一些常用方法总结
canvas.save();
canvas.restore();
ccanvas.translate(x,y);
常用绘图方法总结
/**绘制弧线、扇形*/
canvas.drawArc(oval,
startAngle,
sweepAngle,
useCenter,
paint);
/**绘制文字*/
canvas.drawText(text,
x, y,
paint);
/**绘制线条*/
canvas.drawLine(startX, startY,
stopX, stopY,
paint);
canvas.drawLines(pts,
paint);
canvas.drawLines(pts,
offset,
count,
paint);
/**绘制矩形*/
canvas.drawRect(float x1,float y1,
float x2,float y2,
Paint paint) ;