Пример #1
0
 public AGIN_3840x2160_Baccarat_TblLevel1(int maxX, int maxY)
 {
     Cells = new AGIN_3840x2160_Baccarat_TblLevel1_Cell[maxX][];
     for (int i = 0; i < maxX; i++)
     {
         Cells[i] = new AGIN_3840x2160_Baccarat_TblLevel1_Cell[maxY];
     }
 }
Пример #2
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
        }
Пример #3
0
 public void AddCell(AGIN_3840x2160_Baccarat_TblLevel1_Cell cell, int idxX, int idxY)
 {
     Cells[idxX][idxY] = cell;
 }