ComponentFactory.Krypton.Toolkit.RenderGlassHelpers.DrawBackGlassTrackingPercent C# (CSharp) Method

DrawBackGlassTrackingPercent() private static method

private static DrawBackGlassTrackingPercent ( RenderContext context, Rectangle rect, Color backColor1, Color backColor2, VisualOrientation orientation, GraphicsPath path, float glassPercent, IDisposable memento ) : IDisposable
context RenderContext
rect System.Drawing.Rectangle
backColor1 Color
backColor2 Color
orientation VisualOrientation
path System.Drawing.Drawing2D.GraphicsPath
glassPercent float
memento IDisposable
return IDisposable
        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;
        }