private void loadPolylineButton_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); DialogResult dialogResult = dialog.ShowDialog(); List <Point> points = new List <Point>(); if (dialogResult == DialogResult.OK) { using (StreamReader reader = new StreamReader(dialog.FileName)) { string line; while ((line = reader.ReadLine()) != null) { string[] p = line.Split(' '); points.Add(new Point(int.Parse(p[0]), int.Parse(p[1]))); } } _polyline = new BezierPolyline(points.ToArray()); _animatorCreator.SetPolyline(_polyline); this.Repaint(canvas); } }
private void generateBezierButton_Click(object sender, EventArgs e) { try { int n = int.Parse(pointsNumberTextbox.Text); if (n > _MAX_POLYLINE_POINTS) { throw new ArgumentException("the number should be <= 40"); } _polyline = new BezierPolyline(n, canvas.Width, canvas.Height); _animatorCreator.SetPolyline(_polyline); } catch (ArgumentException exception) { MessageBox.Show("Incorrect number argument \n" + exception.Message); } catch (FormatException) { MessageBox.Show("Incorrect format"); } this.Repaint(canvas); }
public BezierMoveAnimator(FastBitmap image, BezierPolyline polyline) : base(image) { _bezierPointNumber = 0; _polyline = polyline; _imageMiddle = new Point(image.Width / 2, image.Height / 2); }
public AnimatorCreator(FastBitmap image, BezierPolyline bezierPolyline, int canvasWidth, int canvasHeight) { _animatorType = AnimatorType.Spinning; _rotatorType = RotatorType.Naive; _image = image; //_grayImage = _GetGrayImage(_image); _bezierPolyline = bezierPolyline; _canvasWidth = canvasWidth; _canvasHeight = canvasHeight; }
public Form1() { InitializeComponent(); _polyline = new BezierPolyline(_DEFAULT_BEZIER_POLY_POINTS, canvas.Width, canvas.Height); _bezierPen = new Pen(Color.Black); _animatorCreator = new AnimatorCreator(_image, _polyline, canvas.Width, canvas.Height); _imageLoader = new ImageLoader(_IMAGE_WIDTH, _IMAGE_HEIGHT); _SetImage(_imageLoader.GetDefaultImage()); }
private void _DrawBezierCurve(Pen pen, BezierPolyline polyline, PaintTools paintTools) { _polyline.GetBezierCurve() .Draw(paintTools, pen); }
public void SetPolyline(BezierPolyline polyline) { _bezierPolyline = polyline; }