GUI & Image Mapping Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

GUI & Image Mapping

10 May 2021, 02:46

Greetings!

I created a montage in Photoshop. This is a single image file that contains 24 different fighting game characters and 5 different button snippets I want to use in my AHK Gui, based on the active tab. Can I specify coordinates and dimesnsions of a button or a fighter within this image to display as my background in the AHK GUI?

Or is AHK only capable of displaying the entire file as background?

I would much rather work with a single image file, instead of keeping track of 20+ seperate image files.

The entire image canvas size is 4000 x 4000 pixels.
Now, say the button snippet is located at x1000 y200, dimensions 90w by 15h.
Can AHK filter just that button for my GUI background?

Thanks.
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: GUI & Image Mapping

10 May 2021, 03:15

You could work around as follows:

Code: Select all

Gui, Add, Text, x1000 y200 w90 h15 BackgroundTrans gButtonSnippet
;...

ButtonSnippet:
;...
Return
Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: GUI & Image Mapping

11 May 2021, 13:06

Thanks, Skan!

But I image with this workaround, the button cannot be moved to the top of the GUI, or elsewhere.
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: GUI & Image Mapping

11 May 2021, 13:48

Ok, I don't want to suggest something silly, again.
You need to clarify.

You have a 4000x4000 image.
You want to crop a piece of it and use it as GUI background?
Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: GUI & Image Mapping

11 May 2021, 16:27

SKAN wrote:
11 May 2021, 13:48
Ok, I don't want to suggest something silly, again.
You need to clarify.

You have a 4000x4000 image.
You want to crop a piece of it and use it as GUI background?
I have multiple buttons in the image file that I want to place at the top of the GUI. One of the buttons I want at coordinates x10 y10 of the GUI. The character button. The 2nd button is called profile, and I want it at x50 y10 of the GUI. Third button is going to be Stats, which I want located x100 y10 of the GUI. And the 4th button is configuration. Of course, the location of these buttons aren't at the coordinates specified, since they are a small part of a single, larger image. I also have comic characters in this image file, that I also want to display in the background depending on which tab is active.
Each button is for a specific tab. The collection of button snippets start at x1000 y200 of the whole image.

Not only do I wish to crop, but to change the XY of the button as well. The button will only be the background of the actual active tab, not the entire GUI.

I want to do this, as opposed to loading all the buttons as it's own separate image. (ie character_button.jpg / profile_button.jpg / configuration_button.jpg)
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: GUI & Image Mapping  Topic is solved

11 May 2021, 16:40

It is not an easy task. You need to use GdiPlus for cropping. Search the forum for GDI+ library.
Galaxis
Posts: 73
Joined: 04 Feb 2016, 20:09

Re: GUI & Image Mapping

12 May 2021, 07:52

Okidoki. I have the GDIP library already. Just thought it might have been possible with AHK by default. I'll use that then. Thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 207 guests