Example #1
0
        internal void DrawPath(System.Drawing.Pen pen, XnaGraphicsPath path)
        {
            //Vector2[] vectors = new Vector2[path.PointCount];

            //for(int i = 0; i < path.PointCount; i++)
            //{
            //    vectors[i] = new Vector2(path.PathPoints[i].X, path.PathPoints[i].Y);
            //}

            Color c = Color.FromNonPremultiplied(pen.Color.R, pen.Color.G, pen.Color.B, pen.Color.A);

            //DrawingContext.Begin();
            //DrawingContext.DrawPolyline(vectors, c);
            //DrawingContext.End();

            //BasicPrimitiveRendering.PrimitiveRasterizer polyRasterizer = new BasicPrimitiveRendering.PrimitiveRasterizer(this.GraphicsDevice, this.SpriteBatch);
            //polyRasterizer.Colour = c;
            //polyRasterizer.Thickness = pen.Width;

            //for (int i = 0; i < path.PathPoints.Count() - 1; i++)
            //{
            //    Vector2 startPoint = new Vector2(path.PathPoints[i].X, path.PathPoints[i].Y);
            //    Vector2 endPoint = new Vector2(path.PathPoints[i + 1].X, path.PathPoints[i + 1].Y);

            //    polyRasterizer.CreateLine(startPoint, endPoint, BasicPrimitiveRendering.PrimitiveRasterizer.Antialiasing.Enabled, BasicPrimitiveRendering.PrimitiveRasterizer.FillMode.Outline);
            //}

            ////Connect the last lines to close figure?
            ////Vector2 sPoint = new Vector2(path.PathPoints[path.PathPoints.Count()].X, path.PathPoints[path.PathPoints.Count()].Y);
            ////Vector2 ePoint = new Vector2(path.PathPoints[0].X, path.PathPoints[0].Y);

            ////polyRasterizer.CreateLine(sPoint, ePoint, BasicPrimitiveRendering.PrimitiveRasterizer.Antialiasing.Enabled, BasicPrimitiveRendering.PrimitiveRasterizer.FillMode.Fill);

            //polyRasterizer.Render();
        }
 internal void AddPath(XnaGraphicsPath path, bool connect)
 {
     if (connect)
     {
         this.AddLine(pts[pts.Count].X, pts[pts.Count].Y, path.PathPoints[0].X, path.PathPoints[0].Y);
         this.pts.AddRange(path.PathPoints);
         this.types.AddRange(path.PathTypes);
     }
     else
     {
         this.pts.AddRange(path.PathPoints);
         this.types.AddRange(path.PathTypes);
     }
 }
Example #3
0
        internal void FillPath(Matrix transformM, Color b, XnaGraphicsPath path)
        {
            polyRasterizer.Clear();
            polyRasterizer.Colour   = b;
            polyRasterizer.Position = new Vector2(Transform.Translation.X, Transform.Translation.Y);
            //polyRasterizer.SetWorld(Transform);

            for (int i = 0; i < path.PathPoints.Count() - 1; i++)
            {
                Vector2 startPoint = new Vector2(path.PathPoints[i].X, path.PathPoints[i].Y);
                Vector2 endPoint   = new Vector2(path.PathPoints[i + 1].X, path.PathPoints[i + 1].Y);

                polyRasterizer.CreateLine(startPoint, endPoint, PrimitiveRasterizer.Antialiasing.Enabled, PrimitiveRasterizer.FillMode.Fill);
            }

            //Connect the last lines to close figure?
            //Vector2 sPoint = new Vector2(path.PathPoints[path.PathPoints.Count()].X, path.PathPoints[path.PathPoints.Count()].Y);
            //Vector2 ePoint = new Vector2(path.PathPoints[0].X, path.PathPoints[0].Y);

            //polyRasterizer.CreateLine(sPoint, ePoint, BasicPrimitiveRendering.PrimitiveRasterizer.Antialiasing.Enabled, BasicPrimitiveRendering.PrimitiveRasterizer.FillMode.Fill);

            polyRasterizer.Render();
        }
Example #4
0
 internal void Intersect(XnaGraphicsPath TEMP_PATH)
 {
     throw new NotImplementedException();
 }