예제 #1
0
 public Bitmap Action(IOperationParameters operationParameters)
 {
     CreateMainBitmap();
     Canvas.Current.Figure.Clear();
     Canvas.Current.Figures.Clear();
     return(Canvas.Current.MainBitmap);
 }
예제 #2
0
 public Bitmap Action(IOperationParameters operationParameters)
 {
     Canvas.Current.TmpBitmap = (Bitmap)Canvas.Current.MainBitmap.Clone();
     Canvas.Current.Graphics  = Graphics.FromImage(Canvas.Current.TmpBitmap);
     ((DrawFigureOperationParameters)operationParameters).Figure.Drawer.DrawFigure(Canvas.Current.Graphics, new Pen(((DrawFigureOperationParameters)operationParameters).Figure.Color, ((DrawFigureOperationParameters)operationParameters).Figure.Width), ((DrawFigureOperationParameters)operationParameters).Figure.GetPoints());
     GC.Collect();
     return(Canvas.Current.TmpBitmap);
 }
예제 #3
0
 public Bitmap Action(IOperationParameters operationParameters)
 {
     DeleteAllFigure();
     foreach (AbstractFigure figure in Canvas.Current.Figures)
     {
         Canvas.Current.TmpBitmap  = Canvas.Current.Action(new DrawFigureOperationParameters(figure));
         Canvas.Current.MainBitmap = Canvas.Current.Action(new EndDrawOperationParameters());
     }
     return(Canvas.Current.MainBitmap);
 }
예제 #4
0
 public Bitmap Action(IOperationParameters operationParameters)
 {
     if (Canvas.Current.PreviousBitmaps.Count >= 5)
     {
         Canvas.Current.PreviousBitmaps.RemoveFirst();
     }
     Canvas.Current.PreviousBitmaps.AddLast(Canvas.Current.MainBitmap);
     Canvas.Current.MainBitmap = Canvas.Current.TmpBitmap;
     return(Canvas.Current.MainBitmap);
 }
예제 #5
0
        public Bitmap Action(IOperationParameters operationParameters)
        {
            Bitmap tmp = Canvas.Current.MainBitmap;

            Canvas.Current.MainBitmap = new Bitmap(((SizeOperationParameter)operationParameters).Width + 500,
                                                   ((SizeOperationParameter)operationParameters).Height + 500);
            Graphics.FromImage(Canvas.Current.MainBitmap).DrawImage(tmp, new Point(0, 0));
            Canvas.Current.TmpBitmap = Canvas.Current.MainBitmap;
            GC.Collect();
            return(Canvas.Current.MainBitmap);
        }
예제 #6
0
        public Bitmap Action(IOperationParameters operationParameters)
        {
            var saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter   = "PNG|*.png|JPEG|*.jpg;*.jpeg;*.jpe;*.jfif|BMP|*.bmp|GIF|*.gif";
            saveFileDialog.FileName = "figure";

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                Canvas.Current.MainBitmap.Save(saveFileDialog.FileName);
            }
            return(Canvas.Current.MainBitmap);
        }
예제 #7
0
        public Bitmap Action(IOperationParameters operationParameters)
        {
            if (Canvas.Current.PreviousBitmaps.Count == 0)
            {
                return(Canvas.Current.MainBitmap);
            }
            Canvas.Current.MainBitmap = Canvas.Current.PreviousBitmaps.Last.Value;
            Canvas.Current.PreviousBitmaps.RemoveLast();

            if (Canvas.Current.Figures.Count != 0)
            {
                Canvas.Current.Figures.RemoveAt(Canvas.Current.Figures.Count - 1);
            }

            return(Canvas.Current.MainBitmap);
        }
예제 #8
0
 public Bitmap Action(IOperationParameters operationParameters)
 {
     Canvas.Current.Graphics = Graphics.FromImage(Canvas.Current.MainBitmap);
     Canvas.Current.Graphics.Clear(((ChangeBackgroundColorOperationParameters)operationParameters).ColorBackground);
     return(Canvas.Current.MainBitmap);
 }
예제 #9
0
 public Bitmap Action(IOperationParameters parameters)
 {
     return(_operations.GetOperation(parameters.GetType()).Action(parameters));
 }