It is currently November 18th, 2018, 11:43 pm

Thread for help with the new Shape meter

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

Thread for help with the new Shape meter

jsmorley » November 6th, 2016, 6:57 pm

Please use this thread, or start a new one here in "Help Rainmeter Skins" if you have questions about or need help with the new Shape Meter.
User avatar
ikarus1969
Posts: 287
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Thread for help with the new Shape meter

ikarus1969 » November 7th, 2016, 7:59 pm

Hi!

I just started with a very basic shape - a 10x10 square with this code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Meter_Shape]
Meter=SHAPE
Shape=Rectangle #WORKAREAX#, #WORKAREAY#, 10, 10 | Fill Color 128, 0, 0
and got this picture (magnified):
Screenshot Shape very basic.png
I see a 11x11 square. What's the gray area on the right and at the bottom?
Is it ok to be there?

regards,
ikarus1969
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 18329
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

jsmorley » November 7th, 2016, 8:46 pm

ikarus1969 wrote:Hi!

I just started with a very basic shape - a 10x10 square with this code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Meter_Shape]
Meter=SHAPE
Shape=Rectangle #WORKAREAX#, #WORKAREAY#, 10, 10 | Fill Color 128, 0, 0
and got this picture (magnified):
Screenshot Shape very basic.png

I see a 11x11 square. What's the gray area on the right and at the bottom?
Is it ok to be there?

regards,
ikarus1969
Strokes are not "borders", they are the "drawing stroke" of the shape. So in a sense the stroke is "half inside" and "half outsde" the boundary of the shape. The way Windows / D2D handles an odd-numbered StrokeWidth, like the default "1", is that it actually draws "half pixels" by aliasing the outside and inside edge of the stroke. I'm sure that is what you are seeing.

The reason you are getting that on the "right" and "bottom", and not the "top"and "left", is that you have your meter, and thus the skin, set to the far left and top of the workarea. In fact, the storke is being "truncated" by half a pixel on the top and left... If you set it to be (#WORKAREAX# + 1) or use X=1 on the meter itself, you should see the aliasing all the way around it.

Try it with StrokeWidth=2 and see if that doesn't go away.
User avatar
jsmorley
Developer
Posts: 18329
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

jsmorley » November 7th, 2016, 9:30 pm

Code: Select all

[MeterShape]
Meter=Shape
X=1
Y=1
Shape=Rectangle 0,0,100,100 | StrokeWidth 1 | Fill Color 255,0,0,255
1.jpg
3.jpg

Code: Select all

[MeterShape]
Meter=Shape
X=1
Y=1
Shape=Rectangle 0,0,100,100 | StrokeWidth 2 | Fill Color 255,0,0,255
2.jpg
4.jpg
Generally I try to avoid "odd-numbered" StrokeWidth because of this, but of course there are times that "1" is the best answer, and I don't mind that, as the net effect of "1" is more "washed out", than "aliased", since it's made of of "two 1/2 pixels" in a sense. So it's all aliased...
You do not have the required permissions to view the files attached to this post.
User avatar
FreeRaider
Posts: 752
Joined: November 20th, 2012, 11:58 pm

Re: Thread for help with the new Shape meter

FreeRaider » November 7th, 2016, 9:33 pm

So jsmorley, is it normal to have a small space between a meter=shape and a meter=image?
shape.png

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Meter_Shape]
Meter=SHAPE
Shape=Rectangle #WORKAREAX#, #WORKAREAY#, 500, 500 | Fill Color 128, 0, 0

[MeterImage]
Meter=Image
X=0R
Y=0
W=500
H=500
SolidColor=128,0,0,255
AntiAlias=1
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 18329
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

jsmorley » November 7th, 2016, 9:39 pm

FreeRaider wrote:So jsmorley, is it normal to have a small space between a meter=shape and a meter=image?shape.png

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Meter_Shape]
Meter=SHAPE
Shape=Rectangle #WORKAREAX#, #WORKAREAY#, 500, 500 | Fill Color 128, 0, 0

[MeterImage]
Meter=Image
X=0R
Y=0
W=500
H=500
SolidColor=128,0,0,255
AntiAlias=1
I'm sure that is related to D2D doing those "half pixels" on odd-numbered StrokeWidth, which while they display fine, Rainmeter, that only understands "full pixels" doesn't quite know what to do with half a pixel.

Again, if you use even-numbered StrokeWidth's this TINY issue shouldn't be there.
User avatar
jsmorley
Developer
Posts: 18329
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

jsmorley » November 7th, 2016, 9:43 pm

Code: Select all

[MeterShape]
Meter=Shape
X=1
Y=1
Shape=Rectangle 0,0,100,100 | StrokeWidth 2 | Fill Color 255,0,0,255

[MeterImage]
Meter=Image
X=0R
W=100
H=100
SolidColor=255,0,0,255
5.jpg
6.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 18329
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

jsmorley » November 7th, 2016, 9:48 pm

It's important to wrap your head around the fact that a "stroke" is not in any way a "border", inside or outside the shape. It IS the shape. The "red" color in those examples are a "fill" of the shape defined by the "stroke".

The stroke is "centered" on the pixel(s) you are drawing on. That is why with a StrokeWidth of 1 or 3 or 5, D2D says:

"Ok, I need half of the stroke inside the singularity that defines the drawing line, and half outside. Wait! If I can't divide the StrokeWidth evenly by "2", it can't evenly be half in and half out. Ah, I know, I'll do a half-pixel inside, and a half-pixel outside". Hm..How to do that... I know, I'll "alias" the edge of the pixels, and then just lie to the application and tell it the stroke is 1 or 3 or 5. It will never know the difference."

That is why you are getting what "looks like" a half-pixel gap in your image. It's really a full pixel just half-aliased.
User avatar
FreeRaider
Posts: 752
Joined: November 20th, 2012, 11:58 pm

Re: Thread for help with the new Shape meter

FreeRaider » November 7th, 2016, 10:09 pm

The problem is that from your picture, it is clear that the rectangle on the left has a greater height of the rectangle to the right (and I image the same thing for the width).
height.png


P.S.:I do not want to be controversial, I really appreciate your work.
You do not have the required permissions to view the files attached to this post.
Last edited by FreeRaider on November 7th, 2016, 10:13 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 18329
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Thread for help with the new Shape meter

jsmorley » November 7th, 2016, 10:13 pm

FreeRaider wrote:The problem is that from your picture, it is clear that the rectangle on the left has a greater height of the rectangle to the right (and I image the same thing for the width).
height.png
Yep. the half of the StrokeWidth that is "outside" the drawing line will increase the overall size of the result.

I have StrokeWidth=2, so with half the stroke in and half the stroke out, that means the overall size of the result is 2 pixels larger. 1 on the left and one on the right... One on the top and one on the bottom.

Do it with StrokeWidth=0, and you will see that the shapes are the same size.

Code: Select all

[MeterShape]
Meter=Shape
Shape=Rectangle 0,0,100,100 | StrokeWidth 0 | Fill Color 255,0,0,255

[MeterImage]
Meter=Image
X=0R
W=100
H=100
SolidColor=255,0,0,255
The red stuff is NOT the shape. The stroke is...