By the way, If you do add rotation to bitmaps, I'll probably want to add it to FC as a regular feature. So let me know how it works out.
-CHB On Mon, Jun 22, 2015 at 12:03 PM, Chris Barker <[email protected]> wrote: > Note: I've cc-d this to the floatcanvas mailing list: > > http://mail.paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas > > please keep the conversation there, so it will get archived. > > It is a VERY low traffic list! > > > Hi Michael, > > Glad you're finding FC useful! > > I'm currently a CS student for Utah State University and I'm working with >> the Utah Water Research Lab on this project >> <https://github.com/Castronova/EMIT>, where we're using wxPython and >> your wonderful project, FloatCanvas. I'm not a hydrologist, and I'm fairly >> new on this project so I'm not quite sure what our project is entirely for. >> Needless to say though, it's going to help the University's research. >> > > at a glance it does look pretty cool. > > >> One of the things I've been assigned is to improve the UI a bit. Here's >> our FloatCanvas part of the application: >> >> [image: Inline image 1] >> >> Unfortunately the way this spline is being drawn (the folks who wrote >> this didn't realize that there was an existing spline object in >> floatcanvas) is very inefficient. >> > > at a glance, I saw a bunch of code for drawing the arrow -- did you look > at the code for the Arrow and ArrowLIne objects? > > but it looks like you may want to use a bitmap for the arrow anyway -- it > does let you make it prettier. > > > >> When these boxes are dragged around, we get major frame-rate drops. >> Luckily I've been able to begin the work on sorting this out to improve >> dragging-and-dropping, and one of the things I'm struggling with is knowing >> what to do about rotating a bitmap. I have this icon here: >> >> [image: Inline image 2] >> >> I would like this PNG to replace the arrow you see above in the main >> screenshot. However, this requires us to rotate the bitmap as these boxes >> are dragged around. >> > Currently I don't think there's a way to do this in FloatCanvas. >> > > nope -- I only supported axis-aligned bitmaps so far. > > The best solution I can come up with for now is to remove, and rotate the >> icon as a wxImage, and then re-add it on each frame draw. I'm not sure this >> is the best way of doing it though, and I thought I'd reach out to you and >> get your opinion on the matter. >> > > yeah, you should be able to do better. > > You probably don't want the arrow to change size as you zoom, so you are > likely using a Bitmap object. > > But take a look at the ScaledBitmap object code to get an idea: > > it stores a wx.Image object. > > In the _Draw method, it scales the Image, then draws it. > > Note that it caches the scaled version, so that it doesn't need to > re-scale unless the size changes. > > So: I'd subclass, or simply copy the Bitmap object, and add an attribute > for rotation angle, then write a _Draw method that does the rotation on the > fly, similarly to how the ScaledImage object does the re-scaling. > > That should be pretty fast, and if you cache the rotated bitmap, then it > will be blazingly fast when the angle hasn't changed. > > Also -- once you' > ve got that working, I'd either: > > Make a Group object that puts teh line and the arrow together. > > or > > make Custom DrawObject that draws both the line and the arrow. > > I always intended it to be easy to write your own DrawObjects -- but never > documented it very well... > > Do take a look at: > > http://trac.paulmcnett.com/floatcanvas > > if you haven't already -- there are a few examples there. > > And I hope you've found the examples in the demos dir in teh source: > > http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/FloatCanvas/Demos/ > > There is a lot there! > > -Chris > > > > > > > -- > > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > [email protected] > -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected]
_______________________________________________ FloatCanvas mailing list [email protected] http://mailman.paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas
