public static Color GetRelativeColor(this GradientStopCollection gsc, double offset, float alpha)
        {
            var point = gsc.SingleOrDefault(x => x.Offset == offset);

            if (point != null)
            {
                return(point.Color);
            }

            GradientStop before = gsc.Where(x => x.Offset == gsc.Min(m => m.Offset)).First();
            GradientStop after  = gsc.Where(x => x.Offset == gsc.Max(m => m.Offset)).First();

            foreach (var gs in gsc)
            {
                if (gs.Offset < offset && gs.Offset > before.Offset)
                {
                    before = gs;
                }
                if (gs.Offset > offset && gs.Offset < after.Offset)
                {
                    after = gs;
                }
            }

            var color = new Color();

            color.ScR = (float)((offset - before.Offset) * (after.Color.ScR - before.Color.ScR) / (after.Offset - before.Offset) + before.Color.ScR);
            color.ScG = (float)((offset - before.Offset) * (after.Color.ScG - before.Color.ScG) / (after.Offset - before.Offset) + before.Color.ScG);
            color.ScB = (float)((offset - before.Offset) * (after.Color.ScB - before.Color.ScB) / (after.Offset - before.Offset) + before.Color.ScB);

            if (alpha >= 0 && alpha <= 1)
            {
                color.ScA = alpha;
            }
            else
            {
                color.ScA = (float)((offset - before.Offset) * (after.Color.ScA - before.Color.ScA) / (after.Offset - before.Offset) + before.Color.ScA);
            }

            return(color);
        }