Skip to content

Commit

Permalink
Update OpenFlowSharp/ImageUtils.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
yusinto committed Mar 31, 2012
1 parent d4a4be4 commit 3a116bc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion OpenFlowSharp/ImageUtils.cs
Expand Up @@ -78,7 +78,17 @@ public static UIImage AddImageReflection (UIImage image, float reflectionFractio

var size = new SizeF (image.Size.Width, image.Size.Height + reflectionHeight);

UIGraphics.BeginImageContext (size);
// Use BeginImageContextWithOptions for retina images (only available on is 4.0 and up).
// http://stackoverflow.com/questions/6965873/drawing-on-the-retina-display-using-coregraphics-image-pixelated
if (UIScreen.MainScreen.RespondsToSelector(new Selector("scale")))
{
UIGraphics.BeginImageContextWithOptions(size, false, UIScreen.MainScreen.Scale);
}
else
{
UIGraphics.BeginImageContext (size);
}

image.Draw (PointF.Empty);
var context = UIGraphics.GetCurrentContext ();
context.DrawImage (new RectangleF (0, image.Size.Height, image.Size.Width, reflectionHeight), reflectionImage);
Expand Down

0 comments on commit 3a116bc

Please sign in to comment.