Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Created January 11, 2016 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolfbjarne/1452c400fbbbe7da071f to your computer and use it in GitHub Desktop.
Save rolfbjarne/1452c400fbbbe7da071f to your computer and use it in GitHub Desktop.
private static IImage LoadResourceImage(string name)
{
using (var s = typeof(GlobeView).Assembly.GetManifestResourceStream(name))
{
return LoadImage(s);
}
}
public static IImage LoadImage (System.IO.Stream stream)
{
var mem = new System.IO.MemoryStream ((int)stream.Length);
stream.CopyTo (mem);
var provider = new CGDataProvider (mem.ToArray ());
var image = CGImage.FromPNG (provider, null, false, CGColorRenderingIntent.Default);
return new CGImageImage (image, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment