Select and move graphic elements over background image? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Select and move graphic elements over background image?

22 Feb 2022, 06:15

Hi, I'm looking for a way to draw and then move little graphic elements (piano-roll style musical notes) on a background image (the musical staff), to create a simple music editor or 'digital audio workstation', where notes can be moved up and down, left and right, changed, etc. What method would you use to do this? The note images should be capable of blending with the staff according to alpha values rather than just overwriting it.

This will also require a 'cursor' - an indication of which note is selected for editing - which might be done by colouring it or drawing a rectangle or circle around it (another moveable element, perhaps), if you have any tips on that.

I'm using gdip.ahk, of course, thanks @tic. :bravo:

If anyone can write the bare bones of a routine to do any bit of that, describe what I need to do, or link to a script that might help, that would be ace.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Select and move graphic elements over background image?

22 Feb 2022, 06:27

AFAIK, @bichlepa's :arrow: AutoHotflow could give you an idea. Well, I might be wrong. Make up your mind 8-) & good luck :thumbup:
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: Select and move graphic elements over background image?

22 Feb 2022, 07:28

BoBo wrote:
22 Feb 2022, 06:27
AFAIK, @bichlepa's :arrow: AutoHotflow could give you an idea. Well, I might be wrong. Make up your mind 8-) & good luck :thumbup:
Thanks for that, @BoBo. Unfortunately, it's way above my pay grade, especially as the code is in lots of different scripts. I'll need something quite simple for me to understand! Looks like a very interesting project that though.

I was thinking it might be a case of defining 'sprite' images, and that I might have to get my head around 'layered windows', but I'm just guessing from some searches. Even moving these around as sprites will be interesting, because the notes have a shader, indicating how long they play for, and these can be of various lengths and the notehead can be various shapes, so it wouldn't just be a few sprites, as far as I can guess.

I could, of course, just re-draw the whole page of music (or line, if nothing is moved onto another line by the change) every time a note is nudged up or down, etc., but it's rather slow.

I may have to abandon the idea of bumping notes around repeatedly (i.e. if the note was moved up several lines) and just allow the user to select the note and then define where its destination is, or change its horizontal position or length. That way it would only require one re-drawing and speed would be less important.

I'm also forgetting that the slowness I'm seeing is only partly the GDI+ functions - I'm also parsing a text file that has the notes. I'll try reading the values into arrays first (which is how it would work eventually anyway) and re-draw from those. It might not be a problem. Cheers!
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Select and move graphic elements over background image?  Topic is solved

22 Feb 2022, 07:49

Another 'suspect' :silent: that came to mind is YT-channel's CivReborn AKA @Hellbent who is/was into creating AHK games (?) :think:
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: Select and move graphic elements over background image?

22 Feb 2022, 09:34

Excellent, I'll learn a lot from those vids, I reckon.
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: Select and move graphic elements over background image?

22 Feb 2022, 16:00

I've made a few tweaks to my music drawing routines and they're running much faster, and I think I'll go with that, but I do think Hellbent's PopupWindow Class would be another way to go in other circumstances. I watched him demo it on Joe's YT: https://www.youtube.com/watch?v=8D3o2Y5eSR8

Thanks again!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], peter_ahk and 314 guests