Пример #1
0
        public static void Render(Bitmap bmp, Mystify.Field field, bool antiAlias)
        {
            using (Graphics gfx = Graphics.FromImage(bmp))
            {
                if (antiAlias)
                {
                    gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                }

                gfx.Clear(Color.Black);
                foreach (Mystify.MovingPolygon movingPolygon in field.polygons)
                {
                    foreach (Mystify.Polygon polygon in movingPolygon.polygonHistory)
                    {
                        List <Point> points = new List <Point>();
                        for (int i = 0; i < polygon.corners.Count(); i++)
                        {
                            points.Add(new Point((int)polygon.corners[i].X, (int)polygon.corners[i].Y));
                        }
                        points.Add(points[0]);
                        Pen pen = new Pen(Color.FromArgb(polygon.color.ARGB), (float)polygon.lineWidth);
                        gfx.DrawLines(pen, points.ToArray());
                    }
                }
            }
        }
Пример #2
0
 private void ResetField()
 {
     bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
     //field = new Field(bmp.Width, bmp.Height, (int)ShapeCountNUD.Value, ComplexityTrackbar.Value, LineWidthTrackbar.Value);
     field = new Mystify.Field(bmp.Width, bmp.Height, polygonCount: (int)ShapeCountNUD.Value, cornerCount: ComplexityTrackbar.Value);
     stopwatch.Restart();
     renderCount = 0;
 }