public override Pixmap newPixmap(FileHandle file) { Texture2D texture; texture = ((MonoGameTexture)newTexture(file)).texture2D; var rawTextureData = new UInt32[texture.Width * texture.Height]; texture.GetData(rawTextureData); var pixmap = new MonoGamePixmap(texture.Width, texture.Height); for (int x = 0; x < texture.Width; x++) { for (int y = 0; y < texture.Height; y++) { pixmap.drawPixel(x, y, MonoGameColor.argbToRgba(rawTextureData[x + y * texture.Width])); } } return(pixmap); }
public Pixmap newPixmap(FileHandle file) { Texture2D texture; using (var fileStream = new FileStream(((MonoGameFileHandle)file).fullPath(), FileMode.Open)) { texture = Texture2D.FromStream(_graphicsDevice, fileStream); } var rawTextureData = new UInt32[texture.Width * texture.Height]; texture.GetData(rawTextureData); var pixmap = new MonoGamePixmap(texture.Width, texture.Height); for (int x = 0; x < texture.Width; x++) { for (int y = 0; y < texture.Height; y++) { pixmap.drawPixel(x, y, MonoGameColor.argbToRgba(rawTextureData[x + y * texture.Width])); } } return(pixmap); }