public static Bitmap GetNewSizedBitmapFigures(HistoryDrawing history, float factor, Bitmap initialBmp) { var newSize = new Size((int)(initialBmp.Width * factor), (int)(initialBmp.Height * factor)); return(new Bitmap(history.GetLastBitmapOrDefalutOfficeFigures(factor), newSize)); }
private void Edit_Load(object sender, EventArgs e) { _history = new HistoryDrawing(InitialBmp); var rf = new RoomFigure { FirstLocationPoint = new PointF(5, 5), SecondLocationPoint = new PointF(InitialBmp.Width - 5, InitialBmp.Height - 5) }; rf.Draw(ref InitialBmp, rf.FirstLocationPoint, rf.SecondLocationPoint, _factor); _history.AddFigure(rf); _historyIterator.HistoryUpdate(_history.CountFigures(), _history.CountFigures()); pictureBox1.Image = InitialBmp; pictureBox1.Top = 5; pictureBox1.Left = 5; }
public static bool CorrectOfficeCoordinate(ref OfficeFigure tfo, Bitmap bp, float factor, HistoryDrawing history) { var indent = Settings.Default.indentFromWall * factor; if (tfo.FirstLocationPoint.X < indent) { tfo.FirstLocationPoint.X = indent; } if (tfo.FirstLocationPoint.Y < indent) { tfo.FirstLocationPoint.Y = indent; } if (tfo.SizeH + tfo.FirstLocationPoint.Y > bp.Height - indent) { tfo.FirstLocationPoint.Y = bp.Height - indent - tfo.SizeH; } if (tfo.SizeW + tfo.FirstLocationPoint.X > bp.Width - indent) { tfo.FirstLocationPoint.X = bp.Width - indent - tfo.SizeW; } var of = history.AllOfficeFiguresRecords().Where(e => !(e is TwistedPair)); foreach (var t in of) { if (t.IsCrossesFigure(tfo.FirstLocationPoint, tfo.SizeW, tfo.SizeH)) { return(false); } } return(true); }