// 用于保存执行了所有操作的图片
        public void SavePhoto()
        {
            Bitmap image    = null;
            Bitmap orgImage = null;

            try
            {
                // 读入原始图片及其原始格式
                Cursor.Current = Cursors.WaitCursor;
                Global.Progress.Update(this, "Processing photo", 1, 2);
                // 确保图片不是只读的
                if (FileManager.IsFileReadOnly(Photo.PhotoPath))
                {
                    throw new ApplicationException(string.Format("The photo \'{0}\' is read-only.", _photo.PhotoPath));
                }
                // 创建可被保存的图片(原始图片的拷贝),保存原始图片知道我们将操作执行于新图片之上
                // 然后使用原始图片来拷贝exif信息
                orgImage = new Bitmap(_photo.PhotoPath);
                // 需要拷贝以便覆写原始图片
                image = new Bitmap(orgImage);
                // 存储此图片的格式,用于后面的保存
                ImageFormat format = orgImage.RawFormat;
                Global.Progress.Complete(this);
                Cursor.Current = Cursors.Default;
                // 在图片上执行所有的操作
                OptimizeActions optimize = new OptimizeActions();
                optimize.Apply(ref image, 0.0F);
                // 在保存前拷贝exif信息
                if (Global.Settings.GetBool(SettingKey.MaintainExifInfo))
                {
                    Exif.Copy(orgImage, image);
                }
                // 在覆写前需要关闭原始图片
                orgImage.Dispose();
                orgImage = null;
                // 将图片存回文件系统
                Global.Progress.Update(this, "Saving photo", 2, 2);
                image.Save(_photo.PhotoPath, format);
                OnNewPhoto(_photo.PhotoPath, image, format);
            }
            catch (Exception ex)
            {
                Global.DisplayError(string.Format("The file \'{0}\' could not be saved.", _photo.PhotoName), ex);
            }
            finally
            {
                // 消除操作
                if (!(orgImage == null))
                {
                    orgImage.Dispose();
                }
                if (!(image == null))
                {
                    image.Dispose();
                }
            }
            //  the crop area should be cleared
            Global.Progress.Complete(this);
            Cursor.Current = Cursors.Default;
        }
        // 在Undo方法中调用,用于对原始工作图片重新执行当前操作列表中的所有操作。
        private void ApplyActionsToWorking()
        {
            if (_workingImage != null)
            {
                _workingImage.Dispose();
            }
            _workingImage = new Bitmap(_startingImage);
            OptimizeActions optimize = new OptimizeActions();

            optimize.Apply(ref _workingImage, _scale);
            //  reset the crop helper
            _cropHelper.PhotoBounds       = _photoBounds;
            _cropHelper.OriginalPhotoSize = _orgPhotoSize;
            //  update crop helper
            ActionItem action;

            for (int i = 0; i <= Global.ActionList.Count - 1; i++)
            {
                action = Global.ActionList.GetAt(i);
                switch (action.Action)
                {
                case PhotoAction.RotateLeft:
                    _cropHelper.OriginalPhotoRotated();
                    break;

                case PhotoAction.RotateRight:
                    _cropHelper.OriginalPhotoRotated();
                    break;

                case PhotoAction.Crop:
                    _cropHelper.OriginalPhotoSize = action.Bounds.Size;
                    break;
                }
            }
            OnCropDataChanged();
        }