//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); } }
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(); } }
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); }
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(); }