public void Zoom(double zoom, Point center = null)
{
Area roi;
double width, height;
if (currentZoom == zoom)
return;
if (RegionOfInterest == null)
roi = new Area (new Point (0, 0),
Background.Width, Background.Height);
else
roi = RegionOfInterest;
width = Background.Width / zoom;
height = Background.Height / zoom;
if (center == null) {
roi.Start.X = roi.Start.X + roi.Width / 2 - width / 2;
roi.Start.Y = roi.Start.Y + roi.Height / 2 - height / 2;
} else {
roi.Start.X = center.X - width / 2;
roi.Start.Y = center.Y - height / 2;
}
roi.Width = width;
roi.Height = height;
ClipRoi (roi);
RegionOfInterest = roi;
currentZoom = zoom;
}