private static Bitmap Decode(byte[] image) { TgaData tga = new TgaData(image); Bitmap bitmap = new Bitmap(tga.Width, tga.Height); for (int y = 0; y < tga.Height; ++y) { for (int x = 0; x < tga.Width; ++x) { if (tga.GetPixel(x, y) == 16777215) { } bitmap.SetPixel(x, y, System.DrawingCore.Color.FromArgb(tga.GetPixel(x, y))); } } return(bitmap); }
protected static Bitmap decode(byte[] image) { TgaData tga = new TgaData(image); Bitmap bitmap = new Bitmap(tga.Width, tga.Height); for (int y = 0; y < tga.Height; ++y) { for (int x = 0; x < tga.Width; ++x) { bitmap.SetPixel(x, y, Color.FromArgb(tga.GetPixel(x, y))); } } return(bitmap); }
private static Image Decode(byte[] image) { TgaData tga = new TgaData(image); var bitmap = new Image <Argb32>(tga.Width, tga.Height); for (int y = 0; y < tga.Height; ++y) { for (int x = 0; x < tga.Width; ++x) { unchecked { bitmap[x, y] = new Argb32((uint)tga.GetPixel(x, y)); } } } return(bitmap); }
protected static byte[] decode(byte[] image) { TgaData tga = new TgaData(image); //return tga.ColorData; //Bitmap bitmap = new Bitmap(tga.Width, tga.Height); using MemoryStream memoryStream = new MemoryStream(); for (int y = 0; y < tga.Height; ++y) { for (int x = 0; x < tga.Width; ++x) { //bitmap.SetPixel(x, y, Color.FromArgb(tga.GetPixel(x, y))); memoryStream.WriteAsync(BitConverter.GetBytes(tga.GetPixel(x, y))); } } return(memoryStream.ToArray()); }