GetCalculatedCalibrationPoints() public static method

public static GetCalculatedCalibrationPoints ( Point resolution ) : System.Drawing.Point[]
resolution System.Drawing.Point
return System.Drawing.Point[]
示例#1
0
        private void Btn_calibration_reset_Click(object sender, EventArgs e)
        {
            if (Program.GameSettings.Display != null)
            {
                var calibrations = OcrCalibrator.GetCalculatedCalibrationPoints(Program.GameSettings.Display.Resolution);
                DrawCalibrationPoints(calibrations);
                FillRawData();
                pb_calibratorBox.Refresh();
                OcrCalibrator.SaveCalibration();
                return;
            }

            MessageBox.Show("Unable to calibrate automatically, please calibrate manually...");
        }
示例#2
0
        private void DoCalibration()
        {
            if (Program.GameSettings.Display != null && (OcrCalibrator.CalibrationBoxes == null || OcrCalibrator.CalibrationBoxes.Count < 1))
            {
                var calibrations = OcrCalibrator.GetCalculatedCalibrationPoints(Program.GameSettings.Display.Resolution);
                DrawCalibrationPoints(calibrations);
                return;
            }

            if (OcrCalibrator.CalibrationBoxes != null || OcrCalibrator.CalibrationBoxes.Count >= 1)
            {
                return;
            }

            MessageBox.Show("Unable to calibrate automatically, please calibrate manually...");
        }
示例#3
0
        private Bitmap getReferenceScreenshot()
        {
            var openFile = new OpenFileDialog
            {
                DefaultExt       = "bmp",
                Multiselect      = true,
                Filter           = "BMP (*.bmp)|*.bmp",
                InitialDirectory =
                    Environment.GetFolderPath((Environment.SpecialFolder.MyPictures)) +
                    @"\Frontier Developments\Elite Dangerous",
                Title = "Open a screenshot for calibration"
            };

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                var bmp = new Bitmap(openFile.FileName);

                if (bmp.Height == Program.GameSettings.Display.Resolution.Y &&
                    bmp.Width == Program.GameSettings.Display.Resolution.X)
                {
                    return(bmp);
                }
                var wrongres = MessageBox.Show("The selected image has a different resolution from your current game settings. Do you want to pick another image?", "Ooops...", MessageBoxButtons.YesNo);
                if (wrongres == DialogResult.Yes)
                {
                    return(getReferenceScreenshot());
                }

                // Force resolution from input bmp
                Program.GameSettings.Display.ScreenHeight = bmp.Height;
                Program.GameSettings.Display.ScreenWidth  = bmp.Width;
                SetResolutionValues();
                var calibrations = OcrCalibrator.GetCalculatedCalibrationPoints(Program.GameSettings.Display.Resolution);
                DrawCalibrationPoints(calibrations);

                return(bmp);
            }
            return(null);
        }