Maximilian Braun wrote: ↑November 5th, 2020, 3:09 pm
1. I know you cant rotate an plugin/widget directly. Sorry. I meant the right thing but wrote the wrong. My Bad.
Alright, no problem. Just take care widgets still don't exist in Rainmeter. They are skins, according to Rainmeter's terminology.
Maximilian Braun wrote: ↑November 5th, 2020, 3:09 pm
2. I would appreciate it if you could show me how to improve my code. I calculated the last two values like in the reference link that i posted under the editor link.
Ok, here is an example Rainmeter code:
Code: Select all
[Rainmeter]
Update=-1
[Variables]
Rot=0
RotationCenterX=([ImageMeter:X]+[ImageMeter:W]/2)
RotationCenterY=([ImageMeter:Y]+[ImageMeter:H]/2)
RotationAngle=30
Angle=0
[MeasureRot]
Measure=Calc
Formula=#Rot#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetVariable Angle "0"][!SetOption MeterRotate Text "Not rotated#CRLF#Click here to rotate."][!UpdateMeter "ImageMeter"][!UpdateMeter "MeterRotate"][!Redraw]
IfFalseAction=[!SetVariable Angle "#RotationAngle#"][!SetOption MeterRotate Text "Rotated with #RotationAngle# degrees#CRLF#Click here to unrotate."][!UpdateMeter "ImageMeter"][!UpdateMeter "MeterRotate"][!Redraw]
DynamicVariables=1
[ImageMeter]
Meter=Image
SolidColor=255,240,0
AntiAlias=1
X=40
Y=75
W=200
H=150
DynamicVariables=1
TransformationMatrix=(Cos(Rad(#Angle#)));(-Sin(Rad(#Angle#)));(Sin(Rad(#Angle#)));(Cos(Rad(#Angle#)));(#RotationCenterX#-#RotationCenterX#*Cos(Rad(#Angle#))-#RotationCenterY#*Sin(Rad(#Angle#)));(#RotationCenterY#+#RotationCenterX#*Sin(Rad(#Angle#))-#RotationCenterY#*Cos(Rad(#Angle#)))
[MeterRotationCenter]
Meter=Image
SolidColor=255,0,0
X=(#RotationCenterX#-1)
Y=(#RotationCenterY#-1)
W=3
H=3
DynamicVariables=1
[MeterRotate]
Meter=STRING
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
DynamicVariables=1
LeftMouseUpAction=[!SetVariable Rot "(1-#Rot#)"][!UpdateMeasure "MeasureRot"][!UpdateMeter "MeterRotate"][!Redraw]
Hidden=0
See that here you have a yellow rectangle. When you load / refresh the skin, the rectangle is unrotated. A string in the upper left corner shows the status. If you click this string, you get the rectangle rotated with a number of degrees set on the RotateAngle variable (into the [Variables] section). Into the same [Variables] section you can modify the RotationCenterX and RotationCenterY variables, which are the coordinates of the rotation center. In the above code these are set to
RotationCenterX=([ImageMeter:X]+[ImageMeter:W]/2) and
RotationCenterY=([ImageMeter:Y]+[ImageMeter:H]/2), which represint the center of the image (of the yellow rectangle), no matter where do you place it.
Now in the code of your tool what should you modify in my opinion, is to add two other fields beside the rotation angle, where the user should have to add the coordinates of the rotation center. Then in the calculation of the returned TransformationMatrix option you should use these coordinates. Into the TransformationMatrix option of the above code, these are the
#RotationCenterX# and
#RotationCenterY# variables, these should be replaced by the values added to the fields of the coordinates of the rotation center (the two fields I talked about above).
I don't know in which language have you wrote the code of your tool, but probably doesn't even matter too much, because I anyway don't know any of those languages used to write such tools. But if you try to modify the code of your tool, I hope you'll be able to take into account what have I described above.
If any question arrises, please come back and post it here. If I can I'm gonna answer them.
Great work, congratulations for it again.