Example #1
0
 public static int GetTextureFromResource(ICore core, Bitmap texture)
 {
     var ds = GetTextureSourceFromResource(core, texture);
     return core.TextureFactory.LoadTexture(ds, texture.ToString(), -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_USE_ALPHA_CHANNEL);
 }
Example #2
0
 public static int GetDUDVTextureFromResource(ICore core, Bitmap texture)
 {
     var ms = new MemoryStream();
     texture.Save(ms, ImageFormat.Png);
     ms.Seek(0, 0);
     var data = ms.ToArray();
     ms.Dispose();
     texture.Dispose();
     var handle = GCHandle.Alloc(data, GCHandleType.Pinned);
     var addr = handle.AddrOfPinnedObject().ToInt32();
     handle.Free();
     var ds = core.Globals.GetDataSourceFromMemory(addr, data.Length - 1);
     return core.TextureFactory.LoadDUDVTexture(ds, texture.ToString(), -1, -1, 25);
 }