You mean programmatically?
Simplest might be to use the same radius on the red background as the circle’s.
Programmatically you could add a rectangle and set the corner radius to at least half the width of the rectangle on all of the corners except the top right corner. You set that at the same corner radius as the background rectangle.
There are examples of creating your first plugin at the link below.