Skip to content

Commit 2b4f395

Browse files
committed
public new API CreateBitmapFromHBitmap
1 parent de8e4da commit 2b4f395

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/D2DLibExport/D2DDevice.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ public D2DLayer CreateLayer()
177177
[DllImport("gdi32.dll")]
178178
public static extern bool DeleteObject(IntPtr obj);
179179

180+
public D2DBitmap CreateBitmapFromHBitmap(HWND hbmp, bool useAlphaChannel)
181+
{
182+
HANDLE d2dbmp = D2D.CreateBitmapFromHBitmap(this.Handle, hbmp, useAlphaChannel);
183+
return d2dbmp == HANDLE.Zero ? null : new D2DBitmap(d2dbmp);
184+
}
185+
180186
public D2DBitmap CreateBitmapFromGDIBitmap(System.Drawing.Bitmap bmp)
181187
{
182188
bool useAlphaChannel =

0 commit comments

Comments
 (0)