Example #1
0
        private void RotateBT_Click(object sender, EventArgs e)
        {
            if (photoCB.SelectedIndex == -1)
            {
                return;
            }
            if (!float.TryParse(angleTB.Text, out float angle))
            {
                MessageBox.Show("Wrong angle");
                return;
            }
            var rotate = this.Scene.Photos[photoCB.SelectedIndex];

            this.Scene.Photos.Remove(rotate);
            int x = rotate.X, y = rotate.Y;

            rotate = RotateFilter.Process(rotate, angle);
            if (x != rotate.X || y != rotate.Y)
            {
                rotate.ChangeXY(x, y);
            }
            this.Scene.Photos.Insert(photoCB.SelectedIndex, rotate);

            Draw();
        }
Example #2
0
        private void AddBTN_Click(object sender, EventArgs e)
        {
            if (tmp == null)
            {
                return;
            }
            int   w = Int32.Parse(widthInputTB.Text), h = Int32.Parse(heightInputTB.Text);
            float angle = float.Parse(angleInputTB.Text);
            var   insert = ScalingFilter.Process(tmp, w, h);
            int   x = Int32.Parse(xInputTB.Text), y = Int32.Parse(yInputTB.Text);

            if (angle > 1e-10)
            {
                insert = RotateFilter.Process(insert, angle);
            }
            if (insert.X != x || insert.Y != y)
            {
                insert.ChangeXY(x, y);
            }
            this.Scene.Photos.Insert(0, insert);
            this.Scene.UpdatePhotos();

            Draw();
            ListToComboBox(photoCB, this.Scene.Photos);
        }