1

I'm creating a skin (possibly a set of skins) which I plan to publish at some point. As I was working I ran into an issue with rotating an image meter. Its size is dynamic to a scale variable.

The image is resized when it is rotated. I believe this is due to the diagonal of the image not fitting within the frame of the meter. Although I'm not sure how I can solve the issue.

The Following is the code of the Image Meter:

[icon0]
Meter=Image
ImageName=@Resources\images\gear.png
W=(50*#scale#)
H=(50*#scale#)
X=(5*#scale#)
Y=(5*#scale#)
ImageRotate=90

When the value of "ImageRotate" is changed from 90 to 45 the icon scales down.

I tried to look at an example which created the effect that I wanted, but I couldn't figure it out. I also looked for a forum, or information in the "Rainmeter Manual" to find some useful information. I found something about the ScaleMargin, but it didn't seem to have the effect I wanted.

Thank you in advance for any help that I get.

1 Answers1

0

I think you need to calculate the maximum possible W/H after rotation yourself. Possibly change X/Y too, if you want it to rotate around origin.

There is an example shown here. It uses Rotator meter .

Looking at that example, your code would be like:

[icon0]
Meter=Image
ImageName=@Resources\images\gear.png
W=(SQRT((50*#scale#) ** 2 + (50*#scale#) ** 2))
H=(SQRT((50*#scale#) ** 2 + (50*#scale#) ** 2))
X=(5*#scale#)
Y=(5*#scale#)
ImageRotate=90

Haven't tested it myself, you may need DynamicVariables=1 for #scale#s, and you probably need to calculate X and Y if you want to rotate around the center of the image. Not sure what you want though, I'll leave it to you.

Edit: You may also need DynamicWindowSize=1 under [Rainmeter] section as well. Otherwise it will crop the image after rotation, if it doesn't fit the initial size of the skin.

Sweeney Todd
  • 880
  • 1
  • 11
  • 25
  • Thank you for your help. While that particular bit of code didn't work correctly, it led me to find something that would do what I wanted. [MeterRotate] Meter=Rotator MeasureName=MeasureRotate ImageName=#@#images\gear.png X=([MeterBG:W]/2) Y=([MeterBG:H]/2) OffsetX=(#ImageW#/2) OffsetY=(#ImageH#/2) TransformationMatrix=(1*#Scaler#);0;0;(1*#Scaler#);((1-#Scaler#)*[#CURRENTSECTION#:X]);((1-#Scaler#)*[#CURRENTSECTION#:Y]) DynamicVariables=1 – Dae Ant onetimetwotimes Nov 26 '16 at 19:28