private void DrawImage(Bitmap image, Map map, ScalingInfo scale)
        {
            var graphics = Graphics.FromImage(image);

            graphics.FillRectangle(BackGroundBrush, 0, 0, scale.XSize - 1, scale.YSize - 1);
            var pointShift = (PointSize - 1) / 2;

            graphics.FillEllipse(StartPointBrush, new Rectangle(GetScaledX(map.StartPoint.X, scale) - pointShift, GetScaledY(map.StartPoint.Y, scale) - pointShift, PointSize, PointSize));
            graphics.FillEllipse(FinishPointBrush, new Rectangle(GetScaledX(map.FinishPoint.X, scale) - pointShift, GetScaledY(map.FinishPoint.Y, scale) - pointShift, PointSize, PointSize));
            foreach (var rect in map.Rects)
            {
                graphics.FillRectangle(RectangleBrush, GetScaledX(rect.VertexUL.X, scale), GetScaledY(rect.VertexUL.Y, scale), GetScaledSize(rect.Width, scale), GetScaledSize(rect.Height, scale));
            }
        }
 private int GetScaledSize(int size, ScalingInfo scale)
 {
     return((int)Math.Round(size * scale.Scale));
 }
 private int GetScaledY(int y, ScalingInfo scale)
 {
     return((int)Math.Round(scale.YOffset + (y - scale.YMin) * scale.Scale));
 }
 private int GetScaledX(int x, ScalingInfo scale)
 {
     return((int)Math.Round(scale.XOffset + (x - scale.XMin) * scale.Scale));
 }
 private Bitmap PrepareImage(Map map, ScalingInfo scale)
 {
     return(new Bitmap(scale.XSize, scale.YSize));
 }