It is currently April 27th, 2024, 11:22 pm

Rotator slightly off

Report bugs with the Rainmeter application and suggest features.
User avatar
Brian
Developer
Posts: 2688
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Rotator slightly off

Post by Brian »

The purpose of the Rotator meter is to rotate an image around a single point (or pixel). If we change this, then every Rotator meter will be a half of a pixel off in width and height, which IMO presents a fairly serious backward compatibility issue.

To me, the real problem here is that your images have an even amount of pixels that represent the "center" of rotation. When using the Rotator meter, it is best to use an image that has an odd amount of pixels that represent the center of rotation.

-Brian
Alex Becherer

Re: Rotator slightly off

Post by Alex Becherer »

this is not the case.

odd sizes have exactly the same problem. i have attached a butchered old skin of mine to illustrate. starts perfectly at 0 minutes gets worse to 30 minutes.
User avatar
Brian
Developer
Posts: 2688
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Rotator slightly off

Post by Brian »

The reason this looks odd is because the minute image is 146x146, but in your skin you had it sized to 147x147, plus your OffsetX/Y was 73.5 instead of 73.

Once fixed, your skin looks fine to me.

Code: Select all

[MeterMinutes]
MeasureName=MeasureTime
Meter=ROTATOR
X=0
Y=0
W=146
H=146
ImageName=met2002.png
StartAngle=(2*PI)
RotationAngle=(2*PI)
ValueReminder=3600
OffsetX=73
OffsetY=73

[MeterDot]
Meter=IMAGE
X=73
Y=73
ImageName=dot.png
-Brian


EDIT- For some reason the image was only showing 146x146 in my image editor, however it is 147x147, so I am not sure what the problem is. If you try my code, it seems to work just fine.

EDIT2 - I am no image editing expert, but it looks like the although the image size is 147x147, the last pixel in the image is at 146x146. Here is a screenshot of MSPaint showing the last pixel in the image. As you can see, the cursor is hovering the last pixel in the image, and in the lower right corner, it says that location is at 146x146. :confused:
146x146.png
You do not have the required permissions to view the files attached to this post.
Alex Becherer

Re: Rotator slightly off

Post by Alex Becherer »

this code works now.

these are 147 x 147 sized background and hand images. but the code defines a 146 x 146 sized area for rotation.

works the other way round as well with the skin i used in the first post. just have to define a one pixel smaller rotation width and height and then of course move the offsets half a pixel to the top and left.

but that's not how it should be, or is it?
User avatar
Brian
Developer
Posts: 2688
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Rotator slightly off

Post by Brian »

See my edit above.

I am not sure if this supposed to happen, but it is. :confused:

-Brian
Alex Becherer

Re: Rotator slightly off

Post by Alex Becherer »

Brian wrote:
EDIT2 - I am no image editing expert, but it looks like the although the image size is 147x147, the last pixel in the image is at 146x146. Here is a screenshot of MSPaint showing the last pixel in the image. As you can see, the cursor is hovering the last pixel in the image, and in the lower right corner, it says that location is at 146x146. :confused:
146x146.png

that is because the first pixel is at 0x0.

1 to 10 = 10
0 to 10 = 11
User avatar
Brian
Developer
Posts: 2688
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Rotator slightly off

Post by Brian »

Well like I said, I am no image expert. :D

-Brian
Alex Becherer

Re: Rotator slightly off

Post by Alex Becherer »

so ...

the workaround for both odd and even sizes is to define a one pixel smaller area for rotation and of course also set the matching offset values.

i think an update would not break compatibilty with older skins but rather fix them. it is rather unlikely that many people found out how to trick Rainmeter. probably not that many that saw this bug at all.
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Rotator slightly off

Post by KreAch3R »

You kind of need magnifying glasses to spot that. :p I'm still amazed that you did.
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
Xi.Cynx
Posts: 31
Joined: August 1st, 2012, 2:14 am
Location: Elyria, OH

Re: Rotator slightly off

Post by Xi.Cynx »

This topic sparked my attention as I have a clock image and I was using simple roundlines for my hour, minute and second hands. I was wanting to convert them to images as we do not currently have a way to round off the ends of the lines. But If I do switch these to images, will this effect the precision in the rotation?

My hour hand width is 4
My minute hand width is 3
My second hand width is 1

Let me know if this is going to cause me issues as I need the hands to rotate perfectly around the center point since they line up perfectly with the circles they are rotating around. Thanks! :thumbup:
Do unto others as you would have them do unto you...said the rapist

Main Rig: i7 4770k | ASRock Z97E-ITX/ac | 16GB DDR3-1600 | 500GB Samsung 840 EVO | EVGA GTX 780 | Nexus 5000