示例#1
0
 private static WIC.FormatConverter CreateWicImage(WIC.ImagingFactory2 wic, Stream imageStream, Guid imageFormatGuid)
 {
     using (var decoder = new WIC.BitmapDecoder(wic, imageFormatGuid))
     {
         var decodeStream = new WIC.WICStream(wic, imageStream);
         decoder.Initialize(decodeStream, WIC.DecodeOptions.CacheOnLoad);
         using (var decodeFrame = decoder.GetFrame(0))
         {
             var converter = new WIC.FormatConverter(wic);
             converter.Initialize(decodeFrame, WIC.PixelFormat.Format32bppPBGRA);
             return(converter);
         }
     }
 }