1
namespace ParasitemiaUI
4 open System.Runtime.InteropServices
6 open System.Windows.Media.Imaging
10 module BitmapSourceConvert =
11 [<DllImport("gdi32")>]
12 extern
int DeleteObject(IntPtr o
);
14 let ToBitmapSource (image
: Image<'TColor, 'TDepth>) : BitmapSource =
15 use source = image
.ToBitmap ()
17 let ptr : IntPtr = source.GetHbitmap ()
19 let bs : BitmapSource =
20 System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap
25 (BitmapSizeOptions.FromEmptyOptions ())
28 DeleteObject ptr |> ignore