c# - Crop Image in Aspect Fill UIImageView -
i have been trying figure out hours no answer.
i have uiimageview contentmode uiviewcontentmode.scaleaspectfill
crop using overlying resizable frame. cropping frame no longer maintains 1:1 relationship between bounds contains both uiimageview , cropping tool. cropping simple as:
using (var imageref = image.cgimage.withimageinrect(frame)) { return uiimage.fromimage(imageref); }
but, calculations required in case, how calculate offset match cropping tool frame newly inflated uiimageview (or rather uiimage)? here's image paint picture:
this picture shows few key things.
upper right image: cropped (area contained in blue section)
blue rectangle: cropping being taken place, notice position , height skewed compared red.
red rectangle: cropping control, cropping should taking place. instead of blue is.
upper blue textbox: ignore this.
essentially, want blue rect red frame is.
any appeciated, using c# this, objective c answers more welcomed.