public static void RenderEllipseGlass(Graphics g, Rectangle ownerRect, GlassPosition position,
float positionFactor, Color glassColor, int alphaCenter, int alphaSurround)
{
if (!(positionFactor > 0 && positionFactor < 1))
throw new ArgumentException("positionFactor must be between 0 and 1, but not include 0 and 1. ",
"positionFactor");
ownerRect.Height--;
ownerRect.Width--;
if (ownerRect.Width < 1 || ownerRect.Height < 1)
return;
using (GraphicsPath gp = new GraphicsPath())
{
gp.AddEllipse(ownerRect);
using (PathGradientBrush pb = new PathGradientBrush(gp))
{
pb.CenterPoint = GetEllipseGlassCenterPoint(ownerRect, position, positionFactor);
pb.CenterColor = Color.FromArgb(alphaCenter, glassColor);
pb.SurroundColors = new Color[] { Color.FromArgb(alphaSurround, glassColor) };
using (NewSmoothModeGraphics ng = new NewSmoothModeGraphics(g, SmoothingMode.AntiAlias))
{
g.FillPath(pb, gp);
}
}
}
}