Android中的绘画

Canvas

drawColor(int color);

drawText(String text,float x,float y,Paint paint);

drawPoint(float x,float y,Paint paint);

drawPoints(float[] pts,Paint paint);

drawLine(float startX,float startY,float stopX,float stopY,Paint paint);

drawLines(float[] pts,Paint paint);

drawRect(float left,float top,float right,float bottom,Paint paint);

drawRect(Rect rect,Paint paint);

drawRoundRect(RectF rect,float rx,float ry,Paint paint);//圆角矩形

drawCircle(float cx,float cy,float radius,Paint paint);

drawArc(RectF oval,float startAngle,float sweepAngle,boolean useCenter,Paint paint);//绘制扇形(弧形)

drawOval(RectF oval, Paint paint);//绘制椭圆

drawPath(Path path,Paint paint);//绘制指定路径图形

drawTextOnPath(String text,Path path,float hOffset,float vOffset,Paint paint);//将文本沿指定路径绘制

Rect(float left,float top,float right,float bottom);矩形类,左上角和右下角坐标;

RectF同上;

#Path
moveTo(float x,float y);

lineTo(float x,float y);

close();//起点和中点只有一个,lineTo可以有好多个;

android.graphics.Path.quadTo(float x1,float y1,float x2,float y2);//绘制贝塞尔曲线

addArc(RectF oval,float startAngle,float sweepAngle);

addOval(RectF oval, Direction dir);

addCircle(float x,float y,float radius,Direction dir);

addRect(RectF rect,Direction dir);

addRoundRect(RectF rect,float[] radii,Direction dir);

Canvas.setDrawFilter(DrawFilter filter);//设置绘图抗锯齿

#Paint
setAntiAlias(boolean aa);//设置画笔是否有锯齿,默认为false;true(无)

setAlpha(int a);//设置画笔透明度

setTextAlign(Paint.Align align);//设置绘制文本的锚点

measureText(String text);//获取文本宽度

setStyle(Style style);//设置画笔样式

setColor(int Color);//设置画笔颜色

setStrokeWidth(float width);//设置画笔粗细程度

setTextSize(float textSize);//设置文本字体尺寸

setARGB(int a,int r,int g,int b);