コード例 #1
0
ファイル: MainForm.cs プロジェクト: zhifu10001/ocr-label-tool
        private void Confirm_Click(object sender, EventArgs e)
        {
            buffer[index] = new Poly(clkpoint, ang);
            ++index;
            Zoom f = new Zoom(index);

            f.mf = this;
            Image    img = new Bitmap(800, 600);
            Image    org = new Bitmap(rgIMD[cur].GetImg());
            Graphics g = Graphics.FromImage(img);
            int      lx, rx, ly, ry;
            double   ra, rax, ray;

            lx  = Math.Min(newpoint[0].X, newpoint[1].X); lx = Math.Min(lx, newpoint[2].X); lx = Math.Min(lx, newpoint[3].X);
            rx  = Math.Max(newpoint[0].X, newpoint[1].X); rx = Math.Max(rx, newpoint[2].X); rx = Math.Max(rx, newpoint[3].X);
            ly  = Math.Min(newpoint[0].Y, newpoint[1].Y); ly = Math.Min(ly, newpoint[2].Y); ly = Math.Min(ly, newpoint[3].Y);
            ry  = Math.Max(newpoint[0].Y, newpoint[1].Y); ry = Math.Max(ry, newpoint[2].Y); ry = Math.Max(ry, newpoint[3].Y);
            rax = 800.0 / (double)(rx - lx);
            ray = 600.0 / (double)(ry - ly);
            ra  = Math.Min(rax, ray);
            g.Clear(Color.White);
            g.InterpolationMode = InterpolationMode.High;
            g.SmoothingMode     = SmoothingMode.HighQuality;
            g.DrawImage(org, new Rectangle(0, 0, (int)(ra * (rx - lx)), (int)(ra * (ry - ly))), new Rectangle(lx, ly, rx - lx, ry - ly), GraphicsUnit.Pixel);
            f.setdata(ra, lx, ly);
            f.Zoompicbox.Image = img;
            f.Show();
            AddPoly();
            selected = -1;
            OperateClick();
        }
コード例 #2
0
        public Poly Clone()
        {
            Poly tmp = new Poly(rgP[0].X, rgP[0].Y, rgP[1].X, rgP[1].Y, angle, name);

            return(tmp);
        }