https://kotlinlang.org logo
#compose
Title
# compose
k

kclerc

09/22/2020, 3:10 PM
👋 Both PaintStyle and DrawStyle expose
Fill
OR
Stroke
styles. In DrawScope’s
drawPath
method, documentation says :
Copy code
Whether this shape is
     * filled or stroked (or both) is controlled by [DrawStyle]
What is the appropriate way to do the “both” scenario ? We could draw the path twice with two different DrawStyles but is there a cleaner solution to do that ?
a

Andrey Kulikov

09/22/2020, 5:15 PM
cc @Nader Jawad
n

Nader Jawad

09/22/2020, 5:49 PM
Right now we do not expose an equivalent to
Paint.Style.FILL_AND_STROKE
as we thought it might cause some confusion. You could either draw twice as you mentioned or use
DrawScope.drawCanvas{ canvas -> /**/}
and get a handle to the android.graphics.Canvas via
canvas.nativeCanvas
and draw yourself within the DrawScope instance.
But consider this a feature request for it 🙂
3 Views