I was trying to set the Clip
on a Visual
. The path is supposed to be a rounded rectangle with different corner radii. The current API for setting the CornerRadius
on a RoundedRectangleGeometry
allows setting a uniform radius on all the four corners
auto roundedRectangle = compositor.CreateRoundedRectangleGeometry();
roundedRectangle.CornerRadius(Float2(width, height));
clip.Geometry(roundedRectangle);
visual.Clip(clip);
But I'm trying to align with the CSS property of background-radius
which permits setting different corner-radius for all the 4 corners:
border-radius: 10px 100px 20px 30px/ 30px 20px 10px 40px;
leading to something with all four different elliptical corners as
So in essence, I'm seeking a way to emulate this for a Visual
's Clip
property, allowing me to achieve a similar effect as the CSS property.
P.S. This is a continuing effort from this question. This is something I've already tried but applying the same logic of offsetting the clipping RoundedRectangle
didn't work in this case.The answer to that question won't suffice for this requirement because the rounded corner radii were the same for 2 corners (in fact all 4 corners) in that case and the suggested solution would not be adequate for all different elliptical corners. Offsetting the clipping RoundedRectangle
won't work here because I'd need 4 different RoundedRectangle
s and then somehow position them over the Visual
but the Clip
property allows only one CompositionGeometricClip
with one Geometry
.
I'm using the C++/WinRT
language projection.