Bare in mind that this is simply a quick fix for the image loading upside down. I think the code is about as simple as it can get while getting the job done.
public static CGImage RotateImage (CGImage oImage)
{
CGContext oContext;
UIImage oRotatedImage;
RectangleF oImageBounds;
//
oImageBounds = new RectangleF (0, 0, oImage.Width, oImage.Height);
//
UIGraphics.BeginImageContext (oImageBounds.Size);
oContext = UIGraphics.GetCurrentContext ();
//
oContext.DrawImage (oImageBounds, oImage);
oRotatedImage = UIGraphics.GetImageFromCurrentImageContext ();
UIGraphics.EndImageContext ();
//
return oRotatedImage.CGImage;
}
I stumbled upon this solution while playing around with the code in this question and thought, hey that works and I don't need it to do anything else :D So I hope this helps you!
Also, if anyone can explain the reasons for all this then please, I'd be interested to know what's actually going on. My only previous experience of working with 2D graphics is from using the XNA framework.