Svg.SvgPathBuilder.ToAbsolute C# (CSharp) Method

ToAbsolute() private static method

Creates point with absolute coorindates.
private static ToAbsolute ( float x, float y, SvgPathSegmentList segments, bool isRelativeX, bool isRelativeY ) : PointF
x float Raw X-coordinate value.
y float Raw Y-coordinate value.
segments SvgPathSegmentList Current path segments.
isRelativeX bool true if contains relative coordinate value, otherwise false.
isRelativeY bool true if contains relative coordinate value, otherwise false.
return System.Drawing.PointF
        private static PointF ToAbsolute(float x, float y, SvgPathSegmentList segments, bool isRelativeX, bool isRelativeY)
        {
            var point = new PointF(x, y);

            if ((isRelativeX || isRelativeY) && segments.Count > 0)
            {
                var lastSegment = segments.Last;

                // if the last element is a SvgClosePathSegment the position of the previous element should be used because the position of SvgClosePathSegment is 0,0
                if (lastSegment is SvgClosePathSegment)
                    lastSegment = segments[segments.Count - 2];

                if (isRelativeX)
                {
                    point.X += lastSegment.End.X;
                }

                if (isRelativeY)
                {
                    point.Y += lastSegment.End.Y;
                }
            }

            return point;
        }

Same methods

SvgPathBuilder::ToAbsolute ( float x, float y, SvgPathSegmentList segments, bool isRelativeBoth ) : PointF