Ejemplo n.º 1
0
 private static BitmapSource CreateBitmapSourceFromHandle(IntPtr bitmapHandle, IconApi.BITMAP bitmap)
 {
     var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(bitmapHandle, IntPtr.Zero,
         new Int32Rect(0, 0, bitmap.Width, bitmap.Height),
         BitmapSizeOptions.FromWidthAndHeight(bitmap.Width, bitmap.Height));
     bitmapSource.Freeze();
     return bitmapSource;
 }
Ejemplo n.º 2
0
 private static void AllocateBitmapSpace(IntPtr bitmapHandle, ref IconApi.BITMAP bitmap)
 {
     var bufferSize = Marshal.SizeOf(bitmap);
     IconApi.GetObject(bitmapHandle, bufferSize, out bitmap);
 }
Ejemplo n.º 3
0
 private static void FillBitmapBitsIntoHandle(IconApi.BITMAP bitmap)
 {
     var bytes = new byte[bitmap.WidthBytes*bitmap.Height];
     Marshal.Copy(bitmap.Bits, bytes, 0, bytes.Length);
 }