/// <summary>
 /// Creates a new cropped WriteableBitmap.
 /// </summary>
 /// <param name="bmp">The WriteableBitmap.</param>
 /// <param name="region">The rectangle that defines the crop region.</param>
 /// <returns>A new WriteableBitmap that is a cropped version of the input.</returns>
 public static BitmapBuffer Crop(this BitmapBuffer bmp, RectD region)
 {
     return(bmp.Crop((int)region.X, (int)region.Y, (int)region.Width, (int)region.Height));
 }