圆角图片切割

发现了一个挺好的方法,除了能切割四个圆角图片,也可以任意切割,
addRoundRect参数


 @Override
    protected void onDraw(Canvas canvas) {
        Path clipPath = new Path();
        int w = this.getWidth();
        int h = this.getHeight();
        float radii[] = {30,30,30,30,0,0,0,0};
        clipPath.addRoundRect(new RectF(0, 0, w, h), radii, Path.Direction.CW);
//        clipPath.addRoundRect(0,0,10.f,10.0f, 37.0f, 37.0f, Path.Direction.CW);
        canvas.clipPath(clipPath);
        super.onDraw(canvas);
    }
我这个是切割的图片顶部圆角,底部不切割,上篇文章写的是切割四个圆角,矩形的圆角图片

你可能感兴趣的:(圆角图片切割)