Add API to create wxGraphicsContext from win32 HDC

Add wxGraphicsContext::CreateFromNativeHDC() and wxGraphicsRenderer::
CreateContextFromNativeHDC() to allow creation not only from native
renderer object, but also from HDC, which is something universally
supported by win32 implementations.
This commit is contained in:
Václav Slavík
2017-01-05 17:05:11 +01:00
committed by Václav Slavík
parent e99abe513a
commit e71be91ebe
6 changed files with 59 additions and 0 deletions

View File

@@ -4346,6 +4346,8 @@ public :
wxGraphicsContext* CreateContextFromNativeWindow(void* window) wxOVERRIDE;
wxGraphicsContext * CreateContextFromNativeHDC(WXHDC dc) wxOVERRIDE;
wxGraphicsContext* CreateContext(wxWindow* window) wxOVERRIDE;
#if wxUSE_IMAGE
@@ -4486,6 +4488,11 @@ wxGraphicsContext* wxD2DRenderer::CreateContextFromNativeWindow(void* window)
return new wxD2DContext(this, m_direct2dFactory, (HWND)window);
}
wxGraphicsContext* wxD2DRenderer::CreateContextFromNativeHDC(WXHDC dc)
{
return new wxD2DContext(this, m_direct2dFactory, (HDC)dc, wxSize(0, 0));
}
wxGraphicsContext* wxD2DRenderer::CreateContext(wxWindow* window)
{
return new wxD2DContext(this, m_direct2dFactory, (HWND)window->GetHWND());