It is currently September 20th, 2021, 12:06 am

Thread for help with the Shape meter

Help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

Youkai1977 wrote: March 29th, 2021, 1:23 pm Well then I'll leave it that way for now. Time will tell if I'm in line with the coordinates.

The reason I am teasing is that I have shown the compass with pictures (* .png files) beforehand. But since my goal is to code a suite that is as economical as possible (storage space and CPU performance) (I remember our conversation with my Visualizer a few weeks ago), I am now trying to replace the images with shapes.

Anyway, thanks again for the help :)

PS .: Yeah, I only saw your EDIT now
Yeah, no problem. ;-)
User avatar
Youkai1977
Posts: 139
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Thread for help with the Shape meter

Post by Youkai1977 »

@Yincognito:

I'll have to come back to your offer if I ever have (a stupid) question there ... :Whistle :oops:

And namely I try just the following...

This SHAPE-Button...

Code: Select all

[BTN_1]
Meter=SHAPE
X=0
Y=1
Shape=Rectangle 0,0,150,29,4 | StrokeWidth 0 | Fill Color 255,0,0,255
Shape2=Rectangle -2,24,30,8 | StrokeWidth 0 | Skew 45,0
Shape3=Rectangle 0,20,4,4 | StrokeWidth 0
Shape4=Rectangle 0,16,8,8,4 | StrokeWidth 0
Shape5=Combine Shape | Exclude Shape2 | Exclude Shape3 | Union Shape4
UpdateDivider=-1
... implement as MyPath SHAPE

Code: Select all

[BTN_1]
Meter=Shape
X=0
Y=1
Shape=Path MyPath | StrokeWidth 1.5 | Stroke Color 255,255,255,255
MyPath=6,0 | LineTo 146,0 | CurveTo 146,0,150,6,150,3 | LineTo 150,10
Unbenannt.png
However, this Curve is a horror to me. What am I not understanding, or am I missing here?
I already don't want to succeed with the first Curve, and the next LineTo doesn't start at the Curve, but at the end of the first LineTo. It's disgusting... :vomit:

So since I discovered this SHAPE, I was totally excited at first and started replacing many graphics with Shape.
But slowly I'm just frustrated and thinking about undoing everything and going back to graphics.
It's really not fun anymore, when you spend 5 hours on it and try to get a curve.
In the time I have otherwise written a whole skin incl. graphics create.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

Youkai1977 wrote: April 5th, 2021, 10:21 amHowever, this Curve is a horror to me. What am I not understanding, or am I missing here?
I already don't want to succeed with the first Curve, and the next LineTo doesn't start at the Curve, but at the end of the first LineTo. It's disgusting... :vomit:

So since I discovered this SHAPE, I was totally excited at first and started replacing many graphics with Shape.
But slowly I'm just frustrated and thinking about undoing everything and going back to graphics.
It's really not fun anymore, when you spend 5 hours on it and try to get a curve.
In the time I have otherwise written a whole skin incl. graphics create.
First of all, when you design such meters, you must have whatever parameters set up consistently across the shapes. The second shape wasn't consistent with the first from that point of view, since the rounded corners had a radius of 4 px in the 1st shape, while the curves you used in the 2nd shape had a radius of 6 px (for example, you started the first line at (6,0) in that shape). Therefore, the shapes won't be exactly the same (I used the 6 px radius in my code, since you started the path shape with that) - and you can easily notice a small red part of the 1st shape in the bottom left corner that is not completely covered by the 2nd shape.

Secondly, once you do the above, the rest is quite simple:

Code: Select all

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

---Meters---

[BTN_1]
Meter=SHAPE
X=0
Y=1
Shape=Rectangle 0,0,150,29,4 | StrokeWidth 0 | Fill Color 255,0,0,255
Shape2=Rectangle -2,24,30,8 | StrokeWidth 0 | Skew 45,0
Shape3=Rectangle 0,20,4,4 | StrokeWidth 0
Shape4=Rectangle 0,16,8,8,4 | StrokeWidth 0
Shape5=Combine Shape | Exclude Shape2 | Exclude Shape3 | Union Shape4
UpdateDivider=-1

[BTN_2]
Meter=Shape
X=0
Y=1
Shape=Path MyPath | StrokeWidth 1.5 | Stroke Color 255,255,255,255 | Fill Color 0,0,255,255
MyPath=6,0 | LineTo 144,0 | CurveTo 150,6,144,0,150,0 | LineTo 150,23 | CurveTo 144,29,150,23,150,29 | LineTo 30,29 | LineTo 24,23 | LineTo 6,23 | CurveTo 0,17,6,23,0,23 | LineTo 0,6 | CurveTo 6,0,0,6,0,0 | ClosePath 1
I used a blue fill for the 2nd shape in order to be able to differentiate from the 1st shape:
Shapes.jpg
Third, I'm not really an expert in curves (or combined shapes for that matter), but the result turned out fine once I switched the (StartX,StartY) coordinates with the (EndX,EndY) in the curve so that the LineTo will follow on the path. In other words, apparently it's the (StartX,StartY), aka the first two coordinates of the CurveTo, that a following LineTo uses as a starting point, and not the (EndX, EndY), as you'd logically expect. I have no idea why is that, but it becomes easy to remember if you think in terms of the "first 2 coordinates" of each shape being the path points - for example in LineTo 144,0 | CurveTo 150,6,144,0,150,0, I used the LineTo coordinates as the 2nd set of coordinates in the curve, in a sense drawing the curve "backwards". This doesn't have any negative effect on the curve, so it's all good.

P.S. I noticed this LineTo vs CurveTo particularity when trying out the 2nd example in the manual here. I tried to draw a LineTo in the continuation of the curve and it became obvious that the LineTo's origin was the (0,0) point in the example and not the (100,100) one.
You do not have the required permissions to view the files attached to this post.
User avatar
Youkai1977
Posts: 139
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Thread for help with the Shape meter

Post by Youkai1977 »

Yincognito wrote: April 5th, 2021, 11:55 am First of all, when you design such meters, you must have whatever parameters set up consistently across the shapes. The second shape wasn't consistent with the first from that point of view, since the rounded corners had a radius of 4 px in the 1st shape, while the curves you used in the 2nd shape had a radius of 6 px (for example, you started the first line at (6,0) in that shape). Therefore, the shapes won't be exactly the same (I used the 6 px radius in my code, since you started the path shape with that) - and you can easily notice a small red part of the 1st shape in the bottom left corner that is not completely covered by the 2nd shape.
Oh man, there you say that you yourself are no expert and build me in short time my shape button after. O.O

That I actually have a 4px curve button is correctly recognized. The MyPath button should actually be the same. That it looked like I want to build a 6px curve button was probably misunderstood, because I posted my started test code in my help call posting.
It looks fine with 6px too, but I'll see if I can get that converted to 4px. If not, I know where to find you.... :D
Third, I'm not really an expert in curves (or combined shapes for that matter), but the result turned out fine once I switched the (StartX,StartY) coordinates with the (EndX,EndY) in the curve so that the LineTo will follow on the path. In other words, apparently it's the (StartX,StartY), aka the first two coordinates of the CurveTo, that a following LineTo uses as a starting point, and not the (EndX, EndY), as you'd logically expect. I have no idea why is that, but it becomes easy to remember if you think in terms of the "first 2 coordinates" of each shape being the path points - for example in LineTo 144,0 | CurveTo 150,6,144,0,150,0, I used the LineTo coordinates as the 2nd set of coordinates in the curve, in a sense drawing the curve "backwards". This doesn't have any negative effect on the curve, so it's all good.

P.S. I noticed this LineTo vs CurveTo particularity when trying out the 2nd example in the manual here. I tried to draw a LineTo in the continuation of the curve and it became obvious that the LineTo's origin was the (0,0) point in the example and not the (100,100) one.
Jo, as I said, I'm not an expert either. This whole Curve, Arc etc. stuff is too high for me.
A lot is well explained in the manuals, but in a technical language that a normal user hardly understands ... at least I do.
It's like an engineer writing a manual for a can opener.

Here is the code as I rewrote it to try to get 4px curves.
But I don't quite want to succeed. The last two (bottom left and top) don't seem to fit quite right.
What do you think?

Code: Select all

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

---Meters---

[BTN_1]
Meter=SHAPE
X=0
Y=1
Shape=Rectangle 0,0,150,29,4 | StrokeWidth 0 | Fill Color 255,0,0,255
Shape2=Rectangle -2,24,30,8 | StrokeWidth 0 | Skew 45,0
Shape3=Rectangle 0,20,4,4 | StrokeWidth 0
Shape4=Rectangle 0,16,8,8,4 | StrokeWidth 0
Shape5=Combine Shape | Exclude Shape2 | Exclude Shape3 | Union Shape4
UpdateDivider=-1

[BTN_2]
Meter=Shape
X=0
Y=1
Shape=Path MyPath | StrokeWidth 0 | Stroke Color 255,255,255,255 | Fill Color 0,0,255,255
MyPath=4,0 | LineTo 148,0 | CurveTo 150,3,146,0,150,0 | LineTo 150,27 | CurveTo 146,29,150,25,150,29 | LineTo 29,29 | LineTo 23,24 | LineTo 4,24 | CurveTo 0,19,3,24,0,24 | LineTo 0,3 | CurveTo 3,0,0,3,0,0 | ClosePath 1
Unbenannt.png
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

Youkai1977 wrote: April 6th, 2021, 9:24 amHere is the code as I rewrote it to try to get 4px curves.
Sorry, but this doesn't use 4px curves. How could it, when you used LineTo 148,0 instead of LineTo 146,0 (since 150-4=146 and not 148), or CurveTo 150,3,146,0,150,0 instead of CurveTo 150,4,146,0,150,0?

Anyway, I had some mistakes in my code as well, so here is the correct implementation:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
LeftMouseUpAction=[!ToggleMeterGroup ButtonGroup][!Redraw]

---Meters---

[BTN_1]
Group=ButtonGroup
Meter=SHAPE
X=0
Y=1
Shape=Rectangle 0,0,150,29,4 | StrokeWidth 0 | Fill Color 255,0,0,255
Shape2=Rectangle -2,24,30,8 | StrokeWidth 0 | Skew 45,0
Shape3=Rectangle 0,20,4,4 | StrokeWidth 0
Shape4=Rectangle 0,16,8,8,4 | StrokeWidth 0
Shape5=Combine Shape | Exclude Shape2 | Exclude Shape3 | Union Shape4
UpdateDivider=-1

[BTN_2]
Group=ButtonGroup
Hidden=1
Meter=Shape
X=0
Y=1
Shape=Path MyPath | StrokeWidth 0 | Stroke Color 255,255,255,255 | Fill Color 255,0,0,255
MyPath=4,0 | LineTo 146,0 | CurveTo 150,4,146,0,150,0 | LineTo 150,25 | CurveTo 146,29,150,25,150,29 | LineTo 29,29 | LineTo 24,24 | LineTo 4,24 | CurveTo 0,20,4,24,0,24 | LineTo 0,4 | CurveTo 4,0,0,4,0,0 | ClosePath 1
UpdateDivider=-1
The two meters are drawn using the same fill color now (different colors produce different effects on the human eye, e.g. a brighter color might make a shape look larger than a shape drawn using a darker color, despite them being the same), but one of those meters is hidden at all times. Comparing them is easy, just click on the skin and the hidden meter will be shown, while the previously shown meter will be hidden instead. Quickly clicking will help in rating whether the 2 shapes are exactly the same. Basically, if they are the same, you should notice no difference when clicking the skin.

Explaining the path values, and their relation with the 4px rounded corner radius:

Code: Select all

MyPath=(0+4),0 | LineTo (150-4),0 | CurveTo 150,(0+4),(150-4),0,150,0 | LineTo 150,(29-4) | CurveTo (150-4),29,150,(29-4),150,29 | LineTo 29,29 | LineTo 24,24 | LineTo (0+4),24 | CurveTo 0,(24-4),(0+4),24,0,24 | LineTo 0,(0+4) | CurveTo (0+4),0,0,(0+4),0,0 | ClosePath 1
So, you need to either add or subtract 4 from the "corners" of the original (0,0) to (150,29) rectangle used as a base for the shape, depending on which segment of the path you're at. My previous mistake was thinking the (29,29) and (24,24) path points were related to the rounded corner radius, but it appears they were not in their original form (i.e. they depended on the coordinates and the skew you applied to the 2nd rectangle in the original meter), so I established the points using a combination of looking at those coordinates and a little bit of trial and error (didn't want to use math just for that). That's why you don't see 4 being added or subtracted to get the coordinates of those points, but you do on the other path points.
User avatar
Youkai1977
Posts: 139
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Thread for help with the Shape meter

Post by Youkai1977 »

Sorry, but this doesn't use 4px curves. How could it, when you used LineTo 148,0 instead of LineTo 146,0 (since 150-4=146 and not 148), or CurveTo 150,3,146,0,150,0 instead of CurveTo 150,4,146,0,150,0?
I had not said that I have it right. :oops: As I said, I have my problems with it. I went rather after how the result looked on the screen. And there it made me an (almost) correct impression.
The two meters are drawn using the same fill color now (different colors produce different effects on the human eye, e.g. a brighter color might make a shape look larger than a shape drawn using a darker color, despite them being the same), but one of those meters is hidden at all times. Comparing them is easy, just click on the skin and the hidden meter will be shown, while the previously shown meter will be hidden instead. Quickly clicking will help in rating whether the 2 shapes are exactly the same. Basically, if they are the same, you should notice no difference when clicking the skin.

Explaining the path values, and their relation with the 4px rounded corner radius:
Ok, should I really just have succumbed to an optical illusion?
So what I noticed (on my PC system), that depending on which monitor I have a skin running, it either looks really good, or somehow, well how shall I say, as if sometimes the coordinates, or selected fonts etc. don't really fit.
But then I found out that it probably has to do with the quality (resolution).
If I move a skin to my main screen (actually a 4K TV device) I have a really great look of my skins. If I run the same skin on my temporary skin (a 16 year old no-name monitor with only 1440x900 pixels), some of my skins somehow do not look so great.

But that also the human eye plays there purely, that was less aware of me :confused:
So, you need to either add or subtract 4 from the "corners" of the original (0,0) to (150,29) rectangle used as a base for the shape, depending on which segment of the path you're at. My previous mistake was thinking the (29,29) and (24,24) path points were related to the rounded corner radius, but it appears they were not in their original form (i.e. they depended on the coordinates and the skew you applied to the 2nd rectangle in the original meter), so I established the points using a combination of looking at those coordinates and a little bit of trial and error (didn't want to use math just for that). That's why you don't see 4 being added or subtracted to get the coordinates of those points, but you do on the other path points.
Puhh, honestly, thank you for your good and detailed description, but I only understand ... nothing ... :???: :oops:
Not that I'm stupid, but lately I had probably an overdose Rainmeter ... must look at it all again in peace and quiet.
I made the mistake and started to convert too many skins at the same time ... and since I do altogether just too little with Rainmeter (is and should be only hobby) I just flood the forum here with my problems O.O :oops:

But ok, I'm just grateful for your patience with me and the help you get here...which I definitely appreciate. :thumbup: :rosegift:

So, then I will look at your correction now (try to understand *cough* :oops: ) and implement in my skin ...
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

Youkai1977 wrote: April 7th, 2021, 8:26 amI had not said that I have it right. :oops:
Well, if you want it to look right, you should have it right, isn't it? :D A circle is as round as you make it... :confused:

Youkai1977 wrote: April 7th, 2021, 8:26 amPuhh, honestly, thank you for your good and detailed description, but I only understand ... nothing ... :???: :oops:
Not that I'm stupid, but lately I had probably an overdose Rainmeter ... must look at it all again in peace and quiet.
I made the mistake and started to convert too many skins at the same time ... and since I do altogether just too little with Rainmeter (is and should be only hobby) I just flood the forum here with my problems O.O :oops:
Hehe, I just began writing some things in Lua for a Rainmeter skin (without any previous knowledge of the language), so I had a bit of an overdose as well, but I'm not complaining. Anyway, it's easy to understand the addition and subtraction of 4 from the shape coordinates, once you draw the shape and its points on a piece of paper. I could simulate such a schematic in Excel (since it has those cells simulating a grid), but I'm not sure if it would help...
User avatar
Youkai1977
Posts: 139
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Thread for help with the Shape meter

Post by Youkai1977 »

Well, if you want it to look right, you should have it right, isn't it? :D A circle is as round as you make it...
There's something to that. I will not contradict :Whistle
Hehe, I just began writing some things in Lua for a Rainmeter skin (without any previous knowledge of the language), so I had a bit of an overdose as well, but I'm not complaining. Anyway, it's easy to understand the addition and subtraction of 4 from the shape coordinates, once you draw the shape and its points on a piece of paper. I could simulate such a schematic in Excel (since it has those cells simulating a grid), but I'm not sure if it would help...
Oh for God's sake ... no so Lua I spare myself currently still completely. If I start with it now, I can hang my family and my real life on the proverbial nail. O.O
I have had a look at some other Lua files and I think I can see some similarities to HTML ... but that was it already. And even if I am right with my assumption that the language in Lua files is similar to HTML. So my knowledge in this language is also rusty. I have programmed the first and last time an internet page about 20 years ago ... in pure HTML. No PHP, Java or anything else yet.
In short, currently I came in contact with 3 programming languages in my life. BASIC (Commodore 16/64/128 ... yes I am old :oops: ), simple HTML and now Rainmeter. Whereby I have not figured out the latter until today ... is this a programming language at all?

In short ... when I started to rebuild my suite at the end of january this year, I ONLY wanted to use it. Now it's almost mid-April and I'm still not done. Not one skin runs as it should, or was not even started with rewriting or rewrite. :( :-(

Slowly Rainmeter (which is actually only hobby for me) to the life task.
I slow myself down by ignoring Rainmeter and my problem skins for days on end.

In short, ... I think I'm getting too old for this crap. And due to some adverse life circumstances at the moment it's also difficult to concentrate on something like Rainmeter and learning new things about it. Not that I am not willing, I have learned a lot of new things about Rainmeter in the last 3 months and also implemented them. But it was not easy. And without you or the forum here, I probably would have long since hit the bag.
That's why I have become mostly pragmatic. If I do not get something going in the short term, it flies out again and is implemented elsewhere or not at all.

But enough crying ... I'm moving on. But one gear slower. :thumbup:
User avatar
Yincognito
Rainmeter Sage
Posts: 4052
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

Youkai1977 wrote: April 9th, 2021, 9:01 amOh for God's sake ... no so Lua I spare myself currently still completely. If I start with it now, I can hang my family and my real life on the proverbial nail. O.O
Haha, yeah, I feel you - was thinking the same when starting, but once I managed to get things right, I began to like it. I wouldn't recommend it to the regular user or for tasks that can be achieved otherwise though, native Rainmeter is powerful enough despite its apparent simplicity. Thing is, for my current goal, native Rainmeter was not enough: while I could very well do the things I wanted, because of the size of the data (I was trying to iterate and edit through a > 5 MB JSON-like text file), it operated quite slowly. Lua's tables (a kind of "arrays") helped with that greatly.
Youkai1977 wrote: April 9th, 2021, 9:01 amIn short, ... I think I'm getting too old for this crap. And due to some adverse life circumstances at the moment it's also difficult to concentrate on something like Rainmeter and learning new things about it. Not that I am not willing, I have learned a lot of new things about Rainmeter in the last 3 months and also implemented them. But it was not easy. And without you or the forum here, I probably would have long since hit the bag.
Yep, I can understand that age and real life circumstances affect other tasks, but I do believe that one is never too old to do what he likes. Sure, a little bit in slow motion and all that, but passion for something is always a powerful driving force. ;-)
User avatar
balala
Rainmeter Sage
Posts: 13207
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Thread for help with the Shape meter

Post by balala »

Youkai1977 wrote: April 9th, 2021, 9:01 am In short, currently I came in contact with 3 programming languages in my life. BASIC (Commodore 16/64/128 ... yes I am old :oops: ), simple HTML and now Rainmeter. Whereby I have not figured out the latter until today ... is this a programming language at all?
From these three, only Basic is a real programming language. HTML is considered to be:
the standard markup language for documents designed to be displayed in a web browser.
Rainmeter is not a programing language either, not having the characteristics of a programming language.

Lua on the other hand is a real programming langugae, which even if you're afraid of it, is not a realy hard language (at least the basics). Recommend to try it out, it might be really useful in many cases. On this forum you have a Lua Scripting section, where you can find the answers to many questions related to Lua (if you are interested). But getting used with using it requires a little time and work.