Ejemplo n.º 1
0
        public virtual void Dispose()
        {
            _d2dFactory?.Dispose();
            DWriteFactory?.Dispose();
            WicFactory.Dispose();
            WicFormatConverter.Dispose();

            WhiteBrush.Dispose();
            RedBrush.Dispose();
            DeviceContext?.Dispose();
            _d2dDevice?.Dispose();
        }
Ejemplo n.º 2
0
 private Bitmap LoadBitmap(string path)
 {
     using (WicBitmapDecoder decoder = ImagingFactory.CreateDecoder(ImagePath, Guid.Empty, DesiredAccess.Read, DecodeOptions.MetadataCacheOnDemand))
     {
         using (WicBitmapFrameDecode frame = decoder.GetFrame(0))
         {
             using (WicFormatConverter converter = ImagingFactory.CreateFormatConverter())
             {
                 converter.Convert(frame, WicPixelFormats.PixelFormat32bppPBGRA, BitmapDitherType.None, null, 0, BitmapPaletteType.Custom);
                 return(RenderTarget.CreateBitmap(converter, new BitmapProperties()));
             }
         }
     }
 }