//Render a polygon
 private static void Render(DnaPolygon polygon, Graphics g, int scale)
 {
     using (Brush brush = GetGdiBrush(polygon.Brush))
     {
         Point[] points = GetGdiPoints(polygon.Points, scale);
         g.FillPolygon(brush,points);
     }
 }
Beispiel #2
0
        public void AddPolygon()
        {
            if (Polygons.Count < Settings.ActivePolygonsMax)
            {
                var newPolygon = new DnaPolygon();
                newPolygon.Init();

                int index = Tools.GetRandomNumber(0, Polygons.Count);

                Polygons.Insert(index, newPolygon);
                SetDirty();
            }
        }
Beispiel #3
0
        public DnaPolygon Clone()
        {
            var newPolygon = new DnaPolygon();

            newPolygon.Points = new List <DnaPoint>();
            newPolygon.Brush  = Brush.Clone();
            foreach (DnaPoint point in Points)
            {
                newPolygon.Points.Add(point.Clone());
            }

            return(newPolygon);
        }
Beispiel #4
0
        public void MovePolygon()
        {
            if (Polygons.Count < 1)
            {
                return;
            }

            int        index = Tools.GetRandomNumber(0, Polygons.Count);
            DnaPolygon poly  = Polygons[index];

            Polygons.RemoveAt(index);
            index = Tools.GetRandomNumber(0, Polygons.Count);
            Polygons.Insert(index, poly);
            SetDirty();
        }