Esempio n. 1
0
 public FigurePainter(Brush brush, IFormFigure formFigure, Point startPoint, AbstractFilling typeOfFilling)
 {
     this.brush         = brush;
     this.formFigure    = formFigure;
     this.startPoint    = startPoint;
     this.typeOfFilling = typeOfFilling;
 }
Esempio n. 2
0
        public void DrawFigure(IFormFigure formFigure, Bitmap newBitmap, Point p1, PictureBox pictureBox)
        {
            List <Point> figurePoints = formFigure.CalculateFigure(startPoint, p1);

            if (formFigure is CircleForm || formFigure is EllipseForm)
            {
                for (int i = 0; i < figurePoints.Count - 1; i++)
                {
                    brush.DrawLine(figurePoints[i], figurePoints[i + 1], pictureBox, brush.currentColor, newBitmap);
                }
            }
            else
            {
                if (formFigure is CircleForm || formFigure is EllipseForm)
                {
                    for (int i = 0; i < figurePoints.Count; i++)
                    {
                        if (i != figurePoints.Count - 1)
                        {
                            brush.DrawLine(figurePoints[i], figurePoints[i + 1], pictureBox, brush.currentColor, newBitmap);
                        }
                        else
                        {
                            brush.DrawLine(figurePoints[i], figurePoints[0], pictureBox, brush.currentColor, newBitmap);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public override AbstractPainter CreatePainter(IFormFigure currentFigure, Color currentColor, int currentSize, Point startPoint, AbstractFilling typeOfFilling)
        {
            Brush brush = new Brush(currentColor, currentSize);

            abstractPainter = new PointPolygonPainter(brush, currentFigure, startPoint);
            return(abstractPainter);
        }
Esempio n. 4
0
 public VectorFigurePainter(Brush brush, IFormFigure formFigure, Point startPoint, AbstractFilling typeOfFilling)
 {
     this.brush         = brush;
     this.formFigure    = formFigure;
     this.startPoint    = startPoint;
     this.typeOfFilling = typeOfFilling;
     points             = formFigure.CalculateFigure(startPoint, startPoint);
 }
        public override AbstractPainter CreatePainter(IFormFigure currentFigure, Color currentColor, int currentSize, Point startPoint, AbstractFilling typeOfFilling)
        {
            Brush brush = new Brush(currentColor, currentSize);

            abstractPainter = new VectorFigurePainter(brush, currentFigure, startPoint, typeOfFilling);
            Canvas.GetCanvas.figures.Insert(0, abstractPainter);

            return(abstractPainter);
        }
Esempio n. 6
0
 private void buttonOval_Click(object sender, EventArgs e)
 {
     if (vectorMode)
     {
         currentFactory = new VectorFigurePainterFactory();
     }
     else
     {
         currentFactory = new FigurePainterFactory();
     }
     currentForm  = new EllipseForm();
     buttonSwitch = new NoneButton();
 }
Esempio n. 7
0
 private void buttonPolygon1_Click(object sender, EventArgs e)
 {
     if (vectorMode)
     {
         currentFactory = new VectorFigurePainterFactory();
     }
     else
     {
         currentFactory = new FigurePainterFactory();
     }
     currentForm  = new PolygonForm(Convert.ToInt32(numericUpDownForPolygon.Value));
     buttonSwitch = new NoneButton();
 }
Esempio n. 8
0
 private void buttonRightTriangle_Click(object sender, EventArgs e)
 {
     if (vectorMode)
     {
         currentFactory = new VectorFigurePainterFactory();
     }
     else
     {
         currentFactory = new FigurePainterFactory();
     }
     currentForm  = new RecTriangleForm();
     buttonSwitch = new NoneButton();
 }
Esempio n. 9
0
 public PointPolygonPainter(Brush brush, IFormFigure formFigure, Point startPoint)
 {
     this.brush      = brush;
     this.formFigure = formFigure;
     if (first.X == -1)
     {
         first = startPoint;
         last  = startPoint;
     }
     else
     {
     }
 }
Esempio n. 10
0
        public void SetPolygonSides()
        {
            switch (sides)
            {
            case 3:
                figure = new PolygonForm(sides);
                break;

            case 4:
                figure = new PolygonForm(sides);
                break;

            case 5:
                figure = new PolygonForm(sides);
                break;
            }
        }
Esempio n. 11
0
 public void DrawFigure(IFormFigure formFigure, Bitmap newBitmap, PictureBox pictureBox, List <Point> figurePoints)
 {
     if (formFigure is CircleForm || formFigure is EllipseForm)
     {
         for (int i = 0; i < figurePoints.Count - 1; i++)
         {
             this.DrawLine(figurePoints[i], figurePoints[i + 1], pictureBox, this.currentColor, newBitmap);
         }
     }
     else
     {
         for (int i = 0; i < figurePoints.Count; i++)
         {
             if (i != figurePoints.Count - 1)
             {
                 this.DrawLine(figurePoints[i], figurePoints[i + 1], pictureBox, this.currentColor, newBitmap);
             }
             else
             {
                 this.DrawLine(figurePoints[i], figurePoints[0], pictureBox, this.currentColor, newBitmap);
             }
         }
     }
 }
Esempio n. 12
0
 private void buttonPolygon2_Click(object sender, EventArgs e)
 {
     currentFactory = new PointPolygonPainterFactory();
     currentForm    = new LineForm();
     buttonSwitch   = new NoneButton();
 }
Esempio n. 13
0
 private void buttonEraser_Click(object sender, EventArgs e)
 {
     currentFactory = new ErasePainterFactory();
     currentForm    = new LineForm();
     buttonSwitch   = new NoneButton();
 }
Esempio n. 14
0
 private void numericUpDownForPolygon_ValueChanged(object sender, EventArgs e)
 {
     currentForm = new PolygonForm(Convert.ToInt32(numericUpDownForPolygon.Value));
 }
Esempio n. 15
0
 public LinePainter(Brush brush, IFormFigure formFigure, Point startPoint)
 {
     this.brush      = brush;
     this.formFigure = formFigure;
     this.startPoint = startPoint;
 }
Esempio n. 16
0
 abstract public AbstractPainter CreatePainter(IFormFigure currentFigure, Color currentColor, int currentSize, Point startPoint, AbstractFilling typeOfFilling);