It is currently March 28th, 2024, 7:53 pm

Thread for help with the Shape meter

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

Post by jsmorley »

FreeRaider wrote:This is one of the reasons why I do not like this new meter.

I would have preferred a meter that uses the same method of reasoning (for example as it is used Roundline) of the others, with the numerical certainty of "Where it starts, where it ends, the starting position X and Y" and especially StrokeWidth used as the border of the geometric figure included totally in it.
I know StrokeWidth irritates you, and I can sympathize. ;-)

But consider this. If we just automatically integrated the "stroke" into the definition and size of the "shape", then if you had a shape like this:
1.png
And you wanted to "scale" it on the X-axis, you would end up with this:
2.png
That's not what you want at all, what you want is this:
3.png
So the stroke size has nothing to do with the size of the shape. If you define a StrokeWidth of 4, it will stay 4, no matter what you do to the shape, scale it, rotate it, resize it, skew it, whatever. You define and control the size of the shape, and the stroke used to "draw" the shape is just centered on the edge of the shape.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

Post by jsmorley »

That is not to say that the StrokeWidth is irrelevant to the design of your skin of course, but it is pretty logical, and can be used just fine with "relative positioning", which is always based on the "meter" and not the "shape".

Consider this:

Code: Select all

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

[MeterShape]
Meter=Shape
Shape=Rectangle 2,2,200,100 | StrokeWidth 4

[MeterSize]
Meter=String
X=0
Y=10R
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=X: [MeterShape:X]#CRLF#Y: [MeterShape:Y]#CRLF#W: [MeterShape:W]#CRLF#H: [MeterShape:H]
1.png
So we know we have a StrokeWidth of 4. That means we need to leave enough room in the skin for 1/2 of that (rounded up to an integer) at the top and left, so it isn't "truncated" by being outside the skin.

That is why we set the "starting point" of our shape to Rectangle 2,2. We are moving the shape in 2 pixels from the left and top to make room for the "stroke".

However, the entire shape INCLUDING any stroke, are considered when the "meter container" is created. So as the meter is drawn from X and Y down and to the right, any stroke will be part of the overall width and height of the meter. This means that there should really be no issue with "relative positioning" any meters to the right or under this meter.

As you can see, our meter container starts at 0,0. We offset the "starting point" of the shape so the "outside" bit of the StrokeWidth is accommodated. Then the meter container is created and the shape drawn inside it.

The meter container will be the entire width and height of the shape AND any stroke. So in this case, 204 X 104.

When I make the String meter relative to the Shape meter, that Y=10R is based on the meter container of the Shape meter, and it will properly be 10 pixels below the meter. Again, that Shape meter container will include the stroke, so the String meter will be positioned 10 pixels below the bottom of the stroke.

This will be more clear if I make it Y=0R:
2.png
You do not have the required permissions to view the files attached to this post.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Thread for help with the new Shape meter

Post by FreeRaider »

jsmorley, perhaps I don't like this new meter intended as a "container" and especially I don't like StrokeWidth (this one for sure ;-) ), but I really appreciate your explanation and I'm sorry for the time you have wasted for writing it.

Perhaps one day I will use it, but for now I will continue to use the old and well-known meters.

Thanks anyway.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

Post by jsmorley »

FreeRaider wrote:jsmorley, perhaps I don't like this new meter intended as a "container" and especially I don't like StrokeWidth (this one for sure ;-) ), but I really appreciate your explanation and I'm sorry for the time you have wasted for writing it.

Perhaps one day I will use it, but for now I will continue to use the old and well-known meters.

Thanks anyway.
Absolutely. Hey, nothing says that this has to be used in all its glory in any case. I find it nice for simply creating a slightly rounded rectangle, that I can set the fill and stroke to any color and transparency I like and use as a skin background. Truth be told, I may not use it all that often for other than that myself.
1.png
On the other hand....
Cylinders.gif
You do not have the required permissions to view the files attached to this post.
HudTweaker13
Posts: 6
Joined: February 1st, 2017, 1:11 am

Re: Thread for help with the new Shape meter

Post by HudTweaker13 »

I'm working on a gui interface and will likely have to repeat the same shape several times through the code for popup launchers in the menu. I tried placing the path for the complex shape into variables but had no joy with that. The shape isn't large, but it has 14 segments (I'm attempting a stargate ancient control crystal look). Is there any way to take the path into a variable to make it easier, and shorter, to code?

Here's my path:

MyPath=20,0 | LineTo 0,20 | LineTo 40,60 | LineTo 80,60 | LineTo 100,80 | Lineto 140,80 | LineTo 160,60 | LineTo 240,60 | LineTo 260,80 | LineTo 300,80 | LineTo 320,60 | LineTo 360,60 | LineTo 400,20 | LineTo 380,0 | LineTo 20,0 | ClosePath 1

Also, is it possible to save modifiers for the shapes into the variables? I have a universal gradient that I plan to use for the fill of the crystalline segments.

Thanks

p.s. It's thanks to this thread and all the contributions so far that I understand it this well :)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Thread for help with the new Shape meter

Post by balala »

HudTweaker13 wrote:Is there any way to take the path into a variable to make it easier, and shorter, to code?
It is, as usually you can define a variable into the [Variables] section, then use it:

Code: Select all

[Variables]
Path=20,0 | LineTo 0,20 | LineTo 40,60 | LineTo 80,60 | LineTo 100,80 | Lineto 140,80 | LineTo 160,60 | LineTo 240,60 | LineTo 260,80 | LineTo 300,80 | LineTo 320,60 | LineTo 360,60 | LineTo 400,20 | LineTo 380,0 | LineTo 20,0 | ClosePath 1

[MeterShape1]
Meter=Shape
X=1
Y=1
Shape=Path MyPath | StrokeWidth 2 | Stroke Color 255,0,0 | Fill Color 255,240,0,150
MyPath=#Path#
HudTweaker13 wrote:Also, is it possible to save modifiers for the shapes into the variables? I have a universal gradient that I plan to use for the fill of the crystalline segments.
Obviously, same thing:

Code: Select all

[Variables]
Modifier=Fill Color 255,240,0,150 | StrokeWidth 4 | Stroke Color 255,0,0

[MeterRoundedRectangle]
Meter=Shape
X=0r
Y=5R
Shape=Rectangle 0,0,100,100,20 | Extend MyModifiers1
MyModifiers1=#Modifier#
Tony Ryan
Posts: 17
Joined: December 7th, 2016, 2:27 pm

Re: Thread for help with the new Shape meter

Post by Tony Ryan »

Hi was wondering if there is a particular method to use a shape instead of an image or bar
for the progress for (u/l, d/l,cpu ect.) if so could anyone point me in the right direction
thanks.. :???:
User avatar
sephirotess
Posts: 332
Joined: December 8th, 2016, 6:45 am

Re: Thread for help with the new Shape meter

Post by sephirotess »

Tony Ryan wrote:Hi was wondering if there is a particular method to use a shape instead of an image or bar
for the progress for (u/l, d/l,cpu ect.) if so could anyone point me in the right direction
thanks.. :???:
Hi,

You can take example with my last suite here. I used shape meters for the bars (CPU, RAM...).

Here a sample of my code for the CPU:

Code: Select all

[Rainmeter]
AccurateText=1
Update=1000


[Variables]
sm3=MCPU
FBB=252,252,252
DA1=64,153,224
FBC=0,0,0
FBP=128,64,0,255
eft=shadow
eft1=normal
eft2=Sitka small
eft3=8

[Style3]
FontColor=#FBB#
FontFace=#eft2#
FontSize=#eft3#
StringStyle=#eft1#
StringEffect=#eft#
SolidColor=0,0,0,1
AntiAlias=1
StringAlign=Left
ToolTipType=1
X=15
Y=53
UpdateDivider=-1

[Style4]
FontColor=#FBB#
FontFace=#eft2#
FontSize=#eft3#
StringStyle=#eft1#
StringEffect=#eft#
SolidColor=0,0,0,1
AntiAlias=1
StringAlign=Right
ToolTipType=1
X=205
Y=53
UpdateDivider=-1

[Style5]
FontColor=#FBB#
FontFace=#eft2#
FontSize=#eft3#+2
StringStyle=#eft1#
StringEffect=#eft#
SolidColor=0,0,0,1
AntiAlias=1
MeasureName=#sm3#
StringAlign=LEFTCENTER
X=(15+(1.72*[#sm3#]))
Y=13
Text=%1%
ToolTipType=1
Dynamicvariables=1

[B1]
Meter=Shape
Shape=Rectangle 16,28,193,16,8 | Fill Color #FBC# | Extend Balls
Balls=StrokeWidth 2 | Stroke LinearGradient Gradient
Gradient=-5,-5 | #FBP# ; 0.0 | #FBB# ; 1.0
UpdateDivider=-1

[B2]
Meter=Shape
Shape=Rectangle 18,30,190,13,8 | StrokeWidth 2 | Fill LinearGradient Gradient
Shape2=Rectangle ([#sm3#]*1.9-172),30,190,13,8 
Shape3=Combine Shape | Intersect Shape2 
Gradient=270 | #FBC# ; 0.0 | #DA1#, ; 0.7
DynamicVariables=1

[MCPU]
Measure=CPU

[MCPUName]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=HARDWARE\DESCRIPTION\System\CentralProcessor\0
RegValue=ProcessorNameString
UpdateDivider=-1

[MCPUIdentifier]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=HARDWARE\DESCRIPTION\System\CentralProcessor\0
RegValue=Identifier
UpdateDivider=-1

[Cpu1Temp]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=Temperature
CoreTempIndex=0
UpdateDivider=5
OnChangeAction=[!UpdateMeter Temp]

[Title]
Meter=STRING
MeterStyle=Style4
MeasureName=MCPUName
MeasureName2=MCPUIdentifier
Text=CPU
Tooltiptext=%1#CRLF#%2

[Temp]
MeasureName=Cpu1Temp
Meter=STRING
MeterStyle=Style3
Text=%1°C
ToolTipText=temperature
NumOfDecimals=0

[CPV]
Meter=STRING
MeterStyle=Style5
NumOfDecimals=0
I hope it will help :D.
Tony Ryan
Posts: 17
Joined: December 7th, 2016, 2:27 pm

Re: Thread for help with the new Shape meter

Post by Tony Ryan »

Hi Sephirotess thanks for this it was what i wanted, works great on cpu
but for some reason i cant get it to work on a download meter.
could you look to see if i missed something in your code please..

Code: Select all

[Variables]
sm3=MeasureNetIn
;MCPU
FBB=252,252,252
DA1=64,153,224
FBC=0,0,0
FBP=128,64,0,255
eft=shadow
eft1=normal
eft2=Sitka small
eft3=8
maxDownload=10485760
maxUpload=10485760


[MeasureNetOut]
Measure=NetOut
NetOutSpeed=#maxUpload#

[MeasureNetIn]
Measure=NetIn
NetInSpeed=#maxDownload#

[Style3]
FontColor=#FBB#
FontFace=#eft2#
FontSize=#eft3#
StringStyle=#eft1#
StringEffect=#eft#
SolidColor=0,0,0,1
AntiAlias=1
StringAlign=Left
ToolTipType=1
X=15
Y=53
UpdateDivider=-1

[Style4]
FontColor=#FBB#
FontFace=#eft2#
FontSize=#eft3#
StringStyle=#eft1#
StringEffect=#eft#
SolidColor=0,0,0,1
AntiAlias=1
StringAlign=Right
ToolTipType=1
X=205
Y=53
UpdateDivider=-1

[Style5]
FontColor=#FBB#
FontFace=#eft2#
FontSize=#eft3#+2
StringStyle=#eft1#
StringEffect=#eft#
SolidColor=0,0,0,1
AntiAlias=1
MeasureName=#sm3#
StringAlign=LEFTCENTER
X=(15+(1.72*[#sm3#]))
Y=13
Text=%1%
ToolTipType=1
Dynamicvariables=1

[B1]
Meter=Shape
Shape=Rectangle 16,28,193,16,8 | Fill Color #FBC# | Extend Balls
Balls=StrokeWidth 2 | Stroke LinearGradient Gradient
Gradient=-5,-5 | #FBP# ; 0.0 | #FBB# ; 1.0
UpdateDivider=-1

[B2]
Meter=Shape
Shape=Rectangle 18,30,190,13,8 | StrokeWidth 2 | Fill LinearGradient Gradient
Shape2=Rectangle ([#sm3#]*1.9-172),30,190,13,8 
Shape3=Combine Shape | Intersect Shape2 
Gradient=270 | #FBC# ; 0.0 | #DA1#, ; 0.7
DynamicVariables=1

[DownloadLabel]
Meter=String
MeterStyle=Style5
X=10
Y=65
W=190
H=14
Text=Download

[DownloadValue]
Meter=String
MeterStyle=Style5
MeasureName=MeasureNetIn
X=150
Y=0r
W=190
H=14
Text=%1B/s
NumOfDecimals=1
AutoScale=1
User avatar
sephirotess
Posts: 332
Joined: December 8th, 2016, 6:45 am

Re: Thread for help with the new Shape meter

Post by sephirotess »

Tony Ryan wrote:Hi Sephirotess thanks for this it was what i wanted, works great on cpu
but for some reason i cant get it to work on a download meter.
could you look to see if i missed something in your code please..
Hi,

For certain measures (HDD, Swap ...) you need to find a percentage. I think it's the same for the download. Try this. I do not know if this is the best solution.

Code: Select all

[Variables]
sm3=MCalc
FBB=252,252,252
DA1=64,153,224
FBC=0,0,0
FBP=128,64,0,255
eft=shadow
eft1=normal
eft2=Sitka small
eft3=8
maxDownload=10485760
maxUpload=10485760

[MCalc]
Measure=Calc
Formula=(100*[MeasureNetIn]/#maxDownload#)
DynamicVariables=1

[MeasureNetOut]
Measure=NetOut
NetOutSpeed=#maxUpload#

[MeasureNetIn]
Measure=NetIn
NetInSpeed=#maxDownload#

[Style5]
FontColor=#FBB#
FontFace=#eft2#
FontSize=#eft3#+2
StringStyle=#eft1#
StringEffect=#eft#
SolidColor=0,0,0,1
AntiAlias=1
MeasureName=#sm3#
StringAlign=LEFTCENTER
ToolTipType=1
Dynamicvariables=1

[B1]
Meter=Shape
Shape=Rectangle 16,28,193,16,8 | Fill Color #FBC# | Extend Balls
Balls=StrokeWidth 2 | Stroke LinearGradient Gradient
Gradient=-5,-5 | #FBP# ; 0.0 | #FBB# ; 1.0
UpdateDivider=-1

[B2]
Meter=Shape
Shape=Rectangle 18,30,190,13,8 | StrokeWidth 2 | Fill LinearGradient Gradient
Shape2=Rectangle ([#sm3#]*1.9-172),30,190,13,8 
Shape3=Combine Shape | Intersect Shape2 
Gradient=270 | #FBC# ; 0.0 | #DA1#, ; 0.7
DynamicVariables=1

[DownloadLabel]
Meter=String
MeterStyle=Style5
X=10
Y=65
W=190
H=14
Text=Download

[DownloadValue]
Meter=String
MeterStyle=Style5
MeasureName=MeasureNetIn
X=150
Y=0r
W=190
H=14
Text=%1B/s
NumOfDecimals=1
AutoScale=1