[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Can't draw images alpha AND stretch...

Can't draw images alpha AND stretch...

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1  2 

Posted by Asmodeusbrooding   (22 posts)  [Biography] bio
Date Reply #15 on Fri 04 Nov 2022 08:25 AM (UTC)
Message
Nick Gammon said:

Quote:


WindowMergeImageAlpha(visibleWindow, alphaImageId, "alphaMaskId", 128, 128, 192, 192, 0, 1, 0, 0, 0, 0);
      -- This is the one that works
      WindowMergeImageAlpha(visibleWindow, "alphaImageId", "alphaMaskStretchedId", 64, 128, 128, 192, 0, 1, 0, 0, 0, 0);



Once again you are confusing me. Is this intentional? You have alphaImageId in the first line and "alphaImageId" in the second line.

alphaImageId contains "chest". Your use of quotes and non-quotes for what looks like an identical variable (however with different contents) looks like a typo. Can you at least be consistent? Always use variables, and not literal quotes inside these function calls.



Hey Nick, I didn't write this, my friend did. I'm sorry if it's not ideal. I did test it and it worked, and also in my own testing you'd sometimes get errors for using variables and not strings in those functions so that's probably why it was used, but you'd know better than I would about it.

I can fix that string for you to test.
[Go to top] top

Posted by Fiendish   USA  (2,513 posts)  [Biography] bio   Global Moderator
Date Reply #16 on Sat 05 Nov 2022 08:04 PM (UTC)

Amended on Sat 05 Nov 2022 08:35 PM (UTC) by Fiendish

Message
Quote:
Hey Nick, I didn't write this, my friend did.

The first step then, IMO, is to read it line by line and understand what it's doing (not what someone thinks it's supposed to be doing, but what it's actually doing). Ask your friend to walk you through it if needed.

Because Nick is right. Assigning the string "chest" to a variable named alphaImageId and then also using a string "alphaImageId" looks like the product of a muddled thought process that doesn't know why a string and a variable are different. And if it's not, then an explanation for what the author is thinking would help.


With that said...

Nick, I think Asmodeusbrooding is just confused about the relationship between a transformation matrix and a target size and would benefit from a way to do the resize given a target width/height or right/bottom instead of a transformation matrix.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,966 posts)  [Biography] bio   Forum Administrator
Date Reply #17 on Sun 06 Nov 2022 12:18 AM (UTC)

Amended on Sun 06 Nov 2022 12:22 AM (UTC) by Nick Gammon

Message
Fiendish said:

Nick, I think Asmodeusbrooding is just confused about the relationship between a transformation matrix and a target size and would benefit from a way to do the resize given a target width/height or right/bottom instead of a transformation matrix.


OK, well, the transformation matrix really only needs two numbers to be changed. In my examples on the earlier page I used 0.5 and 0.8 (in two places, one for X and one for Y).

So, if you zoom in and the map squares are 1.5 times as large, then you need to transform the chest by 1.5 (make it 1.5x larger so it is the same size relative to the map square).

Plus, since all the squares are now 1.5 times further apart, then the X and Y offset will also need to be multiplied by 1.5, thus placing it in the correct position.

Likewise for any other zoom multiplier.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,966 posts)  [Biography] bio   Forum Administrator
Date Reply #18 on Sun 06 Nov 2022 12:26 AM (UTC)
Message
You can convert map square sizes to a multiplication factor like this:

Say the map square are initially 40 x 60 pixels. Now you zoom in and they are 80 x 120 pixels. So, the multiplication factor is clearly 2:

80 / 40 = 2
120 / 60 = 2

So your "matrix multiplication" factor will be 2x whatever-it-was to get the chest the right size in the first place.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,966 posts)  [Biography] bio   Forum Administrator
Date Reply #19 on Sun 06 Nov 2022 12:31 AM (UTC)
Message
See http://www.gammon.com.au/scripts/doc.php?function=WindowTransformImage



-- for scaling
WindowTransformImage (win, imageid, X_Translate, Y_Translate, miniwin.image_transparent_copy, X_Scale, 0, 0, Y_Scale) 


So you plug those figures into WindowTransformImage to get the correct translation (movement sideways) and scale (size).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


15,621 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]