Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Overlaying images: Alpha images
Overlaying images: Alpha images
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Asmodeusbrooding
(22 posts) Bio
|
Date
| Fri 15 Nov 2019 11:45 AM (UTC) Amended on Fri 15 Nov 2019 12:16 PM (UTC) by Asmodeusbrooding
|
Message
| Hey MUSH forum,
There are three images shown in this link:
https://imgur.com/a/mHmDnBM
Image 1. a background image
Image 2. a sword
Image 3. a background image with a sword on top.
I am using terrain tiles in my mapper.
I am trying to be able to overlay Image 2 (sword)
over Image 1 (background image) via code.
I can photoshop these over each other, like Image 3, but I want to be able to slap image 2 over any terrain tile (image)
I am using
WindowDrawImageAlpha (win, "weaponshop", left, top, right, bottom, miniwin.image_stretch)
to load the sword (named weaponshop) over the typical room terrain, and it's loading a sword over the original background, but it's loading a sword with a white background where the box is, not a sword with a transparent background over the normal background image.
I've added an alpha mask to the image, and saved it transparently as well, but the white background remains when loading the image.
Is there a trick to getting this to work?
Would be nice to get it working properly.
I've tried all kinds of stuff in the editing process, not sure why it's appearing with the white background.
I did also try without the miniwin.image_stretch as well..
Thanks for the insight.
I've already used these links as help, but my problem remains:
I've tried changing the final arguments to do opacity. | Top |
|
Posted by
| Fiendish
USA (2,535 posts) Bio
Global Moderator |
Date
| Reply #1 on Fri 15 Nov 2019 04:56 PM (UTC) |
Message
| Can you confirm that MUSHclient detects the image has 32 bits per pixel using WindowImageInfo with selector 6? |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Fiendish
USA (2,535 posts) Bio
Global Moderator |
Date
| Reply #2 on Fri 15 Nov 2019 05:01 PM (UTC) Amended on Fri 15 Nov 2019 05:02 PM (UTC) by Fiendish
|
Message
| Also instead of using an alpha channel you could set the background to an unused color like perfect magenta and then use WindowDrawImage with mode 3 for chroma key compositing. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #3 on Fri 15 Nov 2019 11:18 PM (UTC) Amended on Fri 15 Nov 2019 11:27 PM (UTC) by Nick Gammon
|
Message
| The image you provided in the link has an alpha channel, but that checkerboard stuff is not transparent. It just "looks" transparent, assuming that image is what you are actually using. See:

I grabbed the erase brush in Gimp and erased some of your checkerboard, so you can see it is just part of the image. The "real" transparent part is under where I erased.
Also can you please provide a (M)inimal (C)omplete (V)erifiable (E)xample)? (MCVE)
Rather than a couple of snippets of the sort of code you used, take a few minutes to make up an actual code segment that we can copy/paste into the Immediate window and test for ourselves.
So, create the miniwindow, load the image files in, then try to draw one on top of the other. Then we can see exactly what you did, and reproduce it immediately. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Asmodeusbrooding
(22 posts) Bio
|
Date
| Reply #4 on Mon 25 Nov 2019 11:17 AM (UTC) |
Message
| I'm not sure how... but today I went to actually commit to fixing this, and somehow magically I tried the command to get the image to load, and it just worked.
I didn't change the code at all, but it suddenly just worked.
Sorry about this, guys... I'm going to have to look more into why it didn't work but suddenly now decides to work, as I seriously didn't touch the code or image at all.
Thanks for the assistance;
I appreciate the insight into MCVE, Nick! | Top |
|
Posted by
| Asmodeusbrooding
(22 posts) Bio
|
Date
| Reply #5 on Mon 25 Nov 2019 12:48 PM (UTC) Amended on Mon 25 Nov 2019 12:53 PM (UTC) by Asmodeusbrooding
|
Message
| Looking at this though, I AM having issues...
It works properly with this code:
WindowDrawImageAlpha (win, "inn", left, top, right, bottom)
But when you zoom in and out of the mapper, the image gets very weird in the way that it becomes off centered, and maybe even out of bounds.
In my WindowDrawImage I had another argument for miniwin.image_stretch
On the documentation page for
I don't see miniwin.image_stretch or a "MODE" as an option, and it doesn't work for me with WindowDrawImageAlpha.
My WindowDrawImage was
WindowDrawImage (win, "inn", left, top, right, bottom, miniwin.image_stretch) -- stretch to fill
Is there a way to emulate this miniwin.image_stretch with WindowDrawImageAlpha so that when I zoom in/out the image stays centered and doesn't get all weird and go out of bounds?
Thanks for the help. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #6 on Tue 26 Nov 2019 05:25 AM (UTC) |
Message
| As I asked above, can you please provide a (M)inimal (C)omplete (V)erifiable (E)xample)? (MCVE).
I don't want to have to guess what you did, and in what way, in an attempt to reproduce your problem. Make up a dozen lines of code that show the problem.
The window image drawing is not designed to both scale (stretch) and merge using an alpha channel in the one operation.
What might work would be to scale first into a temporary (non-visible) window using a transparent pixel colour as described for WindowDrawImage, and then copy that scaled image (using the miniwin.image_transparent_copy option) into your destination window. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
19,873 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top