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

DrawBackGlassCheckedTrackingPercent() private static method

private static DrawBackGlassCheckedTrackingPercent ( 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 DrawBackGlassCheckedTrackingPercent(RenderContext context,
                                                                       Rectangle rect,
                                                                       Color backColor1,
                                                                       Color backColor2,
                                                                       VisualOrientation orientation,
                                                                       GraphicsPath path,
                                                                       float glassPercent,
                                                                       IDisposable memento)
        {
            using (Clipping clip = new Clipping(context.Graphics, path))
            {
                MementoTriple cache;

                if ((memento == null) || !(memento is MementoTriple))
                {
                    if (memento != null)
                        memento.Dispose();

                    cache = new MementoTriple();
                    memento = cache;
                }
                else
                {
                    cache = (MementoTriple)memento;
                }

                // Draw the one pixel border around the area
                cache.first = DrawBackLinear(rect, true,
                                             backColor2,
                                             ControlPaint.LightLight(backColor2),
                                             orientation,
                                             context.Graphics,
                                             cache.first);

                // Reduce size on all but the upper edge
                ModifyRectByEdges(ref rect, 1, 0, 1, 1, orientation);

                // Draw the inside areas as a glass effect
                cache.second = DrawBackGlassRadial(rect, backColor1, backColor2,
                                                   _glassColorTopD, _glassColorBottomD,
                                                   5f, 1.2f, orientation, context.Graphics,
                                                   glassPercent, cache.second);

                // Widen back to original
                ModifyRectByEdges(ref rect, -1, 0, -1, 0, orientation);

                cache.third = DrawBackDarkEdge(rect, ControlPaint.Dark(backColor1),
                                               3, orientation, context.Graphics,
                                               cache.third);
            }

            return memento;
        }