Esempio n. 1
0
        /// <summary>
        /// GetPathGeometryData - returns a struct which contains this Geometry represented
        /// as a path geometry's serialized format.
        /// </summary>
        internal override PathGeometryData GetPathGeometryData()
        {
            PathGeometryData data = new PathGeometryData();

            data.FillRule = FillRule;
            data.Matrix   = CompositionResourceManager.TransformToMilMatrix3x2D(Transform);

            if (IsObviouslyEmpty())
            {
                return(Geometry.GetEmptyPathGeometryData());
            }

            ByteStreamGeometryContext ctx = new ByteStreamGeometryContext();

            PathFigureCollection figures = Figures;

            int figureCount = figures == null ? 0 : figures.Count;

            for (int i = 0; i < figureCount; i++)
            {
                figures.Internal_GetItem(i).SerializeData(ctx);
            }

            ctx.Close();
            data.SerializedData = ctx.GetData();

            return(data);
        }
Esempio n. 2
0
        /// <summary>
        /// GetPathGeometryData - returns a byte[] which contains this Geometry represented
        /// as a path geometry's serialized format.
        /// </summary>
        internal override PathGeometryData GetPathGeometryData()
        {
            if (IsObviouslyEmpty())
            {
                return(Geometry.GetEmptyPathGeometryData());
            }

            PathGeometryData data = new PathGeometryData();

            data.FillRule = FillRule.EvenOdd;
            data.Matrix   = CompositionResourceManager.TransformToMilMatrix3x2D(Transform);

            Point[] points = GetPointList();

            ByteStreamGeometryContext ctx = new ByteStreamGeometryContext();

            ctx.BeginFigure(points[0], true /* is filled */, true /* is closed */);

            // i == 0, 3, 6, 9
            for (int i = 0; i < 12; i += 3)
            {
                ctx.BezierTo(points[i + 1], points[i + 2], points[i + 3], true /* is stroked */, true /* is smooth join */);
            }

            ctx.Close();
            data.SerializedData = ctx.GetData();

            return(data);
        }
Esempio n. 3
0
        /// <summary>
        /// GetPathGeometryData - returns a byte[] which contains this Geometry represented
        /// as a path geometry's serialized format.
        /// </summary>
        internal override PathGeometryData GetPathGeometryData()
        {
            if (IsObviouslyEmpty())
            {
                return(Geometry.GetEmptyPathGeometryData());
            }

            PathGeometryData data = new PathGeometryData();

            data.FillRule = FillRule.EvenOdd;
            data.Matrix   = CompositionResourceManager.TransformToMilMatrix3x2D(Transform);

            double radiusX = RadiusX;
            double radiusY = RadiusY;
            Rect   rect    = Rect;

            ByteStreamGeometryContext ctx = new ByteStreamGeometryContext();

            if (IsRounded(radiusX, radiusY))
            {
                Point[] points = GetPointList(rect, radiusX, radiusY);

                ctx.BeginFigure(points[0], true /* is filled */, true /* is closed */);
                ctx.BezierTo(points[1], points[2], points[3], true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(points[4], true /* is stroked */, false /* is smooth join */);
                ctx.BezierTo(points[5], points[6], points[7], true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(points[8], true /* is stroked */, false /* is smooth join */);
                ctx.BezierTo(points[9], points[10], points[11], true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(points[12], true /* is stroked */, false /* is smooth join */);
                ctx.BezierTo(points[13], points[14], points[15], true /* is stroked */, false /* is smooth join */);
            }
            else
            {
                ctx.BeginFigure(rect.TopLeft, true /* is filled */, true /* is closed */);
                ctx.LineTo(Rect.TopRight, true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(Rect.BottomRight, true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(Rect.BottomLeft, true /* is stroked */, false /* is smooth join */);
            }

            ctx.Close();
            data.SerializedData = ctx.GetData();

            return(data);
        }
Esempio n. 4
0
        /// <summary>
        /// GetPathGeometryData - returns a byte[] which contains this Geometry represented
        /// as a path geometry's serialized format.
        /// </summary>
        internal override PathGeometryData GetPathGeometryData()
        {
            if (IsObviouslyEmpty())
            {
                return(Geometry.GetEmptyPathGeometryData());
            }

            PathGeometryData data = new PathGeometryData();

            data.FillRule = FillRule.EvenOdd;
            data.Matrix   = CompositionResourceManager.TransformToMilMatrix3x2D(Transform);

            ByteStreamGeometryContext ctx = new ByteStreamGeometryContext();

            ctx.BeginFigure(StartPoint, true /* is filled */, false /* is closed */);
            ctx.LineTo(EndPoint, true /* is stroked */, false /* is smooth join */);

            ctx.Close();
            data.SerializedData = ctx.GetData();

            return(data);
        }
Esempio n. 5
0
        /// <summary>
        /// GetPathGeometryData - returns a byte[] which contains this Geometry represented
        /// as a path geometry's serialized format.
        /// </summary> 
        internal override PathGeometryData GetPathGeometryData()
        { 
            if (IsObviouslyEmpty()) 
            {
                return Geometry.GetEmptyPathGeometryData(); 
            }

            PathGeometryData data = new PathGeometryData();
            data.FillRule = FillRule.EvenOdd; 
            data.Matrix = CompositionResourceManager.TransformToMilMatrix3x2D(Transform);
 
            Point[] points = GetPointList(); 

            ByteStreamGeometryContext ctx = new ByteStreamGeometryContext(); 

            ctx.BeginFigure(points[0], true /* is filled */, true /* is closed */);

            // i == 0, 3, 6, 9 
            for (int i = 0; i < 12; i += 3)
            { 
                ctx.BezierTo(points[i + 1], points[i + 2], points[i + 3], true /* is stroked */, true /* is smooth join */); 
            }
 
            ctx.Close();
            data.SerializedData = ctx.GetData();

            return data; 
        }
        /// <summary>
        /// GetPathGeometryData - returns a byte[] which contains this Geometry represented
        /// as a path geometry's serialized format.
        /// </summary>
        internal override PathGeometryData GetPathGeometryData()
        {
            if (IsObviouslyEmpty())
            {
                return Geometry.GetEmptyPathGeometryData();
            }

            PathGeometryData data = new PathGeometryData();
            data.FillRule = FillRule.EvenOdd;
            data.Matrix = CompositionResourceManager.TransformToMilMatrix3x2D(Transform);

            ByteStreamGeometryContext ctx = new ByteStreamGeometryContext();

            ctx.BeginFigure(StartPoint, true /* is filled */, false /* is closed */);
            ctx.LineTo(EndPoint, true /* is stroked */, false /* is smooth join */);
            
            ctx.Close();
            data.SerializedData = ctx.GetData();

            return data;
        }
        /// <summary>
        /// GetPathGeometryData - returns a struct which contains this Geometry represented
        /// as a path geometry's serialized format.
        /// </summary>
        internal override PathGeometryData GetPathGeometryData()
        {
            PathGeometryData data = new PathGeometryData();
            data.FillRule = FillRule;
            data.Matrix = CompositionResourceManager.TransformToMilMatrix3x2D(Transform);
            
            if (IsObviouslyEmpty())
            {
                return Geometry.GetEmptyPathGeometryData();                
            }

            ByteStreamGeometryContext ctx = new ByteStreamGeometryContext();

            PathFigureCollection figures = Figures;

            int figureCount = figures == null ? 0 : figures.Count;

            for (int i = 0; i < figureCount; i++)
            {
                figures.Internal_GetItem(i).SerializeData(ctx);
            }

            ctx.Close();
            data.SerializedData = ctx.GetData();

            return data;
        }
Esempio n. 8
0
        /// <summary>
        /// GetPathGeometryData - returns a byte[] which contains this Geometry represented
        /// as a path geometry's serialized format.
        /// </summary>
        internal override PathGeometryData GetPathGeometryData()
        {
            if (IsObviouslyEmpty())
            {
                return Geometry.GetEmptyPathGeometryData();
            }

            PathGeometryData data = new PathGeometryData();
            data.FillRule = FillRule.EvenOdd;
            data.Matrix = CompositionResourceManager.TransformToMilMatrix3x2D(Transform);

            double radiusX = RadiusX;
            double radiusY = RadiusY;
            Rect rect = Rect;

            ByteStreamGeometryContext ctx = new ByteStreamGeometryContext();

            if (IsRounded(radiusX, radiusY))
            {
                Point[] points = GetPointList(rect, radiusX, radiusY);

                ctx.BeginFigure(points[0], true /* is filled */, true /* is closed */);
                ctx.BezierTo(points[1], points[2], points[3], true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(points[4], true /* is stroked */, false /* is smooth join */);
                ctx.BezierTo(points[5], points[6], points[7], true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(points[8], true /* is stroked */, false /* is smooth join */);
                ctx.BezierTo(points[9], points[10], points[11], true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(points[12], true /* is stroked */, false /* is smooth join */);
                ctx.BezierTo(points[13], points[14], points[15], true /* is stroked */, false /* is smooth join */);
            }
            else
            {   
                ctx.BeginFigure(rect.TopLeft, true /* is filled */, true /* is closed */);
                ctx.LineTo(Rect.TopRight, true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(Rect.BottomRight, true /* is stroked */, false /* is smooth join */);
                ctx.LineTo(Rect.BottomLeft, true /* is stroked */, false /* is smooth join */);
            }

            ctx.Close();
            data.SerializedData = ctx.GetData();

            return data;
        }