Kevin
08/29/2020, 12:04 PMKevin
08/29/2020, 12:08 PMKevin
08/29/2020, 12:09 PMJavier
08/29/2020, 12:21 PMKevin
08/29/2020, 12:37 PMJavier
08/29/2020, 1:00 PMefemoney
08/29/2020, 3:12 PMefemoney
08/29/2020, 3:21 PMefemoney
08/29/2020, 3:27 PMclass CutoutEdgeTreatment(
private val edge: Edge,
private val cutoutStart: Float,
private val cutoutRadius: Float
) : EdgeTreatment() {
private val temp = RectF()
override fun getEdgePath(length: Float, center: Float, interpolation: Float, shapePath: ShapePath) {
// Todo: support interpolation
if (cutoutRadius == 0f) {
super.getEdgePath(length, center, interpolation, shapePath)
return
}
val isMainEdge = edge == Top || edge == Left
val cutoutDiameter = cutoutRadius * 2
when {
isMainEdge -> temp.set(cutoutStart, -cutoutRadius, cutoutStart + cutoutDiameter, cutoutRadius)
else -> temp.set(length - cutoutStart - cutoutDiameter, -cutoutRadius, length - cutoutStart, cutoutRadius)
}
shapePath.lineTo(temp.left, 0f)
shapePath.addArc(temp.left, <http://temp.top|temp.top>, temp.right, temp.bottom, 180f, -180f)
shapePath.lineTo(length, 0f)
}
}
• edge
as you can guess is one of Top, Left, Right or Bottom
• cutoutStart
is the distance from the start (when considering Top or Left edges). In your case you dont need to supply this because your cutout is right in the middle and you can get that from the length parameter passed in
• cutoutRadius
you can guess