Permalink
Browse files

Update OpenFlowSharp/ImageUtils.cs

  • Loading branch information...
1 parent d4a4be4 commit 3a116bc5458960f2400bffd814561ac48b0decf7 @yusinto yusinto committed Mar 31, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 OpenFlowSharp/ImageUtils.cs
View
12 OpenFlowSharp/ImageUtils.cs
@@ -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);

0 comments on commit 3a116bc

Please sign in to comment.