I'm trying to find a constellation of libraries which, taken together, meet the following requirements:
Smooth scaling, rotation, panning (in two dimensions). I'll have a large bitmap (or SVG, in some cases), maybe up to 10000x10000 pixels, which serves as map, with some middling number of small bitmaps (or, again, possibly SVG) that can be dragged around over it. I need to be able to zoom, rotate, and pan this scene; however, the view will always be normal to (i.e., looking head-on at) the large bitmap, so I'm not really using the depth dimension.
Peer-to-peer. I'd like for multiple users to be able to connect in order to share one of the scenes mentioned above, preferably peer-to-peer, without much configuration by the user. I'm intending to have a server running for cases where users are unable to connect P2P; I'd like to have the failover happen automatically, or possibly have some way of promoting clients who are capable to be servers th开发者_开发百科emselves. No given instance (one scene) is likely to have more than 10 users at once; I don't really need the robustness to handle, say, thousands.
Synchronization. Once a user has started dragging one of the small bitmaps (a piece), no other user should be able to drag that piece until the drag stops. I haven't thought of exactly how to do this---there might be a simple solution, or this kind of synchronization might be something that a library provides.
Cross(ish)-platform. I need to be able to run on Linux, Windows, and Mac OS. It would be nice to also be able to run on tablets. Having mostly the same code for all platforms is a plus, but not absolutely necessary.
(L)GPL compatible. I'm planning to release under the LGPL or GPL, preferably the latter, so I need libraries which have compatible licenses.
I'm not set on any particular language, I'd like to use the library or libraries which make the work easiest, though my preference is to work in at most two languages for the project. (The Model could potentially be in one language and the View in another, so they could talk to each other via some protocol I define, if that would get me a better selection of libraries to use.) Can anyone offer suggestions for what to use?
OpenGL is always an excellent choice for hardware accelerated cross platform 3D/2D rendering. Given the custom nature of your program you may have to implement everything yourself - but once you get the gist of it its pretty easy. Try http://nehe.gamedev.net/ its mostly 3D rendering tutorials, but can easily apply to 2D.
You may have to break up the larger bitmap and store it in smaller tiles, which I would recommend you stream as they become necessary. You may also want to load several surrounding tiles at any time, so the zooming/panning/rotations wouldn't cause any artifacts or loading as the image is manipulated in 2D/3D space.
Let me know if you have any questions.
For peer-to-peer communication you might want to look at our MsgConnect. It's C++ code base for linux and MacOS X is currently available under GPL and we are considering opening other code bases under some open license as well.
精彩评论