Guillaume wrote: > > Wouldn't it be quick and easy to read the value of the pixel in > > the QCanvasPixmap at the coordinates of the mouse button double-click. > > If the pixel value is black/blue, then the user has hit a note, a stem or a > > flag, > > Or a staff line...
Not in the scheme I was thinking about. I imagine a separate pixmap being used to render the notes, flags and stems (excluding other objects like staff lines) in each set of "concurrent notes" (a concept that includes tied chorded notes, untied chords, and single notes, accidentals -- it contains related objects that define pitch and duration for a single time). The pixmaps would be cached, for efficiency, for each new unique set of concurrent notes that is created during notation editor sessions (font sizes can be handled too). The coordinates of a double click are translated into the cached pixmap's coordinates, using the known offset of the cached pixmap as equivalently rendered in the scrollable canvas window, and the pixel value is looked up there. Staff lines etc are thus not a problem. It may not correspond to the current implementation. It's just an idea for solving the problem of the capture zone around tied chorded notes being much too big. The cached pixmaps could, but not necessarily should, also be used for rendering the scrollable canvas pixmap at the same time as other objects are rendered on the canvas including staffs, etc. > > If the pixel value is non-black/blue (grey/white background), then the user > > has hit the background, > > Or very near the note, and we need some kind of threshold. Yes, although it probably wouldn't matter much if you ignored the anti-aliased pixel values, and required users to double-click on the notes themselves instead of also on their anti-aliased perimeters. The anti-aliasing perimeter zone should in any case be only a 1-pixel wide which is small compared to the note size. It would be easy to set a reliable threshold distance using one threshold for black notes and one threshold for blue notes (in an appropriate colorspace) such that anti-aliased pixel values are detected as well as the notes themselves. I haven't seen the background paper texture Silvan mentioned; it'd be a problem only if the range of texture pixel values overlapped the anti-aliased note pixel values. Even if the ranges did overlap, it would simple to detect and reject a texture pixel on the basis that two or three adjacent pixel values around a texture pixel would look different to the pixel values of adjacent pixels in or near notes. Looking up and comparing pixel values is extremely quick, requiring only three or four machine instructions. > > Wouldn't this work and be easy to implement? > > Not really, that's not how the QCanvas works : it computes the collisions, > not us. Isn't that the problem? QCanvas, or maybe the way it's being used, apparently has the limitation that collisions are detected inside a capture zone which is much too large around tied chorded notes. What's your preferred way of reducing the capture zone in such cases? Silvan wrote: >It would also be somewhat embarrassing to go back to the technology I used >when writing my first stupid little game for the TRS-80 Color Computer, I >think. :) If you did weird things to your poor old TRS-80 I should keep it quiet! For people who are familiar with image processing, it just looks like a trivial method of solving the overly large capture zone problem. Guillaume wrote: > > Which .cpp file has the code for detecting and reacting to a user's > > double-click on a canvas? > > notationcanvasview.cpp. Better look at Qt's 'canvas' sample (and QCanvas > documentation) for a start. Thanks. I'll take a look. Which .ccp file has the code for selecting and highlighting notes in blue when a user drags the mouse button one to define a rectangular selection zone? William ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Rosegarden-devel mailing list [EMAIL PROTECTED] - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
