Skip to content

Commit de8e4da

Browse files
committed
some APIs refactoring
1 parent d1c490f commit de8e4da

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

src/D2DLibExport/D2DDevice.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,6 @@ public D2DBitmap CreateBitmapFromMemory(UINT width, UINT height, UINT stride, In
169169
return d2dbmp == HANDLE.Zero ? null : new D2DBitmap(d2dbmp);
170170
}
171171

172-
public D2DBitmap CreateBitmapFromGDIBitmap(System.Drawing.Bitmap bmp)
173-
{
174-
bool useAlphaChannel =
175-
(bmp.PixelFormat & System.Drawing.Imaging.PixelFormat.Alpha) == System.Drawing.Imaging.PixelFormat.Alpha;
176-
177-
return this.CreateBitmapFromGDIBitmap(bmp, useAlphaChannel);
178-
}
179-
180172
public D2DLayer CreateLayer()
181173
{
182174
return new D2DLayer(D2D.CreateLayer(this.Handle));
@@ -185,6 +177,14 @@ public D2DLayer CreateLayer()
185177
[DllImport("gdi32.dll")]
186178
public static extern bool DeleteObject(IntPtr obj);
187179

180+
public D2DBitmap CreateBitmapFromGDIBitmap(System.Drawing.Bitmap bmp)
181+
{
182+
bool useAlphaChannel =
183+
(bmp.PixelFormat & System.Drawing.Imaging.PixelFormat.Alpha) == System.Drawing.Imaging.PixelFormat.Alpha;
184+
185+
return this.CreateBitmapFromGDIBitmap(bmp, useAlphaChannel);
186+
}
187+
188188
public D2DBitmap CreateBitmapFromGDIBitmap(System.Drawing.Bitmap bmp, bool useAlphaChannel)
189189
{
190190
HANDLE d2dbmp = HANDLE.Zero;

src/D2DLibExport/D2DLib.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,6 @@ public static extern void DrawBitmapRenderTarget([In] HANDLE context, HANDLE bit
9595
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
9696
public static extern void DestroyBitmapRenderTarget([In] HANDLE context);
9797

98-
public static D2DBitmap CreateBitmapFromGDIBitmap(D2DDevice device, System.Drawing.Bitmap bmp)
99-
{
100-
bool useAlphaChannel =
101-
(bmp.PixelFormat & System.Drawing.Imaging.PixelFormat.Alpha) == System.Drawing.Imaging.PixelFormat.Alpha;
102-
103-
return device.CreateBitmapFromGDIBitmap(bmp, useAlphaChannel);
104-
}
105-
106-
public static D2DBitmap CreateBitmapFromGDIBitmap(D2DDevice device, System.Drawing.Bitmap bmp, bool useAlphaChannel)
107-
{
108-
HANDLE d2dbmp = D2D.CreateBitmapFromHBitmap(device.Handle, bmp.GetHbitmap(), useAlphaChannel);
109-
return d2dbmp == HANDLE.Zero ? null : new D2DBitmap(d2dbmp);
110-
}
11198
[DllImport(DLL_NAME, CallingConvention = CallingConvention.Cdecl)]
11299
public static extern HANDLE ResizeContext([In] HANDLE context);
113100

0 commit comments

Comments
 (0)