It is currently March 28th, 2024, 7:00 pm

[D2D] Stripes on Histogram with transformation matrix

Backwards compatibility issues related to the conversion of Rainmeter to D2D.
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

[D2D] Stripes on Histogram with transformation matrix

Post by rxtd »

When Histogram is stretched for not integer values behavior between 4.2 and 4.3 differs:
4.2 draws solid histogram and only blurs edges.
4.3 draws stripes between histogram bars.
2018-10-28_17-11-55.png
Image is scaled 8x using nearest neighbour algorithm.
Tested on 4.3 Beta r3260.
Test skin code:

Code: Select all

[rainmeter]
update=1000

[variables]
_scale=1.5

[back]
meter=image
h=(30*#_scale#)
w=(100*#_scale#)
solidcolor=888888

[mnet]
measure=netout
formula=-1

[histogram]
meter=histogram
measurename=mnet
x=(1*1)
y=1
h=28
w=(98*1)
flip=0
GraphStart=left
solidcolor=112233aa
antialias=1
TransformationMatrix=#_scale#;0;0;#_scale#;0;0
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Stripes on Histogram with transformation matrix

Post by jsmorley »

rxtd wrote: October 28th, 2018, 10:32 am When Histogram is stretched for not integer values behavior between 4.2 and 4.3 differs:
4.2 draws solid histogram and only blurs edges.
4.3 draws stripes between histogram bars.
2018-10-28_17-11-55.png
Image is scaled 8x using nearest neighbour algorithm.
Tested on 4.3 Beta r3260.
Test skin code:

Code: Select all

[rainmeter]
update=1000

[variables]
_scale=1.5

[back]
meter=image
h=(30*#_scale#)
w=(100*#_scale#)
solidcolor=888888

[mnet]
measure=netout
formula=-1

[histogram]
meter=histogram
measurename=mnet
x=(1*1)
y=1
h=28
w=(98*1)
flip=0
GraphStart=left
solidcolor=112233aa
antialias=1
TransformationMatrix=#_scale#;0;0;#_scale#;0;0

This seems to be due to a difference in how antialiasing of edges is done in D2D vs GDI+. We noted a similar small issue with Roundline, and I suspect they are related. I'm not 100% sure, but it appears that we just can't make that behave the same as GDI+, and we might have to live with it.

It seems to be a difference in how edges are antialiased when the "ending" and "starting" points of two drawing elements have edges that abut or overlap. Feels to me that the edges are antialiased with whatever is the "background", and not with the other element, where the expectation in this case is that they abut and are the same color, and there should be no antialiasing. So in effect, the bar(s) are antialiased with the dark background, and that "fade out" effect then overlaps with the "fade in" effect on the next bar.

For this example, where there are nothing but straight edges, I think you can actually fix the issue by removing the AntiAlias =1 option. That's not going to be helpful in other cases like Roundline, where there are really no straight edges, but it might be in this case.