public virtual Image GetRegionImage() { if (regionFillPath != null) { Image img; Rectangle regionArea = Rectangle.Round(regionFillPath.GetBounds()); Rectangle newRegionArea = Rectangle.Intersect(regionArea, ScreenRectangle0Based); using (GraphicsPath gp = (GraphicsPath)regionFillPath.Clone()) { MoveGraphicsPath(gp, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y)); img = CaptureHelpers.CropImage(SurfaceImage, newRegionArea, gp); if (Config.DrawBorder) { GraphicsPath gpOutline; if (regionDrawPath != null) { gpOutline = regionDrawPath; } else { gpOutline = regionFillPath; } using (GraphicsPath gp2 = (GraphicsPath)gpOutline.Clone()) { MoveGraphicsPath(gp2, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y)); img = CaptureHelpers.DrawOutline(img, gp2); } } } if (Config.DrawChecker) { img = CaptureHelpers.DrawCheckers(img); } return(img); } return(null); }