It is currently December 8th, 2021, 6:25 pm

## Visions+ by Sgt. E. V. McKay (Updated)

Weather skins
death.crafter
Rainmeter Sage
Posts: 1208
Joined: April 24th, 2021, 8:13 pm

### Re: Visions+ by Sgt. E. V. McKay (Updated)

Yincognito wrote: July 9th, 2021, 8:38 pm So, in hypothetical code:

Code: Select all

``````...
[Rainmeter]
...
SkinTransformationMatrix=#ScaleX#;0;0;#ScaleY#;0;0
...
...
...
[SomeMeter]
...
TransformationMatrix=SomeMeterTransformationMatrix
...
``````
The actual TM applied to [SomeMeter] would be SkinTransformationMatrix x SomeMeterTransformationMatrix.
I can imagine the complicacy.

For example, if you apply two rotation matrices, one in meter level and one in skin level, meter level TM will be applied correctly.

But...

When applying skin level TM, the position of the meter would have to be changed. And I have feeling that it can not be done just by multiplying two matrices. Correct me if I am wrong.
from the Realm of Death
Yincognito
Rainmeter Sage
Posts: 4108
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Visions+ by Sgt. E. V. McKay (Updated)

death.crafter wrote: July 10th, 2021, 8:20 am I can imagine the complicacy.

For example, if you apply two rotation matrices, one in meter level and one in skin level, meter level TM will be applied correctly.

But...

When applying skin level TM, the position of the meter would have to be changed. And I have feeling that it can not be done just by multiplying two matrices. Correct me if I am wrong.
Well, this is all hypothetical talk and normally the skin level TM would be a scaling one, but although I understand the concern, I don't see why this would be a problem. In the end, the actual coordinates and dimensions of the meter are never changed, by either TM, and all these are in fact point transformations of every point or pixel of the said target (be it skin or meter).

That being said, you can "easily" test this, just like I did: design the 2 rotation matrices (they could be significantly different from each other, say, a clockwise vs a counterclockwise rotation), make sure each of them works as expected at the meter level, then multiply them (the TM guide link above can help with that, until someone - probably me, after all, I am the one mentioning this in the first place - comes up with a matrix multiplication output skin) and apply the resulted TM to the meter to see the effect.

My thinking is that the 1st TM already visually "moves" the points of the meter, virtually changing the outcome's position, so all the 2nd TM would do is apply another transformation to the already moved / repositioned points from the 1st transformation. Now that I said it, it would be interesting to find out if a clockwise and a counterclockwise rotation would cancel each other out if they go by the same "rate", or if the greater between the two will become "dominant" with the difference in rotation "rates" between the two...

Hmm... now I definitely wonder if the Schrödinger cat is dead or alive, just like jsmorley said, haha!
Yincognito
Rainmeter Sage
Posts: 4108
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Visions+ by Sgt. E. V. McKay (Updated)

Ok, I won't pollute this thread anymore with my "what if" scenarios (although technically they are sort of on topic since nobodycares12345 here asked for more or less the equivalent of a skin level, global transformation matrix - obviously without the drawbacks, though that's another story), but just to answer the last question conclusively...

Code:

Code: Select all

``````[Variables]
GlobalW=(600*[#Scale])
GlobalH=(600*[#Scale])
LocalW=(100*[#Scale])
LocalH=(50*[#Scale])
Scale=0.49
LocalStyle=0

[Rainmeter]
Update=25
DynamicWindowSize=1
AccurateText=1

---Measures---

[LocalStyle]
Measure=String
String=#LocalStyle#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^0\$":"TM_Two","^1\$":"TM_Out"
DynamicVariables=1

[Angle1]
Measure=Calc
Formula=((Angle1+1)%360)
DynamicVariables=1

[Angle2]
Measure=Calc
Formula=((Angle2+1)%360)
DynamicVariables=1

---Styles---

; TransformationMatrix [TM in short] multiplication (syntax changes: "zoom" = "scale", "a" = 2nd matrix "x", "b" = 2nd matrix "y")
;
; | zoomx  skewx  movex |   | zooma  skewa  movea |   | zoomx*zooma+skewx*skewb+movex*0  zoomx*skewa+skewx*zoomb+movex*0  zoomx*movea+skewx*moveb+movex*1 |
; | skewy  zoomy  movey | x | skewb  zoomb  moveb | = | skewy*zooma+zoomy*skewb+movey*0  skewy*skewa+zoomy*zoomb+movey*0  skewy*movea+zoomy*moveb+movey*1 |
; |   0      0      1   |   |   0      0      1   |   |     0*zooma+    0*skewb+    1*0      0*skewa+    0*zoomb+    1*0      0*movea+    0*moveb+    1*1 |
;
; In Rainmeter (column by column and separated by ";" order of the above, excluding the 3rd row containing the "0  0  1" values)
;
; 1st matrix: TransformationMatrix=zoomx;skewy;skewx;zoomy;movex;movey
; 2nd matrix: TransformationMatrix=zooma;skewb;skewa;zoomb;movea;moveb
; out matrix: TransformationMatrix=(zoomx*zooma+skewx*skewb);(skewy*zooma+zoomy*skewb);(zoomx*skewa+skewx*zoomb);(skewy*skewa+zoomy*zoomb);(zoomx*movea+skewx*moveb+movex);(skewy*movea+zoomy*moveb+movey)
;
; Hint: copy the out matrix, place its values on different lines, replace operands with the corresponding 1st and 2nd matrix values, regroup lines into one
;
; The code below demonstrates applying a local TM at the meter level (2nd matrix) over a global TM at the skin level (1st matrix) through TM1 x TM2 operation
; - [Background]: dummy meter used to workaround the transformed window / skin size issues mentioned at https://forum.rainmeter.net/viewtopic.php?f=14&t=37848
; - [Global]: meter used to simulate the skin itself and to showcase the 1st matrix transformation, i.e. rotation of a rectangle around the global center
; - [Local]: meter used to showcase both the 2nd and the out matrix transformations, i.e. rotation of a rectangle around its center ± around the global center
; - out matrix uses skin specific coordinates, aka 0 for [#CURRENTSECTION#:X or Y], #CURRENTCONFIGWIDTH# & #CURRENTCONFIGHEIGHT# for [#CURRENTSECTION#:W or H]

[TM_One]

[TM_Two]

[TM_Out]

---Meters---

[Background]
Meter=Image
W=#GlobalW#
H=#GlobalH#
SolidColor=0,0,0,128
UpdateDivider=-1
LeftMouseUpAction=[!SetVariable LocalStyle (1-#LocalStyle#)][!UpdateMeasure LocalStyle][!UpdateMeter *][!Redraw]
MouseScrollUpAction=[!SetVariable Scale (Clamp(#Scale#+0.01,0.01,2))][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable Scale (Clamp(#Scale#-0.01,0.01,2))][!UpdateMeter *][!Redraw]
DynamicVariables=1

[Global]
Hidden=#LocalStyle#
Meter=Shape
MeterStyle=TM_One
W=#GlobalW#
H=#GlobalH#
Shape=Rectangle (#GlobalW#-#LocalW#-(Sqrt(#LocalW#**2+#LocalH#**2)-#LocalW#)/2),(#GlobalH#/2-#LocalH#/2),#LocalW#,#LocalH# | StrokeWidth 0 | Stroke Color 255,255,0,255 | Fill Color 255,255,0,255
DynamicVariables=1

[Local]
Meter=Shape
MeterStyle=[LocalStyle]
X=(#GlobalW#-#LocalW#-(Sqrt(#LocalW#**2+#LocalH#**2)-#LocalW#)/2)
Y=(#GlobalH#/2-#LocalH#/2)
Shape=Rectangle 0,0,#LocalW#,#LocalH# | StrokeWidth 0 | Stroke Color 255,255,0,255 | Fill Color 255,255,0,255
DynamicVariables=1
``````
Preview:
ezgif.com-gif-maker (1).gif
Conclusion: A global skin level TM can be applied to a local meter level TM, by simply multiplying the former with the latter. All explanations and infos are in the skin comments (left click to toggle separate vs combined transformation styles - the first 180 degrees in the preview use the former, while the rest of the 180 degrees use the latter; scroll to scale "normally").
You do not have the required permissions to view the files attached to this post.
balala
Rainmeter Sage
Posts: 13533
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

### Re: Visions+ by Sgt. E. V. McKay (Updated)

Yincognito wrote: July 9th, 2021, 8:38 pm I hope I was clearer this time.
No, actually you were not. What the SkinTransformationMatrix (applied into the [Rainmeter] section) is? Such an option has been discussed a few times later in this topic, for instance here:
death.crafter wrote: July 10th, 2021, 8:20 am When applying skin level TM, the position of the meter would have to be changed.
as well as in your above reply. A such SkinTransformationMatrix option, applied to the [Rainmeter] section is not valid (unless I'm missing something - but to be honest I doubt I do).
Yes, I realized TM is the abbreviation of Transformation Matrix, but what I didn't understand was what the skin level TransformationMatrx does mean.
death.crafter
Rainmeter Sage
Posts: 1208
Joined: April 24th, 2021, 8:13 pm

### Re: Visions+ by Sgt. E. V. McKay (Updated)

balala wrote: July 10th, 2021, 6:25 pm No, actually you were not. What the SkinTransformationMatrix (applied into the [Rainmeter] section) is? Such an option has been discussed a few times later in this topic, for instance here:

as well as in your above reply. A such SkinTransformationMatrix option, applied to the [Rainmeter] section is not valid (unless I'm missing something - but to be honest I doubt I do).
Yes, I realized TM is the abbreviation of Transformation Matrix, but what I didn't understand was what the skin level TransformationMatrx does mean.
He is referring to a hypothetical situation.

Let SkinTransformationMatrix exists.

Then is it possible to apply it to every meter in a skin if there was. Well the answer is a big no, but, well, he got it partially working.

But since TM doesn't apply to boundaries, it can not be implemented on a skin level, considering containers and such things.
from the Realm of Death
balala
Rainmeter Sage
Posts: 13533
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

### Re: Visions+ by Sgt. E. V. McKay (Updated)

death.crafter wrote: July 10th, 2021, 8:20 am When applying skin level TM, the position of the meter would have to be changed. And I have feeling that it can not be done just by multiplying two matrices. Correct me if I am wrong.
As I posted in my above reply as well, still not clear what the "skin level TransformationMatrix" does mean. Transformation matrices can be applied ONLY to meters, but there you can apply as many such transformation matrices as you want, by simply multiplying all of them together.
On the other hand when you apply a transformation matrix to a meter, it's change is relatively to the origin of the skin (the top left corner OF THE SKIN), NOT THE ORIGIN (top left corner) OF THE METER:
Every transformation you do will always be relative to the origin. That's the point with coordinates (0,0). Normally, that would be the top-left corner of your object. However, according to Rainmeter, the origin will always be the top-left corner of the entire skin.
(see the "What the heck is Rainmeter doing?!" section of the Transformation Matrix Guide).
That's why you have to move the result of the transformation (the transformed meter), by the last two terms of the transformation matrix (noted by tx and ty in the guide), to get it where you want it to be. Calculation their values usually is the most complicated thing in writing a correct transformation matrix.

Transformation matrix is definitely one of the most complex options, but in the same time is also one of the most powerful. I definitely am a great fan of it, it helped me many times. It's only disadvantage is the fact that once applied it doesn't move the click / mouse over section of the meter, it is kept in the not transformed position / size.
balala
Rainmeter Sage
Posts: 13533
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

### Re: Visions+ by Sgt. E. V. McKay (Updated)

death.crafter wrote: July 10th, 2021, 6:45 pm But since TM doesn't apply to boundaries, it can not be implemented on a skin level, considering containers and such things.
As you well figured it out, I suppose it's not exactly possible. Unfortunately...
Yincognito
Rainmeter Sage
Posts: 4108
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Visions+ by Sgt. E. V. McKay (Updated)

balala wrote: July 10th, 2021, 6:25 pmNo, actually you were not. [...] A such SkinTransformationMatrix option, applied to the [Rainmeter] section is not valid (unless I'm missing something - but to be honest I doubt I do).
balala wrote: July 10th, 2021, 6:46 pmAs I posted in my above reply as well, still not clear what the "skin level TransformationMatrix" does mean. Transformation matrices can be applied ONLY to meters, but there you can apply as many such transformation matrices as you want, by simply multiplying all of them together.
Yes, you're missing something: transformation matrices can be applied to ANY point in space - there are even 4x4 matrices that are used in 3D software. The mathematical concept doesn't care whether it's a "skin", "meter" or whatever structure Rainmeter works with or whether it's "valid" for that narrow case - it can literally be applied to ANYTHING that is an "object" in space (2D, 3D, etc), assuming, of course, that a corresponding implementation were to be written. That being said, what you're talking about relates to the current implementation of Rainmeter, in which such an option obviously doesn't exist at the skin level, only at a meter level. That doesn't mean it can't be done at the skin level though, and became "valid" as a result. Nothing in this world is "valid" ... until it is actually built (and then folks take it for granted, forgetting they rated the thing as "unclear", "impossible" and so on beforehand).
death.crafter wrote: July 10th, 2021, 6:45 pmWell the answer is a big no, but, well, he got it partially working. But since TM doesn't apply to boundaries, it can not be implemented on a skin level, considering containers and such things.
Well, maybe my eyesight is faulty, but I see a big yes, since I posted a fully working result as proof. You are correct that there are some exceptions (aren't they always?), but then I didn't see so many folks overly concerned over the SAME issues a transformation matrix ALREADY has with containers, mouse actions or input texts even on a meter level. It's not that "it can not be implemented on a skin level", it's just that doing so will produce the same drawbacks as at a meter level.

Also, bear in mind that I didn't necessarily mean that a skin level transformation / scaling should be done using the current TM approach, see here (similar transformations exist for Shape meters and work much better, by the way - too bad they can't be applied outside shapes). I only took that "skin level TM" under consideration for two reasons: it was available to test it in a simulated environment (even though the option itself doesn't exist) and to answer a question related to whether a skin level transformation would be possible for already transformed meters (which I proved to be possible). The drawbacks or the exceptions you guys mention, well, those are not my responsibility, and they don't make the method / approach itself less valid or possible. In other words, if TM already had 0 drawbacks and exceptions, my approach would have been flawless - correct me if I'm wrong.

P.S. I don't want to put pressure on the devs or criticize their work, to be perfectly clear - I fully understand the difficulty of programming something and having to take care of a thousand things at the same time. My take was just a simple "proof of concept", if you like.
balala
Rainmeter Sage
Posts: 13533
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

### Re: Visions+ by Sgt. E. V. McKay (Updated)

Yincognito wrote: July 10th, 2021, 8:49 pm Yes, you're missing something: transformation matrices can be applied to ANY point in space - there are even 4x4 matrices that are used in 3D software. The mathematical concept doesn't care whether it's a "skin", "meter" or whatever structure Rainmeter works with or whether it's "valid" for that narrow case - it can literally be applied to ANYTHING that is an "object" in space (2D, 3D, etc), assuming, of course, that a corresponding implementation were to be written. That being said, what you're talking about relates to the current implementation of Rainmeter, in which such an option obviously doesn't exist at the skin level, only at a meter level. That doesn't mean it can't be done at the skin level though, and became "valid" as a result. Nothing in this world is "valid" ... until it is actually built (and then folks take it for granted, forgetting they rated the thing as "unclear", "impossible" and so on beforehand).
Right, however as you well said, it CAN'T BE APPLIED NOW for skins. Sorry, but for now end of discussion (from my point of view at least). This discussion doesn't go on in the Bugs & Feature Suggestions section, so doesn't make too much sense (sorry, but this is my opinion).
Yincognito
Rainmeter Sage
Posts: 4108
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

### Re: Visions+ by Sgt. E. V. McKay (Updated)

balala wrote: July 10th, 2021, 9:05 pmRight, however as you well said, it CAN'T BE APPLIED NOW for skins. Sorry, but for now end of discussion (from my point of view at least). This discussion doesn't go on in the Bugs & Feature Suggestions section, so doesn't make too much sense (sorry, but this is my opinion).
Oh, finally, the "end of discussion".
You're right, it can't be applied now for skins, and a Bugs & Feature Suggestions section talk about this would have had exactly the same outcome. I guess it's much easier to dismiss an approach from someone who at least tries, than finding solutions for issues preventing proper application.