Пример #1
0
        public void CutImages(string imgpath, bool isreplace)
        {
            int count = this.cardlist.Length;
            int i     = 0;

            foreach (Card c in this.cardlist)
            {
                if (this.isCancel)
                {
                    break;
                }

                i++;
                this.worker.ReportProgress((i / count), string.Format("{0}/{1}", i, count));
                string jpg     = MyPath.Combine(imgpath, c.id + ".jpg");
                string savejpg = MyPath.Combine(this.mseHelper.ImagePath, c.id + ".jpg");
                if (File.Exists(jpg) && (isreplace || !File.Exists(savejpg)))
                {
                    Bitmap bp = new Bitmap(jpg);
                    Bitmap bmp;
                    if (c.IsType(CardType.TYPE_XYZ))//超量
                    {
                        bmp = MyBitmap.Cut(bp, this.imgSet.xyzArea);
                    }
                    else if (c.IsType(CardType.TYPE_PENDULUM))//P怪兽
                    {
                        bmp = MyBitmap.Cut(bp, this.imgSet.pendulumArea);
                    }
                    else//一般
                    {
                        bmp = MyBitmap.Cut(bp, this.imgSet.normalArea);
                    }
                    bp.Dispose();
                    MyBitmap.SaveAsJPEG(bmp, savejpg, this.imgSet.quilty);
                    //bmp.Save(savejpg, ImageFormat.Png);
                }
            }
        }