It is currently May 4th, 2024, 3:08 am

Trying to make a specific shape meter

Get help with creating, editing & fixing problems with skins
katt
Posts: 3
Joined: April 20th, 2024, 4:51 pm

Trying to make a specific shape meter

Post by katt »

Hey!

I've been playing around with Rainmeter and making my own skins. Nothing really complicated, but I had an idea while making buttons to make them a bit "fancier". Basically I want to make a rectangle with rounded corners, but the catch is to leave one corner a bit sharp (or two corners, for example, top-left and bottom-right). I'm guessing I should look at path shapes, but I can't get a grasp of it, I might be too dumb.. I hope I explained it well enough for someone to understand, sorry for my english ^^
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trying to make a specific shape meter

Post by balala »

katt wrote: April 20th, 2024, 5:07 pm but I had an idea while making buttons to make them a bit "fancier". Basically I want to make a rectangle with rounded corners, but the catch is to leave one corner a bit sharp (or two corners, for example, top-left and bottom-right). I'm guessing I should look at path shapes, but I can't get a grasp of it, I might be too dumb.. I hope I explained it well enough for someone to understand
Yep, you did, I understood what you want. And no, YOU'RE NOT DUMB. It's not obvious I think how can you do this.
There is no simple way to get a sharp corner of a rectangle, while the others to be rounded. To get this, you need a "trick". Here is how can you achieve it.
First you need a rounded rectangle into a Shape meter. For instance this one:

Code: Select all

[MeterButton]
Meter=Shape
X=2
Y=2
Shape=Rectangle 0,0,70,30,10 | Extend MyModifiers1
MyModifiers1=Fill Color 191,237,239,255 | StrokeWidth 2 | Stroke Color 46,115,31,255
This creates a 70 x 30 pixels rectangle (second and third parameters of Rectangle), with a corner radius of 10 (last, fifth parameter).
You have to add one more, this time, sharp rectangle, above the first one, which has to be smaller than the original one and has to be well placed. If for example you want to sharp the upper left corner of the rectangle, add the following option to the above [MeterButton] meter: Shape2=Rectangle 0,0,35,15. Note that I omitted the Extend MyModifiers1 parameter from this Shape2 option, because we'll combine these shapes and such in a case, the combined shape is inheriting the modifiers from the first shape.
Finally, to combine these shapes, add a third Shape3 option to the same meter. This one: Shape3=Combine Shape | Union Shape2. This option is combining the first two, which results into a rectangle with rounded corners, except the upper left corner, which is sharp after combining the shapes.
Obviously to get other or more corners sharp, you have to play with the parameters of Shape2 option, to get the proper corners sharp. Hope you got the idea how to do this, but if you didn't, please feel free to come back and ask.
There are other ways to do this as well. This was just an example of how to get what you want.
katt
Posts: 3
Joined: April 20th, 2024, 4:51 pm

Re: Trying to make a specific shape meter

Post by katt »

balala wrote: April 20th, 2024, 6:34 pm Yep, you did, I understood what you want. And no, YOU'RE NOT DUMB. It's not obvious I think how can you do this.
There is no simple way to get a sharp corner of a rectangle, while the others to be rounded. To get this, you need a "trick". Here is how can you achieve it.
First you need a rounded rectangle into a Shape meter. For instance this one:

Code: Select all

[MeterButton]
Meter=Shape
X=2
Y=2
Shape=Rectangle 0,0,70,30,10 | Extend MyModifiers1
MyModifiers1=Fill Color 191,237,239,255 | StrokeWidth 2 | Stroke Color 46,115,31,255
This creates a 70 x 30 pixels rectangle (second and third parameters of Rectangle), with a corner radius of 10 (last, fifth parameter).
You have to add one more, this time, sharp rectangle, above the first one, which has to be smaller than the original one and has to be well placed. If for example you want to sharp the upper left corner of the rectangle, add the following option to the above [MeterButton] meter: Shape2=Rectangle 0,0,35,15. Note that I omitted the Extend MyModifiers1 parameter from this Shape2 option, because we'll combine these shapes and such in a case, the combined shape is inheriting the modifiers from the first shape.
Finally, to combine these shapes, add a third Shape3 option to the same meter. This one: Shape3=Combine Shape | Union Shape2. This option is combining the first two, which results into a rectangle with rounded corners, except the upper left corner, which is sharp after combining the shapes.
Obviously to get other or more corners sharp, you have to play with the parameters of Shape2 option, to get the proper corners sharp. Hope you got the idea how to do this, but if you didn't, please feel free to come back and ask.
There are other ways to do this as well. This was just an example of how to get what you want.
Yesss,thank you so much! I did scratch my head for a good 20min, but I figured out how to round any corner I want :D
I had some trouble when I overdid size and border thickness my left and top "walls" got cut off.
1.png
I couldn't think of a solution but something in my head said "change XY coords" and it fixed the issue.
I made a cute flower out of buttons, thanks :)
2.png
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trying to make a specific shape meter

Post by balala »

katt wrote: April 20th, 2024, 7:41 pm I made a cute flower out of buttons, thanks :)
2.png
:thumbup: Glad if you got it working as expected. Feel free to come back if any further question arises. :thumbup:
Just a question here: did you include the four combined shapes into one single meter? Hope you did.
katt
Posts: 3
Joined: April 20th, 2024, 4:51 pm

Re: Trying to make a specific shape meter

Post by katt »

balala wrote: April 20th, 2024, 7:47 pm :thumbup: Glad if you got it working as expected. Feel free to come back if any further question arises. :thumbup:
Just a question here: did you include the four combined shapes into one single meter? Hope you did.
I was so happy I didn't think of it, I just made 4 meters like [Flower1], [Flower2]...
I think I'm done for today, but I will play with it later on, not sure if I will figure it out, but I'll try ^^
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trying to make a specific shape meter

Post by balala »

katt wrote: April 20th, 2024, 9:15 pm I was so happy I didn't think of it, I just made 4 meters like [Flower1], [Flower2]...
Not a problem, you can join all those meters into one single. Here is what you should do (however there might be lot of thing which I can't predict):
  • Move all Shape, Shape2 and Shape3 options from all four meter into one single meter.
  • Renumber these Shape options, to have them in order, from Shape to Shape12.
  • Alter the position option of all Rectangle parameters of all Shapes (maybe excepting the first three), to have them properly positioned. How have you to do this, depends on many, especially on how had you placed those rectangles and respectively the meters, but the basic idea is to alter the first two numbers in all Rectangle parameters of all Shape meters, for instance the red colored ones from this option: Shape=Rectangle 0,0,70,30,10 | Extend MyModifiers1
If you can't deal with this, please post the code you have, for further help.