public static Microsoft.Xna.Framework.Color[] DrawMissingnoTexture() { Bitmap bitmap = new Bitmap(75, 25); Graphics graphics = Graphics.FromImage(bitmap); graphics.Clear(System.Drawing.Color.White); Font font = new Font("System", 10f, FontStyle.Bold); graphics.DrawString("missingno", font, Brushes.Red, new PointF(5f, 5f)); Microsoft.Xna.Framework.Color[] array = new Microsoft.Xna.Framework.Color[bitmap.Width * bitmap.Height]; for (int i = 0; i < bitmap.Height; i++) { for (int j = 0; j < bitmap.Width; j++) { array[j + i * bitmap.Width] = GraphicOptions.DrawingColorToXnaColor(bitmap.GetPixel(j, i)); } } return(array); }
public void UpdatePic(GraphicsDevice gd) { WebClient webClient = new WebClient(); byte[] bytes = webClient.DownloadData("http://growalonegame.000webhostapp.com/gallery_of_worlds//" + this.name + "/" + this.thumbnail); File.WriteAllBytes("c:\\growalone_maps\\thumb.png", bytes); Bitmap bitmap = new Bitmap(1, 1); using (FileStream fileStream = new FileStream("c:\\growalone_maps\\thumb.png", FileMode.Open, FileAccess.Read)) { bitmap = (Bitmap)Image.FromStream(fileStream); } System.Drawing.Color[] array = new System.Drawing.Color[bitmap.Width * bitmap.Height]; array = GraphicOptions.DrawingBitmapToDrawingColorArray(bitmap); Microsoft.Xna.Framework.Color[] array2 = new Microsoft.Xna.Framework.Color[bitmap.Width * bitmap.Height]; for (int i = 0; i < array.Length; i++) { array2[i] = GraphicOptions.DrawingColorToXnaColor(array[i]); } this.thumbTex = new Texture2D(gd, bitmap.Width, bitmap.Height); this.thumbTex.SetData <Microsoft.Xna.Framework.Color>(array2); File.Delete("c:\\growalone_maps\\thumb.png"); }