Appling TransformationMatrix on a Shape meter

Report bugs with the Rainmeter application and suggest features.

Appling TransformationMatrix on a Shape meter

Hi everyone,

It seems again came the time to ask something. My question is about the TransformationMatrix option, applied to the new Shape meter. Last days I worked with a such meter and wanted to rotate it, using a TransformationMatrix option. On the Transformation Matrix Guide description of the Tips & Tricks section of help, we have a very good description of how to rotate the meters. I applied the described method many time on many kind of meters (especially String and Image). But now, when I tried to use the same method on a Shape meter, it behaved totally different then the String or Image meters.
Let me show you a simple code:

Code: Select all

[Rainmeter]
Update=-1
BackgroundMode=2
SolidColor=80,80,80,160
SkinWidth=300
SkinHeight=300
LeftMouseUpAction=[!CommandMeasure "MeasureFalling" "Execute 1"]

[Variables]
Angle=0
XPos=50
YPos=20
Upd=[!UpdateMeasure "MeasureFalling"][!UpdateMeterGroup "Elements"][!UpdateMeter "MeterAngle"][!Redraw]

[MeasureFalling]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Work,75,10
Work=[!SetVariable Angle "(Clamp((#Angle#+9),0,90))"]#Upd#
DynamicVariables=1

[MeterRotate1]
Meter=Image
SolidColor=255,240,0
X=#XPos#
Y=#YPos#
W=5
H=200
DynamicVariables=1
Group=Elements

[MeterRotate2]
Meter=Shape
Shape=Rectangle 0,0,5,200 | Fill Color 255,0,0 | StrokeWidth 0 | Stroke Color 0,0,0,0
X=0r
Y=0r
DynamicVariables=1
Group=Elements

[MeterAngle]
Meter=STRING
X=5
Y=5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Angle#
DynamicVariables=1

There are two meters with the same size and in the same position: [MeterRotate1] and [MeterRotate2]:

The first is an Image meter, the second one is a Shape meter. They are differently colored, to can distinguish them. When you click to the background of the skin, both meters are rotated with 90 degrees clockwise. But after the rotation the will get different positions. Like they wouldn't be rotated around the same point:

The TransformationMatrix options are similar, so the rotation should be also similar. Why is happening this and how could be made the Shape meter to rotate same way as the Image meter does? Am I missing something obvious?
Although I posted this question here to the Bugs & Feature Suggestions thread, I'm not sure this is a bug. But I couldn't figure out what to do to make the meter to rotate "normally", like an Image meter does, for example, although I can say I have some experience working with the TransformationMatrix option.

Thanks in advance to anyone could help.

Re: Appling TransformationMatrix on a Shape meter

Just asking... Why use TransformationMatrix on a shape meter, it already has transformers?

Using Rotate parameter on the shape and setting the rotation axis point to the height and half the width gives the same results.

Code: Select all

[Rainmeter]
Update=-1
BackgroundMode=2
SolidColor=80,80,80,160
SkinWidth=300
SkinHeight=300
LeftMouseUpAction=[!CommandMeasure "MeasureFalling" "Execute 1"]

[Variables]
Angle=0
XPos=0
YPos=0
Upd=[!UpdateMeasure "MeasureFalling"][!UpdateMeterGroup "Elements"][!UpdateMeter "MeterAngle"][!Redraw]

[MeasureFalling]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Work,75,10
Work=[!SetVariable Angle "(Clamp((#Angle#+9),0,90))"]#Upd#
DynamicVariables=1

[MeterRotate1]
Meter=Image
SolidColor=255,240,0
X=#XPos#
Y=#YPos#
W=15
H=200
DynamicVariables=1
Group=Elements

[MeterRotate2]
Meter=Shape
Shape=Rectangle 0,0,15,200 | Fill Color 255,0,0 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Rotate #Angle#,([MeterRotate1:W]/2),200
X=r
Y=r
DynamicVariables=1
Group=Elements

[MeterAngle]
Meter=STRING
X=5
Y=5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Angle#
DynamicVariables=1

Re: Appling TransformationMatrix on a Shape meter

eclectic-tech wrote:Just asking... Why use TransformationMatrix on a shape meter, it already has transformers?

Thanks eclectic-tech, great help.

However, even so, my question still remains: why a Shape meter behaves differently then any other meter when the TransformationMatrix is applied? Finally the TransformationMatrix isn't limited to the rotation, it can do much much more then rotate the meter. So maybe sometimes still should be used.

Re: Appling TransformationMatrix on a Shape meter

balala wrote:... However, even so, my question still remains: why a Shape meter behaves differently then any other meter when the TransformationMatrix is applied? Finally the TransformationMatrix isn't limited to the rotation, it can do much much more then rotate the meter. So maybe sometimes still should be used.

Perhaps one of Devs can weigh in on that.

It has something to do with the X & Y setting on the image meter versus the X & Y settings on the shape meter; if you set those to zero for both meters, the TranformationMatrix works the same. Once you change the X & Y values away from zero, the TransformationMatrix works differently on the shape meter.

The shape meter transformers can do everything the 'matrix' does, and it uses generic terms rather than formulas, so for me it is easier to use.

Re: Appling TransformationMatrix on a Shape meter

eclectic-tech wrote:It has something to do with the X & Y setting on the image meter versus the X & Y settings on the shape meter; if you set those to zero for both meters, the TranformationMatrix works the same. Once you change the X & Y values away from zero, the TransformationMatrix works differently on the shape meter.

Right! I also figured this out.
eclectic-tech wrote:The shape meter transformers can do everything the 'matrix' does, and it uses generic terms rather than formulas, so for me it is easier to use.

What is the easiest depends I think on the user. For me the TransformationMatrix is an easy thing, the involved math isn't so hard as many users think. I've invested a lot of time over last years to figure out how does it work, but finally I think I can use it easily. But as I think you saw, the Shape meter is still unusual for me and have to get used to it. Probably I will in the future...

Re: Appling TransformationMatrix on a Shape meter

Thanks for reporting. We believe this issue to be fixed for the next beta.

[Technical_Details]
The problem here is the order in which we were applying transforms to shapes. The shape meter supports additional transform options that need to be applied to the shape before drawing it. We also apply a 'translate' matrix to move the shape to the correct position defined by the X/Y of the meter. So we are dealing with 3 different matrices here and were applying them in the following order: Shape transforms, 'world' transforms (from TransformationMatrix), and the translate matrix. The problem is that translated coordinates needed to be applied before the world matrix (TransformationMatrix).
[/Technical_Details]

-Brian

Re: Appling TransformationMatrix on a Shape meter

Brian wrote:Thanks for reporting. We believe this issue to be fixed for the next beta.

Great Brian. I understood your explanation and wait for the next beta. Although the issue is at least partially fixed by eclectic-tech's suggestion, I'm still curious how will it work.
Many thanks.

Re: Appling TransformationMatrix on a Shape meter

It seems the new version (r2944), published today (Oct 12), indeed fixed the issue.
Many thanks.