CanvasAPI

//填充RGB
void drawRGB(int r, int g, int b);
void drawARGB(int a, int r, int g, int b);
//填充Color
void drawColor(int color);
void drawColor(int color, PorterDuff.Mode mode);
//指定画笔
void drawPaint(Paint paint);
//画点
void drawPoints(float[] pts, int offset, int count, Paint paint);
void drawPoints(float[] pts, Paint paint);
void drawPoint(float x, float y, Paint paint);
//画直线
void drawLine(float startX, float startY, float stopX, float stopY, Paint paint);
void drawLines(float[] pts, int offset, int count, Paint paint);  //pts数组里的每两个元素为一个点,每两个点画一条直线
void drawLines(float[] pts, Paint paint);
//画矩形
void drawRect(RectF rect, Paint paint);
void drawRect(Rect r, Paint paint);
void drawRect(float left, float top, float right, float bottom, Paint paint);
//画椭圆
void drawOval(RectF oval, Paint paint);
//画圆
void drawCircle(float cx, float cy, float radius, Paint paint);
//画弧,扇形
void drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint);
//画圆角矩形
void drawRoundRect(RectF rect, float rx, float ry, Paint paint);
//画路径
void drawPath(Path path, Paint paint);
//画位图
void drawBitmap(Bitmap bitmap, float left, float top, Paint paint);
void drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint);
void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint);
void drawBitmap(int[] colors, int offset, int stride, float x, float y, int width, int height, boolean hasAlpha,
void drawBitmap(int[] colors, int offset, int stride, int x, int y, int width, int height, boolean hasAlpha, Paint paint);
void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint);
void drawBitmapMesh(Bitmap bitmap, int meshWidth, int meshHeight, float[] verts, int vertOffset, int[] colors, int colorOffset, Paint paint);
//画顶点
void drawVertices(VertexMode mode, int vertexCount, float[] verts, int vertOffset, float[] texs, int texOffset, int[] colors, int colorOffset, short[] indices, int indexOffset,
//画字
void drawText(char[] text, int index, int count, float x, float y, Paint paint);
void drawText(String text, float x, float y, Paint paint);
void drawText(String text, int start, int end, float x, float y, Paint paint);
void drawText(CharSequence text, int start, int end, float x, float y, Paint paint);
//绝对值画字
void drawPosText(char[] text, int index, int count, float[] pos, Paint paint);
void drawPosText(String text, float[] pos, Paint paint);
//根据路径画字
void drawTextOnPath(char[] text, int index, int count, Path path, float hOffset, float vOffset, Paint paint);
void drawTextOnPath(String text, Path path, float hOffset, float vOffset, Paint paint);
//画图片
void drawPicture(Picture picture);
void drawPicture(Picture picture, RectF dst);
void drawPicture(Picture picture, Rect dst);
//裁剪
boolean clipRect(RectF rect, Region.Op op);
boolean clipRect(Rect rect, Region.Op op);
boolean clipRect(RectF rect);
boolean clipRect(Rect rect);
boolean clipRect(float left, float top, float right, float bottom, Region.Op op);
boolean clipRect(float left, float top, float right, float bottom);
boolean clipRect(int left, int top, int right, int bottom);
boolean clipPath(Path path, Region.Op op);
boolean clipPath(Path path);
boolean clipRegion(Region region, Region.Op op);
boolean clipRegion(Region region);
//图层保存与恢复操作
int save();   //保存当前图层
int save(int saveFlags);
//保存指定区域图层
//paint为要保存的画笔,restore()后可以用。一般为null
//saveFlags为要保存的内容
int saveLayer(RectF bounds, Paint paint, int saveFlags);  
int saveLayer(float left, float top, float right, float bottom, Paint paint, int saveFlags);
//保存指定区域图层,并修改其透明度
int saveLayerAlpha(RectF bounds, int alpha, int saveFlags);
int saveLayerAlpha(float left, float top, float right, float bottom, int alpha, int saveFlags);
void restore();         //恢复上一层图层
int getSaveCount();     //获得已只在的图层数量
void restoreToCount(int saveCount);  //恢复指定层的图层
//图层变换
void translate(float dx, float dy);
void scale(float sx, float sy);
void scale(float sx, float sy, float px, float py);
void rotate(float degrees);
void rotate(float degrees, float px, float py);
void skew(float sx, float sy);  //扭曲
void concat(Matrix matrix);  //Maxrix矩阵变换
    原文作者:饮水思源为名
    原文地址: https://www.jianshu.com/p/caf9242a077f
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞