Beispiel #1
0
        private void ScalePointToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            //input boxes
            InputBox form = new InputBox("scale?");

            form.ShowDialog();
            float scaleFactor = Convert.ToInt32(form.ValueTextBox.Text);

            InputBox formx = new InputBox("x?");

            formx.ShowDialog();
            int centerX = Convert.ToInt32(formx.ValueTextBox.Text);

            InputBox formy = new InputBox("y?");

            formy.ShowDialog();
            int centerY = Convert.ToInt32(formy.ValueTextBox.Text);

            //copy Undo Image
            imgUndo = img.Copy();

            ImageClass.Scale_point_xy(img, imgUndo, scaleFactor, centerX, centerY);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Beispiel #2
0
        private void zoomToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.Cross; // cross cursor

            //copy Undo Image
            imgUndo = img.Copy();

            InputBox zoom = new InputBox("Zoom Level", decimalTextBox);

            mouseFlag = true;
            while (mouseFlag)
            {
                Application.DoEvents();
            }

            zoom.ShowDialog();

            float factor = Convert.ToSingle(zoom.ValueTextBox.Text);

            Cursor = Cursors.WaitCursor; // clock cursor

            ImageClass.Scale_point_xy(img, img.Copy(), factor, mouseX, mouseY);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
        private void zoomXYToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }


            //copy Undo Image
            imgUndo = img.Copy();
            Cursor  = Cursors.WaitCursor; // clock cursor

            InputBox form = new InputBox("Qual o valor de Zoom?");

            form.ShowDialog();
            //float scaleFactor = (float)Convert.ToDecimal(form.ValueTextBox.Text);
            float scaleFactor = float.Parse(form.ValueTextBox.Text);

            //get mouse coordinates using mouseclick event
            mouseFlag = true;
            while (mouseFlag) //wait for mouseclick
            {
                Application.DoEvents();
            }

            //apply the zoom
            ImageClass.Scale_point_xy(img, imgUndo, scaleFactor, mouseX, mouseY);


            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Beispiel #4
0
        private void ZoomToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }

            Cursor = Cursors.WaitCursor; // clock cursor

            InputBox input = new InputBox("Scale Factor:");

            input.ShowDialog();
            double scale_factor = Convert.ToDouble(input.ValueTextBox.Text);

            mouseFlag = true;
            while (mouseFlag)
            {
                Application.DoEvents();
            }

            //copy Undo Image
            imgUndo = img.Copy();

            Image <Bgr, Byte> imgCopy  = img.Clone();
            float             scale_ff = (float)Math.Round(scale_factor);

            ImageClass.Scale_point_xy(img, imgCopy, scale_ff, mouseX, mouseY);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Beispiel #5
0
        private void zoomToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null)             // verify if the image is already opened
            {
                return;
            }

            using (ScaleForm form = new ScaleForm())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Cursor = Cursors.WaitCursor;                     // clock cursor
                    //copy Undo Image
                    imgUndo = img.Copy();
                    if (form.useCenter)
                    {
                        ImageClass.Scale_point_xy(img, imgUndo, form.scale, form.xCenter, form.yCenter);
                    }
                    else
                    {
                        ImageClass.Scale(img, imgUndo, form.scale);
                    }

                    ImageViewer.Image = img.Bitmap;
                    ImageViewer.Refresh();                     // refresh image on the screen

                    Cursor = Cursors.Default;                  // normal cursor
                }
            }
        }
        private void pointToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //get mouse coordinates
            mouseFlag = true;
            while (mouseFlag)//WAIT FOR MOUSE CLICK
            {
                Application.DoEvents();
            }
            if (img == null) // verify if the image is already opened
            {
                return;
            }



            InputBox form = new InputBox("Zoom in point");

            form.ShowDialog();
            float scaleFactor = Convert.ToSingle(form.textBoxBright.Text);

            imgUndo = img.Copy();
            ImageClass.Scale_point_xy(img, imgUndo, scaleFactor, mouseX, mouseY);


            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Beispiel #7
0
        private void scalePointxyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //get mouse coordinates using mouseClick event

            mouseFlag = true;
            while (mouseFlag) // wait for mouseClick event
            {
                Application.DoEvents();
            }

            InputBox form = new InputBox("Escala");

            form.ShowDialog();
            float scaleFactor = Convert.ToSingle(form.ValueTextBox.Text);

            ImageClass.Scale_point_xy(img, img, scaleFactor, mouseX, mouseY);
        }
Beispiel #8
0
        private void mouseCenteredZoomToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            //copy Undo Image
            imgUndo = img.Copy();

            InputBox formz = new InputBox("Zoom (factor)?");

            formz.ShowDialog();
            string factorZ = formz.ValueTextBox.Text;
            bool   success = float.TryParse(factorZ, out float j);

            if (success && j > 0)
            {
                mouseFlag = true;

                while (mouseFlag)
                {
                    Application.DoEvents();
                }

                ImageClass.Scale_point_xy(img, imgUndo, j, mouseX, mouseY);

                ImageViewer.Image = img.Bitmap;
                ImageViewer.Refresh();    // refresh image on the screen

                Cursor = Cursors.Default; // normal cursor
            }
            else
            {
                MessageBox.Show("Value for Zoom must be a number bigger than zero.", "Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error); // for Error
            }
        }