In Mathematica 12 BoundaryMeshRegion
objects can be used as a Graphics
primitive. So, another idea is to use a BoundaryMeshRegion
as your primitive. For example:
Typeset`MakeBoxes[
CutoutEllipse[center_, out_, in_],
form_,
Graphics
] := With[
{
new = Replace[
RegionDifference[Disk[center, out], Disk[center, in]],
b_BooleanRegion :> BoundaryDiscretizeRegion[b]
]
},
Typeset`MakeBoxes[new, form, Graphics]
]
Examples:
Graphics[{Pink, EdgeForm[Blue], CutoutEllipse[{0,0}, {4,2}, .9 {1,2}]}]
Graphics[{Pink, EdgeForm[Blue], CutoutEllipse[{0,0}, {4,2}, 1.1 {1,2}]}]
You can use this answer to get the above approach to work in earlier versions of Mathematica.