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.
It is currently April 25th, 2024, 5:26 pm
[SUGGESTION]Rounded corners option on padding.
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
-
- Rainmeter Sage
- Posts: 16169
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [SUGGESTION]Rounded corners option on padding.
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.
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: [SUGGESTION]Rounded corners option on padding.
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...
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [SUGGESTION]Rounded corners option on padding.
No, a skin windows and meter containers are always simple rectangles. It can't be otherwise.
-
- Rainmeter Sage
- Posts: 16169
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [SUGGESTION]Rounded corners option on padding.
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?
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: [SUGGESTION]Rounded corners option on padding.
Oh okay... thanks anyway.
Imagine this: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?
Code: Select all
[Meter]
Meter=String
Text="Hello World!"
Padding=5,5,5,5
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.
-
- Rainmeter Sage
- Posts: 16169
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [SUGGESTION]Rounded corners option on padding.
I'm still not sure I didn't misunderstand something, but at least if I didn't, it definitely can be done. For example: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.
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
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.
-
- Rainmeter Sage
- Posts: 16169
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [SUGGESTION]Rounded corners option on padding.
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
You do not have the required permissions to view the files attached to this post.
-
- Rainmeter Sage
- Posts: 5406
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: [SUGGESTION]Rounded corners option on padding.
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...
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...
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Posts: 1
- Joined: February 17th, 2021, 11:32 am
Re: [SUGGESTION]Rounded corners option on padding.
Hi. Registered to comment on the issue of rounding the corners of a string background. My example is the following:
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.
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.
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