public static Texture2D FromEmbeddedImage([NotNull] this GLTextureFactory fact, TextureConfig cfg, string name) { var bmp = LoadFromRes(name); // update the name to not have the extension. name = Path.GetFileNameWithoutExtension(name); var rect = new Rectangle(0, 0, bmp.Width, bmp.Height); var bitmapData = bmp.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); return fact.Create2D(name, cfg, bmp.Width, bmp.Height, bitmapData.Scan0); }
public static Texture2D FromBitmap([NotNull] this GLTextureFactory fact, string name, TextureConfig cfg, Bitmap bmp) { var rect = new Rectangle(0, 0, bmp.Width, bmp.Height); var bitmapData = bmp.LockBits(rect, ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); return fact.Create2D(name, cfg, bmp.Width, bmp.Height, bitmapData.Scan0); }