It is currently April 13th, 2021, 11:16 am

## Thread for help with the Shape meter

Help with creating, editing & fixing problems with skins
jsmorley
Developer
Posts: 21617
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

### Re: Thread for help with the new Shape meter

FreeRaider wrote:Where am i wrong?
Sorry, it was my bad above... You need to divide the StrokeWidth in half when you use it to change the "size" of the shape, if you want the overall meter size to stay constant while you change the StrokeWidth. Again, half the stroke is "inside" and half "outside", so the net effect of the stoke on the size is really (Ceil(StrokeWidth /2)). Don't worry about "ceiling" it, Rainmeter will do that automatically since it can't understand half pixels.
In order to have a shape that has a StrokeWidth of 10, and the entire shape, including the stroke, MUST be exactly 200 wide, you can certainly do that. You just have to define the "size" of the shape with a value that is (200 - (StrokeWidth/2)). So the shape will have a width of 190, half the StrokeWidth will be added to the left, and half to the right, and the resulting meter will be exactly 200 wide.

Code: Select all

``````[MeterRectangle]
Meter=Shape
X=10
Y=10
Shape=Rectangle 0,0,(100-(#sw#/2)),(100-(#sw#/2)) | StrokeWidth #sw# | Fill Color 255,0,0,255
MouseScrollDownAction=[!SetVariable sw "(#sw#<20 ? (#sw#+1) : 20)"][!UpdateMeter *][!Redraw]
MouseScrollUpAction=[!SetVariable sw "(#sw#>1 ? (#sw#-1) : 0)"][!UpdateMeter *][!Redraw]
DynamicVariables=1
``````
GIF.gif
P.S. Make SURE you leave enough room in the skin for 1/2 of the StrokeWidth. You were not, and the stroke was being "truncated" on the top and left as it "grew". Setting either the X and Y of the meter or the X and Y of the shape within the meter to 10 will take care of it when you have a maximum StrokeWidth of 20.
You do not have the required permissions to view the files attached to this post.
eclectic-tech
Rainmeter Sage
Posts: 4245
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

### Re: Thread for help with the new Shape meter

My 2 cents!

You do not want to subtract the strokewidth from the dimension...
Try this skin with an invisible fill.

Code: Select all

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

[Variables]
sw=0

[MeterRectangle]
Meter=Shape
X=50
Y=20
Shape=Rectangle 0,0,100,100 | StrokeWidth #sw# | Fill Color 0,0,0,1
MouseScrollDownAction=[!SetVariable sw "(#sw#<20 ? (#sw#+1) : 20)"][!UpdateMeter *][!Redraw]
MouseScrollUpAction=[!SetVariable sw "(#sw#>1 ? (#sw#-1) : 0)"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterWidthHeight]
Meter=String
X=0
Y=140
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
Text=StrokeWidth:#sw#  W:[MeterRectangle:W]  H:[MeterRectangle:H]
DynamicVariables=1
``````
The point is that the StrokeWidth "IS" the shape image. The dimensions control the width and height of the stroke, NOT the dimension of the final shape size.

If you increase the stroke width, the stroke drawn will increase the size of the image by ~ 1/2 the StrokeWidth (half of the stroke is drawn inside the dimension given and the other half of the stroke is drawn outside the dimension given)...

The shape size is the dimension given + approximately half the stroke size (because Rainmeter works in full pixels, and does not understand 1/2 pixel width).

Hope this helps!
jsmorley
Developer
Posts: 21617
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

### Re: Thread for help with the new Shape meter

eclectic-tech wrote:My 2 cents!
Absolutely right, but FreeRaider was trying to see how to "beat that", how to increase the StrokeWidth, while keeping the overall size of the shape + stroke the same. So we are just "robbing Peter to pay Paul" if you see what I mean. In order for [MeterName:W] to remain constant, you have to "decrease the interior" of the shape while you "increase the exterior" by increasing the StrokeWidth.
eclectic-tech
Rainmeter Sage
Posts: 4245
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

### Re: Thread for help with the new Shape meter

Yeah, I see what he wants to achieve now. I was going to say the same as you, that subtracting the (StrokeWidth/2) would keep the original dimensions.

As this meter expands to arcs and lines, etc. understanding that the stroke is what is being drawn will be more evident and an attempt to match it to our old rectangular skins/meters will be less important.

But I do understand freeraiders desire to be able to match this new meter with what exists in the image meter. It would make designing and arranging shape meters to previous meters less of a hassle. But the designer is going to have to implement your suggestion if that is what they want...

It is all a learning curve, and we are all sliding down it together!
FreeRaider
Posts: 804
Joined: November 20th, 2012, 11:58 pm

### Re: Thread for help with the new Shape meter

Using as the type shape line, I have created a triangle. How do I apply fill color?

Code: Select all

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

[MeterShape]
Meter=Shape
X=0
Y=0
Shape=Line 0,0,25,50 |  StrokeWidth 1 | Fill Color 0,0,0,255
Shape2=Line 25,50,19,69 |  StrokeWidth 1
Shape3=Line 19,69,0,0 |  StrokeWidth 1
Shape4=Combine Shape | Union Shape2 | Union Shape3``````
Thanks
jsmorley
Developer
Posts: 21617
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

### Re: Thread for help with the new Shape meter

FreeRaider wrote:Using as the type shape line, I have created a triangle. How do I apply fill color?

Thanks
You don't. The Line shape is always "open", and while you can fill a shape like an Arc or a Curve, even if it is open, there just isn't anything to fill with a line.

You can't use Combine to create a closed path. That is not the intent of it...

Now the good news. The actual Path shape type is coming, its coming pretty soon. With that, you will in fact be able to do:

Code: Select all

``````[MeterShape]
Meter=Shape
X=0
Y=0
Shape=Path MyPath | StrokeWidth 1 | Stroke Color 255,255,255,255 | Fill Color 0,0,0,255
MyPath=0,0 | LineTo 25,50 | LineTo 19,69 | LineTo 0,0
``````
1.jpg
Just hang in there.. Combine is very useful, even with shapes like Arc and Curve that are not closed, (although the result will always be closed) but it can't be used to turn lines into closed paths. The Path shape is what you want.
You do not have the required permissions to view the files attached to this post.
FreeRaider
Posts: 804
Joined: November 20th, 2012, 11:58 pm

### Re: Thread for help with the new Shape meter

Oh, this is good news. I'll waiting for this new type of shape.
jsmorley
Developer
Posts: 21617
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

### Re: Thread for help with the new Shape meter

BTW, just a hint, or a personal preference, but I'd be tempted to stay away from StrokeWidth 1 on shapes with edges that are not perpendicular. The reason is the "aliasing" of the 1/2 pixels that D2D does with odd-numbered stroke widths. In my opinion you get a lot of "jaggy" with "1", that you don't get with "2".
jsmorley
Developer
Posts: 21617
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

### Re: Thread for help with the new Shape meter

Also FreeRaider,

Be a bit careful with this:

X=0
Y=0
Shape=Line 0,0,25,50 | StrokeWidth 1

The issue is that even with a StrokeWdith of 1, half of the stroke is "outside" the shape. So ok, in this case it's "half a pixel" outside, but even that half pixel will be truncated if it is drawn outside the skin. If you have a meter at X=0 and Y=0 and define the shape as starting at 0,0, a small part of the left and top strokes will be cut off.

X=1
Y=1
Shape=Line 0,0,25,50 | StrokeWidth 1

OR

X=0
Y=0
Shape=Line 1,1,26,51 | StrokeWidth 1

AS you use the Shape meter, you will find that you really must come to terms with the fact that as with all meters, Rainmeter will "expand" the size of the skin "down" or "right" as needed to accommodate the meter. It won't, and can't, expand the skin "up" or "left". In order to do that, any change to the size of your shape would not only have to "size" it, but in effect literally and visibly "move" it as well. The X and Y of the SKIN on your monitor can't be dynamically changed, that would just chase the skin all over the screen every time you refreshed it. So to keep the skin the same position on the monitor, but make it fit your shape, we would automatically have to "move" the shape within the skin. This is not what you are going to want 99% of the time.

This is going to become even more clear when you start using shapes that by their very nature will draw part of the shape to the left or above the starting point. Ellipse is a good example. It draws a circle based on the "center" of the circle. If you do this:

X=0
Y=0
Shape=Ellipse 0,0,100

What will happen is that half of the left, and half of the top, of the circle will be outside the skin and truncated. You have to "leave room" in the skin for your shape(s)...
2.jpg
X=0
Y=0
Shape=Ellipse 100,100,100
3.jpg
I'm sure that your example was a quick and dirty one to demonstrate your point, but be aware... I'll nag about it every time I see it.
You do not have the required permissions to view the files attached to this post.
FreeRaider
Posts: 804
Joined: November 20th, 2012, 11:58 pm

### Re: Thread for help with the new Shape meter

This new meter does not want to get into my mind.