Hi again. I'm trying to build a Canvas, but I don'...
# compose
l
Hi again. I'm trying to build a Canvas, but I don't know how. I've been looking at https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Canvas, but Canvas is an interface, and I don't know if there is a class implementing it.
j
What are you exactly trying to do?
l
I'm trying to draw a yellow circle inside a red rectangle. (I'm going to play with animations)
j
I am using a DrawModifier
to draw stuff
l
Thank you. I'm gonna look at its definition 😃
j
Copy code
override fun ContentDrawScope.draw() {
 // Call drawing functions
I am unsure if this fits your exact needs, but might be a good starting point 🙂
l
Thank you. I'm going to look at the ContentDrawScope documentation also, and then try to implement it 🙂
j
Im adding a DrawModifier
Copy code
Box(modifier = Modifier.myDrawModifier) {.. }
👍 1
Copy code
fun myDrawModifier(): Modifier = composed {
    return SomeDrawModifier()
}

private class SomeDrawModifier() {
}: DrawModifier {
    override fun ContentDrawScope.draw() {
    }

}
👍 1
l
Thank you very much 🙂 Also, I think I had the wrong import : I should use
import androidx.compose.foundation.Canvas
Finally this worked :)