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

@@ -553,6 +553,8 @@ public :
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) wxOVERRIDE;
virtual wxGraphicsContext * CreateContextFromNativeHDC(WXHDC dc) wxOVERRIDE;
virtual wxGraphicsContext * CreateContext( wxWindow* window ) wxOVERRIDE;
#if wxUSE_IMAGE
@@ -2409,6 +2411,12 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContextFromNativeWindow( void * win
return new wxGDIPlusContext(this,(HWND) window);
}
wxGraphicsContext * wxGDIPlusRenderer::CreateContextFromNativeHDC(WXHDC dc)
{
ENSURE_LOADED_OR_RETURN(NULL);
return new wxGDIPlusContext(this, new Graphics((HDC)dc));
}
wxGraphicsContext * wxGDIPlusRenderer::CreateContext( wxWindow* window )
{
ENSURE_LOADED_OR_RETURN(NULL);