Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Path createCornersPath(int left, int top, int right, int bottom, int cornerWidth){
- Path path = new Path();
- int cornerRadius = 40;
- //path.moveTo(left, top + cornerWidth);
- //path.lineTo(left, top);
- //path.lineTo(left + cornerWidth, top);
- //Top-Left
- path.moveTo(left, (top + cornerRadius));
- path.arcTo(
- new RectF(left, top, left + cornerRadius, top + cornerRadius),
- 180f,
- 90f,
- true
- );
- path.moveTo(left + (cornerRadius / 2f), top);
- path.lineTo(left + (cornerRadius / 2f) + cornerWidth, top);
- path.moveTo(left, top + (cornerRadius / 2f));
- path.lineTo(left, top + (cornerRadius / 2f) + cornerWidth);
- //path.moveTo(right - cornerWidth, top);
- //path.lineTo(right, top);
- //path.lineTo(right , top + cornerWidth);
- //Top-Right
- path.moveTo(right - cornerRadius, top);
- path.arcTo(
- new RectF(right - cornerRadius, top, right, top + cornerRadius),
- 270f,
- 90f,
- true
- );
- path.moveTo(right - (cornerRadius / 2f), top);
- path.lineTo(right - (cornerRadius / 2f) - cornerWidth, top);
- path.moveTo(right, top + (cornerRadius / 2f));
- path.lineTo(right, top + (cornerRadius / 2f) + cornerWidth);
- //path.moveTo(left, bottom - cornerWidth);
- //path.lineTo(left, bottom);
- //path.lineTo(left + cornerWidth, bottom);
- //Bottom-Left
- path.moveTo(left, bottom - cornerRadius);
- path.arcTo(
- new RectF(left, bottom - cornerRadius, left + cornerRadius, bottom),
- 90f,
- 90f,
- true
- );
- path.moveTo(left + (cornerRadius / 2f), bottom);
- path.lineTo(left + (cornerRadius / 2f) + cornerWidth, bottom);
- path.moveTo(left, bottom - (cornerRadius / 2f));
- path.lineTo(left, bottom - (cornerRadius / 2f) - cornerWidth);
- //path.moveTo(right - cornerWidth, bottom);
- //path.lineTo(right, bottom);
- //path.lineTo(right, bottom - cornerWidth);
- //Bottom Right
- path.moveTo(left, bottom - cornerRadius);
- path.arcTo(
- new RectF(right - cornerRadius, bottom - cornerRadius, right, bottom),
- 0f,
- 90f,
- true
- );
- path.moveTo(right - (cornerRadius / 2f), bottom);
- path.lineTo(right - (cornerRadius / 2f) - cornerWidth, bottom);
- path.moveTo(right, bottom - (cornerRadius / 2f));
- path.lineTo(right, bottom - (cornerRadius / 2f) - cornerWidth);
- return path;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement