Search code examples
javaandroidkotlinandroid-viewandroid-graphics

Draw androidx AndroidPath on Canvas


i want to draw androidx androidPath on canvas by using AndroidPath class which is extending Path Class.It is defined in androidx.compose.ui.graphics.Path

reference : https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/AndroidPath#quadraticBezierTo(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)

but canvas.drawPath take only path not androidPath

public void drawPath(@NonNull Path path, @NonNull Paint paint) {
    super.drawPath(path, paint);
}

can anyone suggest me any way to draw androidx AndroidPath on canvas ??


Solution

  • If AndroidPath extends Path, then it can be used wherever a Path object is expected. Because it is a Path object. It's just also an AndroidPath object. That's how inheritance works.