Ejemplo n.º 1
0
        //Draw a drawing
        public void Draw(Graphics graphic, Color backgroundColor, ShapeType drawingShape, double resizeFactor)
        {
            graphic.Clear(backgroundColor);
            foreach (var shape in shapes)
            {
                Point[] scaled = shape.getPoints();

                for (int i = 0; i < scaled.Count(); i++)
                {
                    scaled[i].X = (int)((double)scaled[i].X / resizeFactor);
                    scaled[i].Y = (int)((double)scaled[i].Y / resizeFactor);
                }

                switch (drawingShape)
                {
                case ShapeType.elipse:
                    graphic.FillClosedCurve(shape.getBrush(), scaled);
                    break;

                case ShapeType.polygon:
                    graphic.FillPolygon(shape.getBrush(), scaled);
                    break;
                }
            }
        }