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

@@ -2823,6 +2823,11 @@ public :
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) wxOVERRIDE;
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) wxOVERRIDE;
#ifdef __WXMSW__
virtual wxGraphicsContext * CreateContextFromNativeHDC(WXHDC dc) wxOVERRIDE;
#endif
#if wxUSE_IMAGE
virtual wxGraphicsContext * CreateContextFromImage(wxImage& image) wxOVERRIDE;
#endif // wxUSE_IMAGE
@@ -2961,6 +2966,14 @@ wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeWindow( void * windo
#endif
}
#ifdef __WXMSW__
wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeHDC(WXHDC dc)
{
ENSURE_LOADED_OR_RETURN(NULL);
return new wxCairoContext(this, (HDC)dc);
}
#endif
#if wxUSE_IMAGE
wxGraphicsContext * wxCairoRenderer::CreateContextFromImage(wxImage& image)
{