Am 16.11.2008, 07:49 Uhr, schrieb Marcos Duarte <[EMAIL PROTECTED]>:
I am new to python and wxpython but I want to develop an application which basically consists of opening a few images (mostly photos, not svg), to be able to do some transformations (scale, rotation), zoom, panning, to select coordinates (after spatial calibration) with the mouse, draw points and lines on the images, and other stuff. I've been playing with both floatcanvas & floatcanvas2 demos and up to now either one sounds to be the perfect library for me (but I'd appreciate any comments).
I am not sure whether FloatCanvas1 can handle images which are rotated and zoomed at the same time, maybe Chris will answer this.
What is the current status of floatcanvas2? Is it mature for use (considering my needs above)?
It works quite well on windows, but other platforms like mac and gtk have problems which render it unusable at this time. If you are on windows and take a look at the fc2 demos (checkout floatcanvas2 from svn [1] and open demo.py in the floatcanvas2\demo folder) you can see what it can do and how it is done. It provides most of the basic functionality and more. Currently there are issues if you want lines to have a constant-size on screen (no matter what zoom level you are at), because the wx.GC backend doesn't allow for floating point line/font/... sizes. Robin Dunn has written a graphics context which uses the Cairo rendering library internally and has the same api has wx.GC (all floating point values). From what I gathered so far this looks like we could replace wx.GC with the cairo version of it. However it seems text rendering and fonts are not yet implemented. Replacing wx.GC with the cairo GC would probably need some testing, but it seems it's able to make floatcanvas2 work without the problems and on all platforms. Of course you'd need to install cairo on windows then to make it work.
It sounds floatcanvas2 is going to be the official library soon. If so, I'd prefer to program with this library since the beginning but I am afraid that some functionality I might need in the next months is not implemented in floatcanvas2 yet.
Yes, as stated above there are some things that don't work. If you are on windows and don't need constant-screen-sized lines fc2 should be usable for your task. If you are on GTK, things don't look too well, because in addition to the wx.GC problems there are problems with wx.MemoryDC and alpha bitmaps. Your safest bet is FloatCanvas1 of course, because it has been in operation much longer and doesn't push the edges of things like wx.GC.
I don't think it is going to be difficult for me (given that you did very nicely the hard work), but a high level class/demo for selecting coordinates on the canvas with the mouse (with the possibility of drawing different object/marker/color/size on the coordinates and to select/erase/move these points) would be a nice addition to floatcanvas, at least for me...
I think both FloatCanvasses provide the ability to do this. In fc2 you can call canvas.pointToWorld( mouse_pos ) which will return the position in world coordinates of the location you're currently pointing add. Adding a new line at this point is then simply a matter of doing canvas.createLine( startPoint, endPoint, ... ). Instead of calling pointToWorld yourself you can instead use the fc2 event handling for this. It enables you to paint lines easily onto the canvas. I've just added a new demo to the fc2 svn showing exactly this, it is called "Simple line drawer". I've attached the code in case you are curious. It's really short and understandable :-) If you want to know more about input events, see the fc2 demo "Events and input handling".
So in essence I can't tell you whether you want fc1 or fc2. It all depends on your needs (which platform(s) are you on? do you want reliability? do you want antialiased images? do you want to have serialization built in? do you need constant sized lines? what can fc1 do?).
My suggestion is to give fc2 a quick try if you are on windows (just run the demo). You should be able to modify one of the demo examples in such a way that it does what you want it to do (rotating/scaling/moving objects like bitmaps is already included in the demo - try the toolbar, the line drawer is there as well). You'd only have to show a dialog box so you can specify the photo which to load. I think this won't take you longer than an hour or maybe two. If you are not satisfied with it, report your problems here and try fc1.
Thanks for your interest in FloatCanvas, -Matthias[1] checkout from http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/branches/FloatCanvas/SOC2008_FloatCanvas
SimpleLineDrawer.py
Description: Binary data
_______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
