It is currently June 16th, 2021, 10:13 am

Mouth shape question

Help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Mouth shape question

Post by balala »

Yincognito wrote: June 5th, 2021, 8:44 pm So much for my perfect workaround, LMAO. After the CurveTo experiment, I'm not sure the culprit is the SweepDirection parameter of arcs anymore, since cubic Bezier curves like this lack that parameter in Rainmeter. It seems the problem has a greater extent than I thought, and more shapes are affected, just like death.crafter stated earlier... :confused:
Alright, thanks for the effort. Sooner or later I'll post a description to the Bugs section, unless I'm getting a reply here from a dev.
User avatar
Yincognito
Posts: 3184
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mouth shape question

Post by Yincognito »

balala wrote: June 5th, 2021, 8:55 pm Alright, thanks for the effort. Sooner or later I'll post a description to the Bugs section, unless I'm getting a reply here from a dev.
No problem. For the record, swapping the 1st ArcTo with the 2nd doesn't work either. I'm curious about what the devs will find about this and which is the actual culprit, so I'll patiently wait for their answer. It'll be difficult to give up trying to fix this though, it's just not my style of backing off in front of a problem where I feel a reasonable solution is within grasp. :Whistle
User avatar
ikarus1969
Posts: 429
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Mouth shape question

Post by ikarus1969 »

When you add the option StrokeLineJoin Round to your Shape then you get the following result. Isn't that what you want?

the code would be:

Code: Select all

[Rainmeter]
Update=-1
BackgroundMode=2
SolidColor=220,220,220
SkinWidth=140
SkinHeight=200

[MeterMouth1]
Meter=Shape
X=0
Y=0
Shape=Path MyPath | StrokeWidth 2 | Stroke Color 0,0,0 | Fill Color 255,255,255 | StrokeLineJoin Round
MyPath=10,65 | ArcTo 130,65,60,20,0,1,0 | ArcTo 10,65,60,80,1,0,0
RM StrokeLineJoin.png
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Posts: 3184
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mouth shape question

Post by Yincognito »

ikarus1969 wrote: June 6th, 2021, 11:49 amWhen you add the option StrokeLineJoin Round to your Shape then you get the following result. Isn't that what you want?
I'll let balala answer that, but for the record, though an excellent alternative workaround, this does pretty much the same as my additional LineTo segment, in that it "just" alleviates the problem and does not "fix" it - something easily seen when one increases the StrokeWidth from 2 to, say, 10 (scroll to see the similarity and the differences between the two current workarounds, i.e. mine and yours):

Code: Select all

[Variables]
Style=0

[Rainmeter]
Update=-1
BackgroundMode=2
SolidColor=220,220,220
SkinWidth=140
SkinHeight=200

[Style0]
Shape=Path MyPath | StrokeWidth 10 | Stroke Color 0,0,0 | Fill Color 255,255,255
MyPath=10,65 | ArcTo 130,65,60,20,0,1,0 | LineTo 130,65 | ArcTo 10,65,60,80,0,0,0

[Style1]
Shape=Path MyPath | StrokeWidth 10 | Stroke Color 0,0,0 | Fill Color 255,255,255 | StrokeLineJoin Round
MyPath=10,65 | ArcTo 130,65,60,20,0,1,0 | ArcTo 10,65,60,80,0,0,0

[MeterMouth]
Meter=Shape
X=0
Y=0
MeterStyle=Style#Style#
MouseScrollUpAction=[!SetVariable Style (1-#Style#)][!UpdateMeter MeterMouth][!Redraw]
MouseScrollDownAction=[!SetVariable Style (1-#Style#)][!UpdateMeter MeterMouth][!Redraw]
DynamicVariables=1
Not trying to take anything from your solution, in fact the more workarounds the better, I'm just saying the two approaches produce similar results (with all the pluses and minuses of that). :confused:

P.S. On the upside, at least now we know there is more than one way to achieve the desired outcome for lower StrokeWidth values. :thumbup:
User avatar
Yincognito
Posts: 3184
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mouth shape question

Post by Yincognito »

balala wrote: June 5th, 2021, 8:55 pmAlright, thanks for the effort...
Yincognito wrote: June 5th, 2021, 8:44 pmIn the search for the perfect workaround (I like perfection as you probably remember, LOL)...
Yincognito wrote: June 5th, 2021, 9:16 pmIt'll be difficult to give up trying to fix this though, it's just not my style of backing off in front of a problem where I feel a reasonable solution is within grasp. :Whistle
Well, it seems a good night sleep is a good adviser, after all. I found the perfect workaround, which doesn't produce any unwanted artefacts irrespective of the StrokeWidth value. I knew the key to this was to make the shape parts intersect "better" so that they "fully" cross-over one another and a higher stroke width won't cause loosing the actual intersection point (rounding errors, maybe?) and it was clear the ArcTo and CurveTo in the Path option were not doing any of the above, so I returned to basics. Arcs are simulated in Rainmeter by intersecting two ellipses in various ways, so drawing ellipses and intersecting them instead of drawing arcs is more or less the same, but it makes the problem go away ... as long as those ellipses FULLY cross over one another (optionally taking a bit of StrokeWidth leeway into account):

Code: Select all

[Variables]
Style=0

[Rainmeter]
Update=-1
BackgroundMode=2
SolidColor=220,220,220
SkinWidth=140
SkinHeight=200

[Style0]
Shape=Path MyPath | StrokeWidth 10 | Stroke Color 0,0,0 | Fill Color 255,255,255
MyPath=10,65 | ArcTo 130,65,60,20,0,1,0 | ArcTo 10,65,60,80,0,0,0

[Style1]
Shape=Ellipse 70,65,60,80 | StrokeWidth 10 | Stroke Color 0,0,0 | Fill Color 255,255,255 | StrokeLineJoin Round
Shape2=Ellipse 70,0,100,85
Shape3=Combine Shape | Exclude Shape2

[MeterMouth]
Meter=Shape
X=0
Y=0
MeterStyle=Style#Style#
MouseScrollUpAction=[!SetVariable Style (1-#Style#)][!UpdateMeter MeterMouth][!Redraw]
MouseScrollDownAction=[!SetVariable Style (1-#Style#)][!UpdateMeter MeterMouth][!Redraw]
DynamicVariables=1
The default Style0 is the original form of the code with ArcTo-s (no workaround applied), while Style1 is the proper (but temporary, until the devs correct this) fix - mouse scroll to switch from one to another. The 1st ellipse is just the same as the 2nd ArcTo (bar the CenterX that is easy to calculate), but the having the 2nd ellipse larger so that it properly intersects the 1st one - which apparently doesn't happen in the ArcTo scenario - is the thing that does the trick. Using a smaller or a similar ellipse to the 1st ArcTo won't work, simply because due to unknown factors (rounding errors might possibly be the culprit here) the smaller ellipse won't properly "touch" or "cut" the 1st ellipse at the desired intersection points. It changes a bit the parameters one works with, true, but it completely solves the problem.

Comparison - before:
Comparison - Before.jpg
Comparison - after:
Comparison - After.jpg
P.S. I took the liberty to use ikarus1969's suggestion regarding rounding the line join in order to "smooth" the intersection points. It works without it too, but I feel it looks better this way.
P.S.S. There's only one possible drawback to this solution, if one has DynamicWindowSize=1 in the [Rainmeter] section and the larger ellipse makes the skin larger as well, but then these things can be fixed by placing stuff in a container. Not that nice, but it will work.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Mouth shape question

Post by balala »

ikarus1969 wrote: June 6th, 2021, 11:49 am When you add the option StrokeLineJoin Round to your Shape then you get the following result. Isn't that what you want?
Thanks ikarus, I'm gonna test this tomorrow afternoon (UTC+3), because today had a full day and had no enough time to test it. Hope it'll help, but tomorrow I'll let you know.
Yincognito wrote: June 6th, 2021, 1:29 pm I'll let balala answer that, but for the record, though an excellent alternative workaround, this does pretty much the same as my additional LineTo segment, in that it "just" alleviates the problem and does not "fix" it - something easily seen when one increases the StrokeWidth from 2 to, say, 10 (scroll to see the similarity and the differences between the two current workarounds, i.e. mine and yours):
Yincognito wrote: June 6th, 2021, 2:39 pm Well, it seems a good night sleep is a good adviser, after all. I found the perfect workaround, which doesn't produce any unwanted artefacts irrespective of the StrokeWidth value. I knew the key to this was to make the shape parts intersect "better" so that they "fully" cross-over one another and a higher stroke width won't cause loosing the actual intersection point (rounding errors, maybe?) and it was clear the ArcTo and CurveTo in the Path option were not doing any of the above, so I returned to basics. Arcs are simulated in Rainmeter by intersecting two ellipses in various ways, so drawing ellipses and intersecting them instead of drawing arcs is more or less the same, but it makes the problem go away ... as long as those ellipses FULLY cross over one another (optionally taking a bit of StrokeWidth leeway into account):
Will test your codes as well, as said to ikarus today had no time. Sorry...
User avatar
Yincognito
Posts: 3184
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mouth shape question

Post by Yincognito »

balala wrote: June 6th, 2021, 8:04 pmWill test your codes as well, as said to ikarus today had no time. Sorry...
No problem, take your time. ;-)
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Mouth shape question

Post by balala »

ikarus1969 wrote: June 6th, 2021, 11:49 am When you add the option StrokeLineJoin Round to your Shape then you get the following result. Isn't that what you want?
Finally had today enough time to check everything is needed. Your idea seems excelent, it does the job properly, so this is what I'm gonna use. Thank you very much for it. :thumbup:
However I'm posting the description of this issue into the Bugs & Feature Suggestions section as well. I'm curious about what devs will say. Let's see...
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Mouth shape question

Post by balala »

Yincognito wrote: June 6th, 2021, 2:39 pm Well, it seems a good night sleep is a good adviser, after all. I found the perfect workaround, which doesn't produce any unwanted artefacts irrespective of the StrokeWidth value. I knew the key to this was to make the shape parts intersect "better" so that they "fully" cross-over one another and a higher stroke width won't cause loosing the actual intersection point (rounding errors, maybe?) and it was clear the ArcTo and CurveTo in the Path option were not doing any of the above, so I returned to basics. Arcs are simulated in Rainmeter by intersecting two ellipses in various ways, so drawing ellipses and intersecting them instead of drawing arcs is more or less the same, but it makes the problem go away ... as long as those ellipses FULLY cross over one another (optionally taking a bit of StrokeWidth leeway into account):

Code: Select all

[Variables]
Style=0

[Rainmeter]
Update=-1
BackgroundMode=2
SolidColor=220,220,220
SkinWidth=140
SkinHeight=200

[Style0]
Shape=Path MyPath | StrokeWidth 10 | Stroke Color 0,0,0 | Fill Color 255,255,255
MyPath=10,65 | ArcTo 130,65,60,20,0,1,0 | ArcTo 10,65,60,80,0,0,0

[Style1]
Shape=Ellipse 70,65,60,80 | StrokeWidth 10 | Stroke Color 0,0,0 | Fill Color 255,255,255 | StrokeLineJoin Round
Shape2=Ellipse 70,0,100,85
Shape3=Combine Shape | Exclude Shape2

[MeterMouth]
Meter=Shape
X=0
Y=0
MeterStyle=Style#Style#
MouseScrollUpAction=[!SetVariable Style (1-#Style#)][!UpdateMeter MeterMouth][!Redraw]
MouseScrollDownAction=[!SetVariable Style (1-#Style#)][!UpdateMeter MeterMouth][!Redraw]
DynamicVariables=1
The default Style0 is the original form of the code with ArcTo-s (no workaround applied), while Style1 is the proper (but temporary, until the devs correct this) fix - mouse scroll to switch from one to another. The 1st ellipse is just the same as the 2nd ArcTo (bar the CenterX that is easy to calculate), but the having the 2nd ellipse larger so that it properly intersects the 1st one - which apparently doesn't happen in the ArcTo scenario - is the thing that does the trick. Using a smaller or a similar ellipse to the 1st ArcTo won't work, simply because due to unknown factors (rounding errors might possibly be the culprit here) the smaller ellipse won't properly "touch" or "cut" the 1st ellipse at the desired intersection points. It changes a bit the parameters one works with, true, but it completely solves the problem.

Comparison - before:
Comparison - Before.jpg
Comparison - after:
Comparison - After.jpg

P.S. I took the liberty to use ikarus1969's suggestion regarding rounding the line join in order to "smooth" the intersection points. It works without it too, but I feel it looks better this way.
P.S.S. There's only one possible drawback to this solution, if one has DynamicWindowSize=1 in the [Rainmeter] section and the larger ellipse makes the skin larger as well, but then these things can be fixed by placing stuff in a container. Not that nice, but it will work.
Besides ikarus1969's code, yours is interesting as well. However it might be a little bit more complicated (since the drawn mouth I'm realizing will be used into a more complex Shape meter, which will have more other shapes, which will be combined), so I'm gonna use ikarus1969's code. But thank you for the help. It's valuable as well.
User avatar
Yincognito
Posts: 3184
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mouth shape question

Post by Yincognito »

balala wrote: June 8th, 2021, 6:49 pm Besides ikarus1969's code, yours is interesting as well. However it might be a little bit more complicated (since the drawn mouth I'm realizing will be used into a more complex Shape meter, which will have more other shapes, which will be combined), so I'm gonna use ikarus1969's code. But thank you for the help. It's valuable as well.
Of course - go ahead and use the most suited choice for your case. ;-) I only wanted to show that one can workaround in such a way to completely eliminate the problem. In any case, these workarounds will be obsolete once the devs fix the bug, so they only serve as temporary solutions (and challenges). :D