ProjectPSX/ProjectPSX.WinForms/Interop/GdiDeviceContext.cs
Pedro Cortés 2f79a50d36
Gdi ()
* Push Interop

* GDI Render: UI

* Gdi: Add BltMode

* Winform GDI: Handle y ranges
This is badly handled and X still left
2021-01-24 12:16:01 +01:00

28 lines
593 B
C#

using System;
using User32 = ProjectPSX.Interop.User32.NativeMethods;
namespace ProjectPSX
{
internal readonly ref struct GdiDeviceContext
{
private readonly IntPtr _handle;
private readonly IntPtr _hdc;
public GdiDeviceContext(IntPtr handle)
{
_handle = handle;
_hdc = User32.GetDC(handle);
}
public void Dispose()
{
User32.ReleaseDC(_handle, _hdc);
}
public static implicit operator IntPtr(GdiDeviceContext dc)
{
return dc._hdc;
}
}
}