Ejemplo n.º 1
0
        private void ShowAnimation()
        {
            Bitmap original          = new Bitmap(PictureBox_Graph.Image);
            Bitmap background        = new Bitmap(PictureBox_Graph.Image);
            Bitmap temporal          = new Bitmap(PictureBox_Graph.Image);
            Bitmap animationParticle = new Bitmap(CurrentParticle, new Size((int)(CurrentParticle.Width * 0.1), (int)(CurrentParticle.Height * 0.1)));

            int          xCorrection = animationParticle.Width / 2, yCorrection = animationParticle.Height / 2;
            List <Point> points;

            for (int i = 0; i < AnimationSequence.Count - 1; ++i)
            {
                points = GetPoints(AnimationSequence[i], AnimationSequence[i + 1]);
                Graphics.FromImage(background).DrawLine(new Pen(Color.FromArgb(54, 54, 54), 3), AnimationSequence[i].GetCirclePoint(), AnimationSequence[i + 1].GetCirclePoint());

                for (int j = 0; j < points.Count; ++j)
                {
                    Graphics.FromImage(temporal).DrawImage(animationParticle, new Point(points[j].X - xCorrection, points[j].Y - yCorrection));
                    PictureBox_Graph.Image = temporal;
                    PictureBox_Graph.Refresh();
                    temporal = new Bitmap(background);
                    PictureBox_Graph.Image = background;
                }
            }

            PictureBox_Graph.Image = background;
            PictureBox_Graph.Refresh();
        }
Ejemplo n.º 2
0
        private void Button_Load_Click(object sender, EventArgs e)
        {
            try
            {
                Button_Reset_Click(sender, e);

                OpenExplorer.ShowDialog();
                this.ImagePath         = OpenExplorer.FileName;
                PictureBox_Graph.Image = new Bitmap(ImagePath);
                PictureBox_Graph.Refresh();
                this.ImageLoaded = true;
            }
            catch
            {
                Notification message = new Notification("Error al intentar abrir archivo.");
                message.ShowDialog();
            }
        }
Ejemplo n.º 3
0
        private void Button_Graph_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ImageLoaded)
                {
                    Notification message = new Notification("Es necesario cargar una imagen primero.");
                    message.ShowDialog();
                    return;
                }

                ImageProcessing processing = new ImageProcessing(ImagePath);
                processing.ProcessImage();

                if (processing.Status)
                {
                    this.IGraphBitmap = new Bitmap(processing.GraphImage);
                    this.IGraph       = processing.Graph;

                    PictureBox_Graph.Image = this.IGraphBitmap;
                    PictureBox_Graph.Refresh();

                    Notification message = new Notification(processing.Message);
                    message.ShowDialog();

                    this.GraphCreated      = true;
                    this.AvailableVertices = this.IGraph.VertexList.ToList();
                }
                else
                {
                    Notification message = new Notification(processing.Message);
                    message.ShowDialog();
                }
            }
            catch
            {
                Notification message = new Notification("Error al intentar procesar la imagen.");
                message.ShowDialog();
            }
        }