It is currently April 19th, 2024, 5:47 pm

[Solved] How to achieve solid 1px border around histograms and barmeters?

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

Re: How to achieve solid 1px border around histograms and barmeters?

Post by jsmorley »

Dany Gee wrote:This one:
Ah good, that's my favorite too.
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Re: [Solved] How to achieve solid 1px border around histograms and barmeters?

Post by rxtd »

Although this one is already solved, I was wondering: wouldn't it be easier solution to use stroke with half-pixel offset? Like this:

Code: Select all

[MeterTest]
Meter=Shape
Shape=Rectangle 0.5,0.5,99,49 | Fill Color 00000000 | StrokeWidth 1
Shape2=Rectangle 1,1,98,48 | Fill Color 00000032 | StrokeWidth 0
2017-05-01_19-03-41.png
Despite stroke with 1 pixel width is usually drawn on 2 real pixels we have set upper left coordinates of shape to half-pixel position so we see exactly one-pixel border around 98*48 pixels area.

For thicker borders we can also use strokes:

Code: Select all

Shape=Rectangle (#stroke_width# / 2),(#stroke_width# / 2),(100 - #stroke_width#),(50 - #stroke_width#) | Fill Color 00000000 | StrokeWidth #stroke_width#
This solution is less customizable since we can't change stroke width on only one side but for border we usually don't need it.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Solved] How to achieve solid 1px border around histograms and barmeters?

Post by jsmorley »

rxtd wrote:Although this one is already solved, I was wondering: wouldn't it be easier solution to use stroke with half-pixel offset? Like this:

Code: Select all

[MeterTest]
Meter=Shape
Shape=Rectangle 0.5,0.5,99,49 | Fill Color 00000000 | StrokeWidth 1
Shape2=Rectangle 1,1,98,48 | Fill Color 00000032 | StrokeWidth 0
2017-05-01_19-03-41.png

Despite stroke with 1 pixel width is usually drawn on 2 real pixels we have set upper left coordinates of shape to half-pixel position so we see exactly one-pixel border around 98*48 pixels area.

For thicker borders we can also use strokes:

Code: Select all

Shape=Rectangle (#stroke_width# / 2),(#stroke_width# / 2),(100 - #stroke_width#),(50 - #stroke_width#) | Fill Color 00000000 | StrokeWidth #stroke_width#
This solution is less customizable since we can't change stroke width on only one side but for border we usually don't need it.
Yeah, that seems to work pretty nice. I'm still getting used to the idea of "half-pixels" that DIP introduces... ;-)

I think this is the best / correct answer. You win a gold star!

Code: Select all

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

[MeterTest1]
Meter=Shape
Shape=Rectangle 0.5,0.5,300,150 | Fill Color 47,47,47,200 | StrokeWidth 1.5 | Stroke Color 255,255,255,255

[MeterTest2]
Meter=Shape
Y=10R
Shape=Rectangle 1,1,300,150 | Fill Color 47,47,47,200 | StrokeWidth 1 | Stroke Color 255,255,255,255
1.png
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Solved] How to achieve solid 1px border around histograms and barmeters?

Post by jsmorley »

This solution actually looks a lot better than the "aliased" 1px strokes.

Code: Select all

[MeterAllBackground]
Meter=Shape
Shape=Rectangle 0.5,0.5,169,124,12 | Fill Color #BackgroundColor# | StrokeWidth 1.5 | Stroke Color #LabelColor#
W=170
H=125
UpdateDivider=-1
1.png
You do not have the required permissions to view the files attached to this post.