public FigurePainter(Brush brush, IFormFigure formFigure, Point startPoint, AbstractFilling typeOfFilling) { this.brush = brush; this.formFigure = formFigure; this.startPoint = startPoint; this.typeOfFilling = typeOfFilling; }
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); } } } } }
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); }
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); }
private void buttonOval_Click(object sender, EventArgs e) { if (vectorMode) { currentFactory = new VectorFigurePainterFactory(); } else { currentFactory = new FigurePainterFactory(); } currentForm = new EllipseForm(); buttonSwitch = new NoneButton(); }
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(); }
private void buttonRightTriangle_Click(object sender, EventArgs e) { if (vectorMode) { currentFactory = new VectorFigurePainterFactory(); } else { currentFactory = new FigurePainterFactory(); } currentForm = new RecTriangleForm(); buttonSwitch = new NoneButton(); }
public PointPolygonPainter(Brush brush, IFormFigure formFigure, Point startPoint) { this.brush = brush; this.formFigure = formFigure; if (first.X == -1) { first = startPoint; last = startPoint; } else { } }
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; } }
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); } } } }
private void buttonPolygon2_Click(object sender, EventArgs e) { currentFactory = new PointPolygonPainterFactory(); currentForm = new LineForm(); buttonSwitch = new NoneButton(); }
private void buttonEraser_Click(object sender, EventArgs e) { currentFactory = new ErasePainterFactory(); currentForm = new LineForm(); buttonSwitch = new NoneButton(); }
private void numericUpDownForPolygon_ValueChanged(object sender, EventArgs e) { currentForm = new PolygonForm(Convert.ToInt32(numericUpDownForPolygon.Value)); }
public LinePainter(Brush brush, IFormFigure formFigure, Point startPoint) { this.brush = brush; this.formFigure = formFigure; this.startPoint = startPoint; }
abstract public AbstractPainter CreatePainter(IFormFigure currentFigure, Color currentColor, int currentSize, Point startPoint, AbstractFilling typeOfFilling);