//写了一个基本可以实现drawregion的,你可以参考一下,就是用Path实现的 protected void onDraw(Canvas canvas) { Paint mTextPaint=new Paint(); Path path = new Path(); //left,right,top, bottom RectF rect = new RectF(10 ,10, 40, 40); path.addRect(rect, Direction.CW); canvas.drawPath(path, mTextPaint); }
这个方法确实不好写,不过要注意一下,实现翻转的时候一定要翻转canvas,而不是翻转图片, createBitmap(Bitmap source, int x, int y, int width, int height, Matrix m, boolean filter) 因为这个翻转图片的方法效率太低了,特别卡
protected void onDraw(Canvas canvas)
{
Paint mTextPaint=new Paint();
Path path = new Path();
//left,right,top, bottom
RectF rect = new RectF(10 ,10, 40, 40);
path.addRect(rect, Direction.CW);
canvas.drawPath(path, mTextPaint);
}
createBitmap(Bitmap source, int x, int y, int width, int height, Matrix m, boolean filter) 因为这个翻转图片的方法效率太低了,特别卡