It is currently July 17th, 2019, 1:40 pm

Rounded Corners

Tips and Tricks from the Rainmeter Community
User avatar
themonotm
Posts: 7
Joined: April 15th, 2012, 2:16 pm

Rounded Corners

themonotm » June 13th, 2014, 11:42 am

Hey There Guys,

This is just a short tip on how to achieve rounded corners in Rainmeter. This may be very inefficient, but it produces the smoothest rounded corners I have seen. This only concerns skins with variable image meters as others can just have rounded corners in the images themselves.
This method involves one invisible image meter to get the size of the image, however this is unnecessary if the image size will be constant. The method consists of several image meters using the imagecrop option. The ImageAlpha option is used to antialias the corners.

This is a sample code where the Image meter is an invisible instance of the Windows Media Player album cover.

Code: Select all

[MeasureCover]
Measure=PLUGIN
Plugin=NowPlaying
PlayerName=WMP
PlayerType=Cover

[MeterCoverSize]
Meter=IMAGE
MeasureName=MeasureCover
ImageAlpha=0
x=(-[#CURRENTSECTION#:W)
y=(-[#CURRENTSECTION#:H)
DynamicVariables=1
This is a sample image meter that will be displayed. The only things that need to be changed are the occurances of the number 100 in the ImageCrop. Change the first and third instances to the width that you want to display your image and change the other two to the height you want to display your image.

Code: Select all

[MeterBackground1]
Meter=IMAGE
MeasureName=MeasureCover
w=90
h=100
x=10
y=0
ImageCrop=([MeterCoverSize:W]*[#CURRENTSECTION#:X]/100),([MeterCoverSize:H]*[#CURRENTSECTION#:Y]/100),([MeterCoverSize:W]*[#CURRENTSECTION#:W]/100),([MeterCoverSize:H]*[#CURRENTSECTION#:H]/100)
DynamicVariables=1
Then you simply change the w,h,x, and y attributes and create a meter like that for each row/column in your corner(s). You should make overlapping instances with ImageAlpha values for an antialiased effect.

Hopefully I made this clear enough and I hope you found this tip useful. Also, this is just a guide, so feel free to mess around with the ImageCrop to achieve your desired results. I know there are several variations, so do experiment.

Cheers,
TheMonoTM

EDIT: Updated code for invisible instance to fix skin dimensions