Ejemplo n.º 1
0
 public static void AnalysisImg_AGIN_3840x2160_Step2(string filePath, out AGIN_3840x2160_Baccarat_TblLevel1 output)
 {
     #region For: DirectoryInfo.Create()
     DirectoryInfo dir_info = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath)));
     dir_info.Create();
     #endregion
     #region For: Crop and Save image
     Image img_org = Image.FromFile(filePath);
     int   x = 778, y = 90, w = 846, h = 152;
     using (Bitmap img_bmp = new Bitmap(w, h, img_org.PixelFormat))
     {
         string file_name = string.Format("table-level-1{0}", Path.GetExtension(filePath));
         string file_path = Path.Combine(dir_info.FullName, file_name);
         img_bmp.SetResolution(img_org.HorizontalResolution, img_org.VerticalResolution);
         using (Graphics graphics = Graphics.FromImage(img_bmp))
         {
             graphics.SmoothingMode     = SmoothingMode.AntiAlias;
             graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
             graphics.PixelOffsetMode   = PixelOffsetMode.HighQuality;
             graphics.DrawImage(img_org, new Rectangle(0, 0, w, h), x, y, w, h, GraphicsUnit.Pixel);
             img_bmp.Save(file_path, img_org.RawFormat);
         }
         AnalysisImg_AGIN_3840x2160_Step3(file_path, out output);
     }
     #endregion
     #region For: Image.Dispose()
     if (null != img_org)
     {
         img_org.Dispose();
     }
     #endregion
 }
Ejemplo n.º 2
0
 public AGIN_3840x2160_Baccarat(int maxX, int maxY)
 {
     Tbls = new AGIN_3840x2160_Baccarat_TblLevel1[maxX][];
     for (int i = 0; i < maxX; i++)
     {
         Tbls[i] = new AGIN_3840x2160_Baccarat_TblLevel1[maxY];
     }
 }
Ejemplo n.º 3
0
        public static void AnalysisImg_AGIN_3840x2160_Step3(string filePath, out AGIN_3840x2160_Baccarat_TblLevel1 output)
        {
            #region For: DirectoryInfo.Create()
            DirectoryInfo dir_info = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath)));
            dir_info.Create();
            #endregion
            #region For: Crop and Save image
            Image img_org = Image.FromFile(filePath);
            int   maxx = 34, maxy = 6;
            int   x = 0, y = 0, w = 22, h = 22, mgl = 3, mgt = 3;
            output = new AGIN_3840x2160_Baccarat_TblLevel1(maxx, maxy);
            for (int ix = 0; ix < maxx; ix++)
            {
                for (int iy = 0; iy < maxy; iy++)
                {
                    x = mgl + (w + 3) * ix - (ix - 1) / 5;
                    y = mgt + (h + 3) * iy;
                    string file_name = string.Format("cell-{0}-{1}{2}", ix, iy, Path.GetExtension(filePath));
                    string file_path = Path.Combine(dir_info.FullName, file_name);
                    using (Bitmap img_bmp = new Bitmap(w, h, img_org.PixelFormat))
                    {
                        img_bmp.SetResolution(img_org.HorizontalResolution, img_org.VerticalResolution);
                        using (Graphics graphics = Graphics.FromImage(img_bmp))
                        {
                            graphics.SmoothingMode     = SmoothingMode.AntiAlias;
                            graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                            graphics.PixelOffsetMode   = PixelOffsetMode.HighQuality;
                            graphics.DrawImage(img_org, new Rectangle(0, 0, w, h), x, y, w, h, GraphicsUnit.Pixel);
                            img_bmp.Save(file_path, img_org.RawFormat);

                            var cell = new AGIN_3840x2160_Baccarat_TblLevel1_Cell(file_path);
                            output.AddCell(cell, ix, iy);
                        }
                    }
                }
            }
            #endregion
            #region For: Image.Dispose()
            if (null != img_org)
            {
                img_org.Dispose();
            }
            #endregion
        }
Ejemplo n.º 4
0
 public void AddTbl(AGIN_3840x2160_Baccarat_TblLevel1 tbl, int idxX, int idxY)
 {
     Tbls[idxX][idxY] = tbl;
 }