Skip to main content
2 of 2
Address version dependency
Carl Woll
  • 131.7k
  • 6
  • 246
  • 359

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}]}]

enter image description here

Graphics[{Pink, EdgeForm[Blue], CutoutEllipse[{0,0}, {4,2}, 1.1 {1,2}]}]

enter image description here

You can use this answer to get the above approach to work in earlier versions of Mathematica.

Carl Woll
  • 131.7k
  • 6
  • 246
  • 359