public static Bitmap BetterDDSCheck(abstractTexInfo tmpTex, byte[] imgData) { Bitmap retval = null; using (ResILImageBase img = ResILImageBase.Create(imgData)) { tmpTex.NumMips = img.Mips; tmpTex.Format = img.SurfaceFormat.ToString(); if (tmpTex.Format == "None") { if (((ResILImage)img).MemoryFormat == ResIL.Unmanaged.DataFormat.RGBA) tmpTex.Format = "ARGB"; } try { retval = img.ToWinFormsBitmap(); } catch (Exception e) { Console.WriteLine(e.Message); } } return retval; }
public static Bitmap DDSCheck(abstractTexInfo tmpTex, byte[] data) { DDSPreview dds = new DDSPreview(data); tmpTex.NumMips = (int)dds.NumMips; tmpTex.Format = dds.FormatString; byte[] datat = dds.GetMipData(); Bitmap retval = DDSImage.ToBitmap(datat, (dds.FormatString == "G8") ? DDSFormat.G8 : dds.Format, (int)dds.Width, (int)dds.Height); dds = null; return retval; }