开发者

Direct2D fallback to GDI in XP

开发者 https://www.devze.com 2022-12-13 00:27 出处:网络
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 fallb

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号