It is currently April 20th, 2024, 12:52 pm

New Shape Meter

Changes made during the Rainmeter 4.0 beta cycle.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Shape Meter

Post by jsmorley »

A meter is a meter really. You can dynamically move a meter around as you like by changing the X and Y on the meter.

You can also change the starting X and Y of a shape within a Shape meter by changing those values in the definition of the shape. See each kind of shape for how you define those.

Do be aware that moving a Path within a Shape meter might be pretty damn complicated. A Path is made up of from one to ~infinity distinct "segments", that each has its own starting and ending definitions. In addition, measurements in a Shape meter use Device Independent Pixels, and so they don't have to be an integer. The Offset modifier might help with this, but you might be better off using X and Y on the meter.

You can rotate and scale shapes within a shape meter with Transformation Modifiers.

Note that you can "flip" or "mirror" a shape with the Scale modifier.

Also note that Scale never impacts any StrokeWidth on a shape. If you scale a shape with a StrokeWidth of 3 by half, it will still have a stroke width of 3, not 1.5. This is intentional, but it means you might have to dynamically change the size of strokes to get things looking the way you want.

https://docs.rainmeter.net/manual/meters/shape/#TransformModifiers
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Shape Meter

Post by jsmorley »

Code: Select all

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

[Variables]

[MeterShape1]
Meter=Shape
X=-27
Y=17
Shape = Path Path1 | fill color 255, 255, 255 | stroke color 0, 0, 0 | StrokeWidth 2 | Scale 0.5,0.5 
Path1 = 197.91, 0.5 | LineTo 46.21, 0.5 | ArcTo 0.5, 46.21, 45.7, 45.7, 0, 1, 0 | LineTo 0.5, 120.11 | ArcTo 46.21, 165.82, 45.7, 45.7, 0, 1, 0 | LineTo 140.09, 165.82 | LineTo 184.81, 210.54 | LineTo 184.81, 165.82 | LineTo 197.91, 165.82 | ArcTo 243.62, 120.11, 45.7, 45.7, 0, 1, 0 | LineTo 243.62, 46.21 | ArcTo 197.91, 0.5, 45.7, 45.7, 0, 1, 0 | ClosePath 1

[MeterShape2]
Meter=Shape
X=150
Y=0
Shape = Path Path1 | fill color 255, 255, 255 | stroke color 0, 0, 0 | StrokeWidth 2 | Scale -0.5,0.5 
Path1 = 197.91, 0.5 | LineTo 46.21, 0.5 | ArcTo 0.5, 46.21, 45.7, 45.7, 0, 1, 0 | LineTo 0.5, 120.11 | ArcTo 46.21, 165.82, 45.7, 45.7, 0, 1, 0 | LineTo 140.09, 165.82 | LineTo 184.81, 210.54 | LineTo 184.81, 165.82 | LineTo 197.91, 165.82 | ArcTo 243.62, 120.11, 45.7, 45.7, 0, 1, 0 | LineTo 243.62, 46.21 | ArcTo 197.91, 0.5, 45.7, 45.7, 0, 1, 0 | ClosePath 1

1.jpg


So I just drew the speech bubble in Inkscape, then saved the .svg file and converted it with theAzack9's VectorConverter tool. I'm almost never going to manually figure out the precise measurements needed for any shape that has curves. Arcs and Curves are just more complicated than I personally have the patience for. Let Inkscape do the work.

I could have just drawn a rounded rectangle shape and a triangle path and combined them, which wouldn't be hard really, but I kinda wanted to demonstrate what I have been talking about.
You do not have the required permissions to view the files attached to this post.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: New Shape Meter

Post by fonpaolo »

Thanks jsmorley., I think I figured out a solution shortly after posting the questions. :lol:
However suggestions are always welcome. :D

What I have in mind is more simple, to stay in line with the whole design of my suite.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: New Shape Meter

Post by balala »

jsmorley wrote: April 18th, 2020, 11:19 am Yes. I found a .svg version of the image on the internet somewhere, and used theAzack9's converter to turn it into Shape meters.
Ok, got it working. Interesting tool, playing around with it. Thanks for the information on how to do this conversion. Even if probably won't use it too much, because yep, the generated code indeed is long and doesn't worth working with it, it worth a try.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: New Shape Meter

Post by fonpaolo »

I'm experimenting with Shapes... and I got this:

Code: Select all

[MeterToolTipBase1]
Meter=Shape
Shape=Rectangle (Round(([MeasureEventMagn1]+15)*#PanelSize#)),0,(Round(110*#PanelSize#)),(Round(65*#PanelSize#)) | Fill Color 120,150,150,130 | StrokeWidth 0
Shape2=Path Path1 | Fill Color 0,0,0,0 | StrokeWidth 2 | Stroke Color [MeasureEventColor1],170
Path1=0,(Round(85*#PanelSize#)) | LineTo (Round(20*#PanelSize#)),(Round(65*#PanelSize#))
Shape3=Path Path2 | Fill Color 0,0,0,0 | StrokeWidth 2 | Stroke Color 220,255,255,130
Path2=(Round(20*#PanelSize#)),(Round(65*#PanelSize#)) | LineTo (Round(20*#PanelSize#)),0
Shape4=Path Path3 | Fill COlor 0,0,0,0 | StrokeWidth 2 | Stroke Color 0,0,0,60
Path3=(Round(3*#PanelSize#)),(Round(83*#PanelSize#)) | LineTo (Round(22*#PanelSize#)),(Round(65*#PanelSize#)) | LineTo (Round(130*#PanelSize#)),(Round(65*#PanelSize#)) | LineTo (Round(130*#PanelSize#)),(Round(2*#PanelSize#))
x=((([MeasureEventMagn1]+10)+(Round((#CoordX_0#+(14.65*[MeasureEventLong1:])))))*#PanelSize#)
y=((Round(((25+#CoordY_0#)-(21.85*[MeasureEventLat1:])))-(90+[MeasureEventMagn1]))*#PanelSize#)
UpdateDivider=-1
DynamicVariables=1
Label1.png
I hope I did it right.
Reading the documentation, it is said that I can mirror the shape using Scale and -1, but how can I mirror the whole shape? :???:

P.S. @balala - please, don't even think about TasformationMatrix! :rofl:
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Shape Meter

Post by jsmorley »

I just can't be of any help if I don't have the measures and variables that are embedded in that shape. I won't ever spout off with advice unless I can test what I am suggesting. Even just put in some valid representational numbers in the place of the measures and variables, so I can actually run it.
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: New Shape Meter

Post by balala »

fonpaolo wrote: April 19th, 2020, 9:51 pm P.S. @balala - please, don't even think about TasformationMatrix! :rofl:
Alright, as you wish.
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: New Shape Meter

Post by Yincognito »

fonpaolo wrote: April 19th, 2020, 9:51 pmReading the documentation, it is said that I can mirror the shape using Scale and -1, but how can I mirror the whole shape? :???:
The way I see it, since the shapes are not joined/combined (i.e. a structural "whole"), you'd probably have to apply the method you are talking about (assuming that you're right) to every constituent shape. The 2nd option is to combine them and then apply the mirroring to the entire resulting shape. The 3rd option would be to mirror each shape through the formulas, since, if you know the width/height, that's probably just a matter of subtracting the current values from them.

That being said, and I'm just speculating here based on the screenshot you posted, if by any chance you want to do a raised/sunken bevel surrounding the (tooltip's?) rectangle, I already did this in my skins (and custom tooltips), along with setting a custom bevel width (a suggestion I made a while ago that the devs ignored, despite its simplicity, by looking at the source code - but then, what's done is done, LOL), and no mirroring or flipping was needed (to switch between raised and sunken, for example), just got it working through variables and formulas. More or less similar to the 3rd option I mentioned above.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: New Shape Meter

Post by fonpaolo »

Reading the documentation, if I've understood correctly, you can't combine shapes that aren't closed, so in my case, the question is:
using Scale, is there a way to mirror the image obtained with Shape meter?

@jsmorley - I posted the above code just to talk about something tangible, to show that I'm already scaling them directly in the creation of the shapes, so, in theory, I could use Scale for mirroring purposes.

@balala - obviously I was kidding. ;-)
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New Shape Meter

Post by jsmorley »

fonpaolo wrote: April 20th, 2020, 11:16 am Reading the documentation, if I've understood correctly, you can't combine shapes that aren't closed, so in my case, the question is:
using Scale, is there a way to mirror the image obtained with Shape meter?
Combined or not, Transformation Modifiers are distinct to each ShapeN option in the meter. So you can either transform each shape in the meter individually:

Code: Select all

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

[Variables]

[MeterShape]
Meter=Shape
X=50
Y=50
Shape=Rectangle 1,1,100,50 | Rotate 45
Shape2=Rectangle 20,20,100,50 | Rotate -45
Shape3=Combine Shape | Union Shape2

1.jpg


Or Combine one or more shapes, and then transform the combined shape.

Code: Select all

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

[Variables]

[MeterShape]
Meter=Shape
X=50
Y=50
Shape=Rectangle 1,1,100,50
Shape2=Rectangle 20,20,100,50
Shape3=Combine Shape | Union Shape2 | Rotate 45

2.jpg

Or both...

Code: Select all

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

[Variables]

[MeterShape]
Meter=Shape
X=50
Y=50
Shape=Rectangle 1,1,100,50 | Rotate 10
Shape2=Rectangle 20,20,100,50 | Rotate -10
Shape3=Combine Shape | Union Shape2 | Rotate 45

3.jpg


Keep in mind that Attribute Modifiers (colors, strokes) behave differently when combined than Transform Modifiers (rotate, scale). Attribute Modifiers are always dependent on the "parent" shape when combined, and any Attribute Modifiers on a "child" shape are ignored. Transform Modifiers are applied to each shape BEFORE they are combined, and then on the brand-new combined shape AFTER they are combined.

If you are not using Combine on the shapes in the meter, and it certainly isn't always appropriate that you do, then you would need to transform each shape separately.

The intent of Combine is NOT in some way to "group" distinct shapes together. What Combine does is "merge" two or more shapes together, creating a BRAND-NEW "single" shape, and just throw away the individual pieces.

Either that, or use TransformationMatrix on the entire meter itself. :-)
You do not have the required permissions to view the files attached to this post.