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

[SUGGESTION]Rounded corners option on padding.

Report bugs with the Rainmeter application and suggest features.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

[SUGGESTION]Rounded corners option on padding.

Post by kyriakos876 »

I want to create a background (like padding), with rounded corners, on a string.
I've been playing around with meters and borders and containers, but no simple solution was found. I mean,sure, I can do something like this but I only changed from the default string align (left) to StringAlign=Right and I had to make modifications already. Now Imagine that my string has nothing static so I basically have to write a bunch of code to support a fully variable string. Now imagine again that I have a bunch of strings that are like the one described above. All of a sudden you end up with double the code you started with. 🤔

Thus I think that for such cases, an option for padding with rounded corners could be introduced. Now, I don't know if what I'm asking is too complicated as I'm not sure I know how the padding is drawn, but that's my idea thrown on the table.

-Thanks for your time. :bow:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [SUGGESTION]Rounded corners option on padding.

Post by balala »

I'd use the new Container option for this. I think it can be done, even if the string is not static. If you can't figure out how, later today I'll post a sample code.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: [SUGGESTION]Rounded corners option on padding.

Post by kyriakos876 »

balala wrote: January 17th, 2019, 10:25 am I'd use the new Container option for this. I think it can be done, even if the string is not static. If you can't figure out how, later today I'll post a sample code.
No of-course it can be done... even without container option, I have it working right now, but there's a bunch of code that could be removed if the options I'm suggesting were to be introduced...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [SUGGESTION]Rounded corners option on padding.

Post by jsmorley »

No, a skin windows and meter containers are always simple rectangles. It can't be otherwise.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [SUGGESTION]Rounded corners option on padding.

Post by balala »

jsmorley wrote: January 17th, 2019, 1:29 pm No, a skin windows and meter containers are always simple rectangles. It can't be otherwise.
Let's clarify something. From kyriakos876's initial request above I understood he want to round the corners of a meter's background. Like if it has a SolidColor background and he wants this background to have rounded corners. If he talked about the background of a skin, then yep, it can't be done. But in this case I strongly misunderstood his question.
So, kyriakos876, you want to round the corners of a meter or of a skin?
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: [SUGGESTION]Rounded corners option on padding.

Post by kyriakos876 »

jsmorley wrote: January 17th, 2019, 1:29 pm No, a skin windows and meter containers are always simple rectangles. It can't be otherwise.
Oh okay... thanks anyway.

balala wrote: January 17th, 2019, 3:02 pm Let's clarify something. From kyriakos876's initial request above I understood he want to round the corners of a meter's background. Like if it has a SolidColor background and he wants this background to have rounded corners. If he talked about the background of a skin, then yep, it can't be done. But in this case I strongly misunderstood his question.
So, kyriakos876, you want to round the corners of a meter or of a skin?
Imagine this:

Code: Select all

[Meter]
Meter=String
Text="Hello World!"
Padding=5,5,5,5
now what I want is add rounded corners to the Padding option so it could be something like:
Padding=5,5,5,5,8 where 8 would be the radius of the corner in the padding.
That's what I suggested to add in the Rainmeter's code but as answered above, it can't be added because of how things works.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [SUGGESTION]Rounded corners option on padding.

Post by balala »

kyriakos876 wrote: January 17th, 2019, 3:19 pm That's what I suggested to add in the Rainmeter's code but as answered above, it can't be added because of how things works.
I'm still not sure I didn't misunderstand something, but at least if I didn't, it definitely can be done. For example:

Code: Select all

[Variables]
Radius=5
Padding=5,15,5,15

[MeterCounter]
Meter=Shape
X=1
Y=1
Shape=Rectangle 0,0,[Meter:W],[Meter:H],(Clamp(#Radius#,0,(Min([Meter:W]/2,[Meter:H]/2)))) | Fill Color 191,237,239 | StrokeWidth 0 | Stroke Color 46,115,31
DynamicVariables=1

[Meter]
Meter=String
X=0
Y=0
Text=Hello World!
Padding=#Padding#
SolidColor=220,220,220,220
Container=MeterCounter
As I hope it is obvious, Radius is the radius of the rounded corners, while Padding is the padding you'd like to add to the String meter. Edit them freely.

Tip: don't quote anything in your codes (like the Hello World! string in the Text option of the [Meter] meter). It's useless.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [SUGGESTION]Rounded corners option on padding.

Post by balala »

jsmorley wrote: January 17th, 2019, 1:29 pm No, a skin windows and meter containers are always simple rectangles. It can't be otherwise.
For sure the skin window is (unless we're using an image with rounded corners, as background image), but I'm not sure I agree with the other statement:

Code: Select all

[MeterContainer]
Meter=Shape
X=1
Y=1
Shape=Rectangle 0,0,100,50,15 | Fill Color 0,0,0 | StrokeWidth 0 | Stroke Color 0,0,0,0

[MeterImage]
Meter=Image
ImageName=#@#ANYIMAGE.png
X=0
Y=0
Container=MeterContainer
The meter used as container ([MeterContainer]) is a rounded rectangle:
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: [SUGGESTION]Rounded corners option on padding.

Post by eclectic-tech »

Yes, a container can round the corners of a meter, but that means (as kyriakos876 points out) that you would need a container meter for every different sized meter you want to have round corners. This could possibly doubles the amount of code for the skin, given that not all meters would need a separate container.

A work around would be to create a preset sized container that would be large enough that all your strings would display, or format the string meters to stay within the bounds of the container dimensions. Both of these reduce the flexibility kyriakos876 was hoping to have.

There is no way to use the same container on different size meters that I am aware of... :uhuh:
User avatar
eqagunn
Posts: 1
Joined: February 17th, 2021, 11:32 am

Re: [SUGGESTION]Rounded corners option on padding.

Post by eqagunn »

Hi. Registered to comment on the issue of rounding the corners of a string background. My example is the following:

Image

To have a background behind a string it is enough to add SolidColor=0,0,0,100 to [MeterStyle] if that style is referenced in every String Meter that requires it.

But to make background corners rounded it's a different story. Instead of having an option to specify corner angles one has to remove the above mentioned and add a section to define a Shape Meter for every String Meter that requires it.

Code: Select all

[MeterItem1Bg]
Meter=Shape
Shape=Rectangle (#width#-[meterItem1:W]-5), [meterItem1:Y], ([meterItem1:W]+10), [meterItem1:H], (#textSize#-2) |  Fill Color 0,0,0,100 | Stroke Color 0,0,0,0
DynamicVariables=1
For my screenshot above I need to have 9 of these Shape Meters which doubles the amount of code I have in my meters section. It would be great if corner rounding was implemented for a string background instead of having to draw a shape whenever one is needed.