Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update OpenFlowSharp/ImageUtils.cs #1

Merged
merged 1 commit into from

2 participants

@yusinto

Upgrade coverflow to work with retina display for iPad 3.

@migueldeicaza migueldeicaza merged commit f44f844 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 31, 2012
  1. @yusinto
This page is out of date. Refresh to see the latest.
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);
Something went wrong with that request. Please try again.