let y = rbc.center.Y - rbcHeight / 2. |> Utils.roundInt
let w = Utils.roundInt rbcWidth
let h = Utils.roundInt rbcHeight
- //Utils.dprintfn "w: %A, h: %A, cx: %A, cy: %A, img.w: %A, img.h: %A" w h x y img.Width img.Height
img.GetSubRect(System.Drawing.Rectangle(System.Drawing.Point((if x < 0 then 0 else x), (if y < 0 then 0 else y)),
System.Drawing.Size((if x + w >= img.Width then img.Width - x else w),
(if y + h >= img.Height then img.Height - y else h))))