It is currently April 25th, 2024, 7:24 am

[Request] Rounded end caps on bar meters

Report bugs with the Rainmeter application and suggest features.
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

[Request] Rounded end caps on bar meters

Post by raiguard »

I have updated my suite's design a bit to make everything all nice and rounded, which I think looks more modern and aesthetically pleasing than squared off corners. So far I have rounded out almost everything that I wish to, save for one thing: the bars.

I am using a standard bar meter, which is very limited in its customization. I have toyed with the idea of making them into shape meters, but that seems really convoluted.

So, could rounded corners be added to bar meters, or do I have to use shape meters?
cpumeter.png
You do not have the required permissions to view the files attached to this post.
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Request] Rounded end caps on bar meters

Post by jsmorley »

We are unlikely to mess with the Bar meter code, as that is pretty fixed to the current functionality. I personally wouldn't be in favor of trying to extend it any further, given that there are options with the Shape meter and soon the Container functionality that are a lot more flexible.

Today, you could also use a BarImage, and then BarBorder to simulate the "end caps". I'm not in love with BarBorder, but that could work.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Request] Rounded end caps on bar meters

Post by jsmorley »

To each his own, but the Shape meter approach seems simple enough to me...

Code: Select all

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

[MeasureCPU]
;Measure=CPU
Measure=Calc
Formula=60

[MeterCPU]
Meter=Shape
Shape=Rectangle 0,0,300,3,3 | StrokeWidth 0 | Fill Color 47,47,47,255
Shape2=Rectangle 0,0,(300*[MeasureCPU]/100),3,3 | StrokeWidth 0 | Fill Color 0,255,0,255
DynamicVariables=1
1.png

Code: Select all

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

[MeasureCPU]
;Measure=CPU
Measure=Calc
Formula=60

[MeterCPU]
Meter=Shape
Shape=Rectangle 0,0,300,5,5 | StrokeWidth 0 | Fill Color 47,47,47,255
Shape2=Rectangle 1,1,(298*[MeasureCPU]/100),3,3 | StrokeWidth 0 | Fill Color 0,255,0,255
DynamicVariables=1
2.png

Code: Select all

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

[MeasureCPU]
;Measure=CPU
Measure=Calc
Formula=60

[MeterCPU]
Meter=Shape
Shape=Rectangle 0,0,300,6,5 | StrokeWidth 0 | Fill Color 47,47,47,255
Shape2=Line 1,3,(298*[MeasureCPU]/100),3 | StrokeWidth 1 | Stroke Color 0,255,0,255
DynamicVariables=1
3.png
You do not have the required permissions to view the files attached to this post.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: [Request] Rounded end caps on bar meters

Post by kyriakos876 »

I'm just going to link this post from jsmorley in addition to what he wrote above because there's some more info:
https://forum.rainmeter.net/viewtopic.php?f=119&t=26293&p=137258&hilit=gradient#p137258

I tried to think of some way to use gradient (play with the opacity) in the very edges of the bar, but I don't think that's possible with the bar meter.
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

Re: [Request] Rounded end caps on bar meters

Post by raiguard »

Thanks for the examples JSMorley. I had already gone ahead and done that, but I am not happy with it for two reasons:

1) It requires DynamicVariables, which decreases skin performance. These bars are absolutely EVERYWHERE in my skins (there are 66 of them in CPU Meter alone!) so every bit of performance counts.
2) It's not easy to generalize. I would have to redefine the entire Shape2 for every bar, which would require a lot of copy/pasting. As compared to the bar meter, which just requires me to input a Measure name and a bar color.

Based on these factors, I have decided to just keep them as square lines rather than rounded ones. Maybe I could do something with containers later, but for now I'll just have to deal with it. Thanks for the help though!

Edit: Here's a comparison of the two methods.

Standard Bar Meter:

Code: Select all

[MeterCore34Bar]
Meter=Bar
MeterStyle=StyleBar
MeasureName=MeasureCpuUsageCore34
BarColor=#colorCore34#
Group=CpuCore34
Hidden=(#cpuCores# < 34)
Shape Bar Meter:

Code: Select all

[MeterCore34Bar]
Meter=Shape
MeterStyle=StyleBar
Shape2=0,0,(#contentWidth# * ([MeasureCpuUsageCore34] / 100)),#barThickness#,#cornerRoundness# | Fill Color #colorCore34# | StrokeWidth 0
Group=CpuCore34
Hidden=(#cpuCores# < 34)
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Request] Rounded end caps on bar meters

Post by jsmorley »

That's fine. To be honest, it's going to be pretty hard to even detect the rounded ends on a shape that is only 2-3 pixels tall anyway.

Having said that, DynamicVariables isn't really going to have all that much impact really, and as for copy/paste, well... You only have to do it one time when you create the skin, so I just don't see that as a show-stopper.

Entirely up to you of course.