It is currently March 29th, 2024, 5:38 am

[D2D][Fixed] Bug - imagetint on action change no longer working

Backwards compatibility issues related to the conversion of Rainmeter to D2D.
mox
Posts: 2
Joined: February 5th, 2019, 8:48 am

[D2D][Fixed] Bug - imagetint on action change no longer working

Post by mox »

Hi, just wanted to report a small bug I've found with the latest beta.

I display a small image and some text when a drive is online in windows, and nothing when it's not. I've had it like this for years, and it's always worked. With the latest beta, the image does not disappear when the drive is not present (the text does).

The code I use:

Code: Select all

[MeasureDisk]
Measure=FreeDiskSpace
IgnoreRemovable=0
Drive=v:
Label=0
IfCondition=MeasureDisk > 1
IfCondition2=MeasureDisk > 1
IfTrueAction=[!SetOption mDiskImg ImageTint 255,255,255,255]
IfTrueAction2=[!SetOption mDiskText FontColor 255,255,255,255]
IfFalseAction=[!SetOption mDiskImg ImageTint 0,0,0,0]
IfFalseAction2=[!SetOption mDiskText FontColor 0,0,0,0]

[mDiskImg]
Meter=Image
ImageName=disk.png
X=90
Y=0
W=60
H=60
ImageTint=255,255,255,0

[mDiskText]
Meter=String
X=120
Y=70
W=240
H=70
FontSize=12
FontFace=Tahoma
AntiAlias=1
StringAlign=Center
Text=Disk Present
Thanks.
Last edited by mox on February 5th, 2019, 10:26 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bug - imagetint on action change no longer working

Post by jsmorley »

Hm...You are right. We will investigate. Thanks for reporting!

The problem seems to be related to changing to "black", or "0,0,0" as the color, when you use an alpha of "0". If you use 255,255,255,0 or "don't change the color, just the alpha", then it seems to work fine.

Only ImageTint=0,0,0,0 has the issue. If you use ImageTint=any,thing,else,0 or ImageTint=0,0,0,anythingelse it is fine.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bug - imagetint on action change no longer working

Post by jsmorley »

So while I suspect you can fix your skin by using:

Code: Select all

[MeasureDisk]
Measure=FreeDiskSpace
IgnoreRemovable=0
Drive=v:
Label=0
IfCondition=MeasureDisk > 1
IfTrueAction=[!SetOption mDiskImg ImageTint 255,255,255,255][!SetOption mDiskText FontColor 255,255,255,255][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption mDiskImg ImageTint 255,255,255,0][!SetOption mDiskText FontColor 255,255,255,0][!UpdateMeter *][!Redraw]

[mDiskImg]
Meter=Image
ImageName=disk.png
X=90
Y=0
W=60
H=60
ImageTint=255,255,255,0

[mDiskText]
Meter=String
X=120
Y=70
W=240
H=70
FontSize=12
FontFace=Tahoma
AntiAlias=1
StringAlign=Center
Text=Disk Present
There is no need to alter the color if you are just toggling the alpha between fully opaque and fully transparent, and there is no need for two IfCondition options, as you can just stack up the actions on the single IfTrueAction and IfFalseAction lines.

The fact remains that there is some kind of bug in 4.3 indeed.
mox
Posts: 2
Joined: February 5th, 2019, 8:48 am

Re: Bug - imagetint on action change no longer working

Post by mox »

jsmorley wrote: February 5th, 2019, 4:44 pm There is no need to alter the color if you are just toggling the alpha between fully opaque and fully transparent, and there is no need for two IfCondition options, as you can just stack up the actions on the single IfTrueAction and IfFalseAction lines.
That's great, thank you for the streamlined code. You are completely right, it makes sense just to alter the alpha and not the whole colour, no idea what I was thinking of when I wrote that :confused:

Indeed, I can confirm it now works properly with the 4.3 beta as well.

Thanks!
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [Fixed] Bug - imagetint on action change no longer working

Post by Brian »

This bug has been fixed and will be available for the next beta. Thanks for reporting!

-Brian