Summary description for SvgRadialGradientElement.
Inheritance: SvgGradientElement, ISvgRadialGradientElement
        private RadialGradientBrush GetRadialGradientBrush(Rect elementBounds, 
            SvgRadialGradientElement res)
        {
            double centerX = res.Cx.AnimVal.Value;
            double centerY = res.Cy.AnimVal.Value;
            double focusX  = res.Fx.AnimVal.Value;
            double focusY  = res.Fy.AnimVal.Value;
            double radius  = res.R.AnimVal.Value;

            GradientStopCollection gradientStops = GetGradientStops(res.Stops);

            RadialGradientBrush brush = new RadialGradientBrush(gradientStops);

            brush.RadiusX = radius;
            brush.RadiusY = radius;
            brush.Center  = new Point(centerX, centerY);
            brush.GradientOrigin = new Point(focusX, focusY);

            if (res.SpreadMethod != null)
            {
                SvgSpreadMethod spreadMethod = (SvgSpreadMethod)res.SpreadMethod.AnimVal;

                if (spreadMethod != SvgSpreadMethod.None)
                {
                    brush.SpreadMethod = WpfConvert.ToSpreadMethod(spreadMethod);
                }
            }
            if (res.GradientUnits != null)
            {
                SvgUnitType mappingMode = (SvgUnitType)res.GradientUnits.AnimVal;
                if (mappingMode == SvgUnitType.ObjectBoundingBox)
                {
                    brush.MappingMode = BrushMappingMode.RelativeToBoundingBox;
                }
                else if (mappingMode == SvgUnitType.UserSpaceOnUse)
                {
                    brush.MappingMode = BrushMappingMode.Absolute;
                }
            }

            MatrixTransform transform = GetTransformMatrix(res);
            if (transform != null && !transform.Matrix.IsIdentity)
            {
                brush.Transform = transform;
            }
            else
            {
            }

            string colorInterpolation = res.GetPropertyValue("color-interpolation");
            if (!String.IsNullOrEmpty(colorInterpolation))
            {
                if (colorInterpolation == "linearRGB")
                {
                    brush.ColorInterpolationMode = ColorInterpolationMode.SRgbLinearInterpolation;
                }
                else
                {
                    brush.ColorInterpolationMode = ColorInterpolationMode.ScRgbLinearInterpolation;
                }
            }

            return brush;
        }
        private PathGradientBrush GetRadialGradientBrush(SvgRadialGradientElement res, RectangleF bounds)
        {
            float fCenterX = (float)res.Cx.AnimVal.Value;
            float fCenterY = (float)res.Cy.AnimVal.Value;
            float fFocusX  = (float)res.Fx.AnimVal.Value;
            float fFocusY  = (float)res.Fy.AnimVal.Value;
            float fRadius  = (float)res.R.AnimVal.Value;

            float fEffectiveCX = fCenterX;
            float fEffectiveCY = fCenterY;
            float fEffectiveFX = fFocusX;
            float fEffectiveFY = fFocusY;
            float fEffectiveRadiusX = fRadius;
            float fEffectiveRadiusY = fRadius;

            if (res.GradientUnits.AnimVal.Equals(SvgUnitType.ObjectBoundingBox))
            {
                fEffectiveCX = bounds.Left + fCenterX * (bounds.Width);
                fEffectiveCY = bounds.Top + fCenterY * (bounds.Height);
                fEffectiveFX = bounds.Left + fFocusX * (bounds.Width);
                fEffectiveFY = bounds.Top + fFocusY * (bounds.Height);
                fEffectiveRadiusX = fRadius * bounds.Width;
                fEffectiveRadiusY = fRadius * bounds.Height;
            }

            GraphicsPath gp = new GraphicsPath();
            gp.AddEllipse(fEffectiveCX - fEffectiveRadiusX,
                fEffectiveCY - fEffectiveRadiusY, 2 * fEffectiveRadiusX, 2 * fEffectiveRadiusY);

            PathGradientBrush brush = new PathGradientBrush(gp);

            brush.CenterPoint = new PointF(fEffectiveFX, fEffectiveFY);

            XmlNodeList stops = res.Stops;

            ColorBlend cb = new ColorBlend();

            List<Color> adjcolors    = new List<Color>();
            List<float> adjpositions = new List<float>();
            GetColorsAndPositions(stops, adjpositions, adjcolors);

            // Need to invert the colors for some bizarre reason
            adjcolors.Reverse();
            adjpositions.Reverse();
            for (int i = 0; i < adjpositions.Count; i++)
            {
                adjpositions[i] = 1 - adjpositions[i];

            }

            cb.Colors    = adjcolors.ToArray();
            cb.Positions = adjpositions.ToArray();

            brush.InterpolationColors = cb;

            //			ISvgTransformable transElm = (ISvgTransformable)res;
            //			SvgTransformList svgTList = (SvgTransformList)transElm.transform.AnimVal;
            //			brush.Transform = svgTList.matrix.matrix;

            if (res.GetPropertyValue("color-interpolation") == "linearRGB")
            {
                //GdipSetPathGradientGammaCorrection(brush, true);
            }
            else
            {
                //GdipSetPathGradientGammaCorrection(brush, false);
            }

            /*
                   * How to do brush.GammaCorrection = true on a PathGradientBrush? / nikgus
                   * */

            return brush;
        }