コード例 #1
0
        void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            string gifPath = openFileDialog1.FileName;

            sw.Reset();
            sw.Start();
            switch (e.Argument.ToString())
            {
            case "Monochrome":
            {
                GifHelper.Monochrome(pictureBox1.ImageLocation, outGifPath);
                break;
            }

            case "RotateLeft":
            {
                GifHelper.Rotate(pictureBox1.ImageLocation, RotateFlipType.Rotate90FlipXY, outGifPath);
                break;
            }

            case "RotateRight":
            {
                GifHelper.Rotate(pictureBox1.ImageLocation, RotateFlipType.Rotate270FlipXY, outGifPath);
                break;
            }

            case "FlipH":
            {
                GifHelper.Rotate(pictureBox1.ImageLocation, RotateFlipType.RotateNoneFlipX, outGifPath);
                break;
            }

            case "FlipV":
            {
                GifHelper.Rotate(pictureBox1.ImageLocation, RotateFlipType.RotateNoneFlipY, outGifPath);
                break;
            }

            case "Thum50%":
            {
                GifHelper.GetThumbnail(pictureBox1.ImageLocation, 0.5, outGifPath);
                break;
            }

            case "Thum30%":
            {
                GifHelper.GetThumbnail(pictureBox1.ImageLocation, 0.3, outGifPath);
                break;
            }

            case "Thum120%":
            {
                GifHelper.GetThumbnail(pictureBox1.ImageLocation, 1.2, outGifPath);
                break;
            }

            case "Thum150%":
            {
                GifHelper.GetThumbnail(pictureBox1.ImageLocation, 1.5, outGifPath);
                break;
            }

            case "WaterMark":
            {
                GifHelper.WaterMark(pictureBox1.ImageLocation, SizeMode.Large, wmText.Text, wmText.ForceColor, wmText.Font, StartX, StartY, outGifPath);
                break;
            }

            case "WaterMarkWithImage":
            {
                GifHelper.WaterMark(pictureBox1.ImageLocation, waterImg, StartX, StartY, outGifPath);
                break;
            }

            case "Corp":
            {
                GifHelper.Crop(pictureBox1.ImageLocation, new Rectangle((int)StartX, (int)StartY, (int)(EndX - StartX), (int)(EndY - StartY)), outGifPath);
                break;
            }

            case "Merge":
            {
                GifHelper.Merge(mf.SourceFiles, outGifPath);
                openFileDialog1.FileName = outGifPath;
                break;
            }

            case "Merge1":
            {
                GifHelper.Merge(mf.SourceFiles, outGifPath, 50, true);
                openFileDialog1.FileName = outGifPath;
                break;
            }
            }
            sw.Stop();
        }