Direct2D fallback to GDI in XP
I'd like to use Direct2D for my .Net application using the Windows Code pack. Since some of my users are using XP, I need to provide a GDI+ fallback. I wonder how people usually do this kind of fallback.
Do they abstract/interface all the necessary graphics feature into some custom generic library? If so, is there any open-source开发者_如何学Python library for direct2d/GDI?
Thanks, Gil.
The way I do it is by having two completely seperate classes (both derived from an IRenderer
interface). On load, I determine the operating system version using Window's GetVersionEx
function. If dwMajorVersion >= 6
, then I load the Direct2D class; otherwise it falls back to GDI.
Hope this helps.
You'll have to re-program it in Direct3D if you want it to run as fast.
精彩评论