It is currently March 28th, 2024, 3:16 pm

[D2D][Fixed] Abnormal line graph behavior

Backwards compatibility issues related to the conversion of Rainmeter to D2D.
Post Reply
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA
Contact:

[D2D][Fixed] Abnormal line graph behavior

Post by raiguard »

Line graphs now have a vastly different look to them. While at first I didn't consider it a bug (there are bound to be some small differences between GDI+ and Direct2D), when I blew up a simple line graph to a large size, it shows that the behavior between the two versions is different enough to merit a report.

Code: Select all

[Rainmeter]
MiddleMouseUpAction=[!Refresh]
AccurateText=1
Update=50

[Variables]

[MeasureCpuUsage]
Measure=CPU

[MeterBackground]
Meter=Image
SolidColor=50,50,50
W=500
H=110

[MeterTestLineGraph]
Meter=Line
LineCount=1
LineColor=255,100,100
MeasureName=MeasureCpuUsage
X=5
Y=5
W=490
H=100
LineWidth=3
Antialias=0
2018-07-25 19_54_00-.png
4.2 on the top, 4.3 on the bottom.

It appears that the line graph is doing some sort of automatic smoothing between points, to the point where it looks less like a single line and more like a radio interference graph. When the line width is 1 and the graph is smaller, you can see that it produces a "chunky" graph when compared with 4.2:
2018-07-25 19_35_56-D__Settings_Caleb_Rainmeter_Skins_ModernGadgets_CPU_CPU.ini.png
4.2 on the right, 4.3 on the left.

This is all with antialiasing turned off, though turning it on will yield similar results.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Abnormal line graph behavior

Post by jsmorley »

Does the latest alpha do a better job?
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA
Contact:

Re: Abnormal line graph behavior

Post by raiguard »

I'll see what I can remember from when I did two minutes of testing before going to work this morning.

The "line" is now more defined (and no longer extends past the defined height of the meter), but the peaks and valleys are still exibiting different behavior. When I use the meter at linewidth 1, all of the peaks and valleys still take up two pixels of width. I'll do more testing once I get home (~5 hours) and get back to you.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Abnormal line graph behavior

Post by jsmorley »

Can you re-test and let us know if the r3224 alpha fixes the issues?
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA
Contact:

Re: Abnormal line graph behavior

Post by raiguard »

Sorry for the late response. I have been super busy at work so I have not had motivation to do Rainmeter-related stuff for a while. But I'm back now!

Anyway, I decided to expand upon my test skin to make things more consistent. Specifically, I created a little script that will consistently populate the line graph with a predefined set of data, allowing for more direct comparisons. Since it now involves multiple files, I packaged it into a .RMSKIN, that I will attach to this post.

Here is a comparison of different sizes of line graphs with different settings:
2018-08-12 15_44_27-D__Settings_Caleb_Rainmeter_Skins_LineGraphTest_LineGraphTest.ini.png
4.2 on the left, 4.3 on the right.

As you can see, there are small differences in the peaks and valleys in how the line is drawn. It's very minor, but it causes lots of visual discrepancies on line graphs with small heights and widths (see the one on the bottom of the skin).

Let me know if you need any more details from my end.

EDIT: Upon closer investigation it appears that the 4.2 and 4.3 antialiased line graphs look almost identical...

EDIT 2: Updated with an antialiased version of the small graph.
Attachments
LineGraphTest_1.1.0.rmskin
(3.25 KiB) Downloaded 40 times
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA
Contact:

Re: Abnormal line graph behavior

Post by raiguard »

Update on the antialiased observation: The antialiased graphs between 4.2 and 4.3 are almost 100% identical. Additionally, I have noticed that the antialiased and aliased graphs on 4.3 look very similar (as in the peaks and valleys have similar shapes). On 4.2, there is a definite difference in the line shape between antialiased and aliased.

Perhaps Rainmeter is performing half of the antialiasing steps on aliased graphs (i.e. smoothing the line itself) even when antialias is turned off on the meter?
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Abnormal line graph behavior

Post by Brian »

This should be fixed as of r3231. Thanks for all your testing!

The problem turned out to be that D2D draws using the stroke located in the center of a pixel, so we had to add an offset of a half of pixel to the drawing coordinates. The D2D anti-aliasing might be a little clearer than the GDI+ version as well, but should look nearly identical.

I think this is as close as we are going to get. There might be a few extra pixels here and there, especially at the peaks and valleys, but nothing too drastic (hopefully :D).

Also, the HorizontalLines option was off by a little as well, which is fixed as well. And its anti-aliasing will look a lot sharper than GDI+ version, but I see that as an improvement.

-Brian
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA
Contact:

Re: [Fixed] Abnormal line graph behavior

Post by raiguard »

I can indeed confirm that this has been fixed! Thanks for all your work. :D
Post Reply