I want just know how开发者_运维知识库 Adobe makes Photoshop cross-platform? I know Photoshop is written completely in C++, but what about the GUI? Does Adobe use GUI toolkits?
For any natively compiled, cross-platform project, the solution is typically to have small portions of the code called "wrappers" written exclusively for specific platforms. These wrappers do all the talking directly to the platform.
This makes an app like Photoshop multi-platform, but it wouldn't necessarily build on a platform that Adobe hasn't written wrappers for.
Writing cross platform software is tedious but here are the simple rules.
Generally you need to work with an abstraction of the underlying OS / environment, so that your code depends on this abstraction instead of the OS itself. This is called a bridge pattern. It is important to understand the more features you add to the bridge between your program and the OS the more difficult it will be to port the software. In the case of Adobe they use a relatively small part of the OS (tiny bridge) as they have their own UI and text processing so they just need to capture mouse/keyboard input and be able to draw in a window.
精彩评论