private static IDisposable DrawBackGlassTrackingPercent(RenderContext context,
Rectangle rect,
Color backColor1,
Color backColor2,
VisualOrientation orientation,
GraphicsPath path,
float glassPercent,
IDisposable memento)
{
using (Clipping clip = new Clipping(context.Graphics, path))
{
MementoDouble cache;
if ((memento == null) || !(memento is MementoDouble))
{
if (memento != null)
memento.Dispose();
cache = new MementoDouble();
memento = cache;
}
else
cache = (MementoDouble)memento;
// Draw the one pixel border around the area
cache.first = DrawBackLinearRadial(rect, false,
ControlPaint.LightLight(backColor2),
ControlPaint.Light(backColor2),
ControlPaint.LightLight(backColor2),
orientation, context.Graphics,
cache.first);
// Reduce size of the inside area
rect.Inflate(-1, -1);
// Draw the inside area as a glass effect
cache.second = DrawBackGlassRadial(rect, backColor1, backColor2,
_glassColorTopL, _glassColorBottomL,
2f, 1f, orientation, context.Graphics,
glassPercent, cache.second);
}
return memento;
}