Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Update OpenFlowSharp/ImageUtils.cs #1

Merged
merged 1 commit into from Mar 31, 2012
Jump to file or symbol
Failed to load files and symbols.
+11 −1
Split
@@ -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);