public static BitmapFormat DetectFormat(DdsHeader header) { InitInjectionDefinitions(); var definition = new BitmapFormatDefinition { FormatType = header.FormatType, BitsPerPixel = header.BitsPerPixel, RBitMask = header.RBitMask, GBitMask = header.GBitMask, BBitMask = header.BBitMask, ABitMask = header.ABitMask, FourCc = header.FourCc, D3D10Format = header.D3D10Format }; BitmapFormat result; if (!_injectionDefinitions.TryGetValue(definition, out result)) throw new InvalidOperationException("Unsupported pixel format"); return result; }
public static BitmapFormat DetectFormat(DDSHeader header) { InitInjectionDefinitions(); var definition = new BitmapFormatDefinition { BitsPerPixel = header.PixelFormat.RGBBitCount, RBitMask = header.PixelFormat.RBitMask, GBitMask = header.PixelFormat.GBitMask, BBitMask = header.PixelFormat.BBitMask, ABitMask = header.PixelFormat.ABitMask, FourCc = header.PixelFormat.FourCC }; if (!_injectionDefinitions.TryGetValue(definition, out BitmapFormat result)) { throw new InvalidOperationException("Unsupported pixel format"); } return(result); }
public static BitmapFormat DetectFormat(DdsHeader header) { InitInjectionDefinitions(); var definition = new BitmapFormatDefinition { FormatType = header.FormatType, BitsPerPixel = header.BitsPerPixel, RBitMask = header.RBitMask, GBitMask = header.GBitMask, BBitMask = header.BBitMask, ABitMask = header.ABitMask, FourCc = header.FourCc, D3D10Format = header.D3D10Format }; if (!_injectionDefinitions.TryGetValue(definition, out BitmapFormat result)) { throw new InvalidOperationException("Unsupported pixel format"); } return(result); }