private static IDisposable DrawBackGlassSimplePercent(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;
// Get the drawing rectangle for the path
RectangleF drawRect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
// Draw the border as a lighter version of the inside
cache.first = DrawBackGlassLinear(drawRect, drawRect,
backColor2,
backColor2,
_glassColorBottomDD,
_glassColorBottomDD,
orientation,
context.Graphics,
0,
cache.first);
// Reduce by 1 pixel on all edges to get the inside
RectangleF insetRect = drawRect;
insetRect.Inflate(-1f, -1f);
// Draw the inside area
cache.second = DrawBackGlassLinear(insetRect, drawRect,
backColor1,
CommonHelper.MergeColors(backColor1, 0.5f, backColor2, 0.5f),
_glassColorTopDD,
_glassColorBottomDD,
orientation,
context.Graphics,
glassPercent,
cache.second);
}
return memento;
}