예제 #1
0
 //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);
     }
 }
예제 #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();
            }
        }
예제 #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);
        }
예제 #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();
        }