Page 1 of 2

Transparency regression in 5.73 B4

Posted: Fri Nov 13, 2020 12:40 pm
by BarryG
[Edit] Example code is now shown further below. Hope it helps!

My app has an .ICO image with transparency. With 5.72, it looks normal (transparent and showing the gray background). But with 5.73 Beta 4, the icon background is now black.

This is with NO changes to my source or files at all - only the version of PureBasic (32-bit) used to compile is the difference. If I compile with different versions, the icon looks different.

So it seems to be a regression somewhere?

Image

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 11:13 am
by Little John
No problem here with this icon
//edit: image removed

using the following code with PB 5.73 beta 4 (x64) on Windows 10.
(The 32 bit Windows version of PB 5.73 beta 4 is currently not installed here.)

Code: Select all

If OpenWindow(0, 100, 100, 245, 105, "ICO test") = 0
   End
EndIf

If LoadImage(0, "test.ico")  ; change path to the image appropriately
   ImageGadget(0, 10, 10, 64, 64, ImageID(0))
EndIf

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 11:20 am
by BarryG
It doesn't matter what anyone else shows, sorry. Same source, same icon, but different PureBasic versions. Something broke in the beta. Edited my post to highlight the issue in red.

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 11:31 am
by Little John
BarryG wrote:It doesn't matter what anyone else shows, sorry. Same source, same icon, but different PureBasic versions. Something broke in the beta. Edited my post to highlight the issue in red.
I provided some code and an icon, so that we all can run the same test on our systems. That does matter a lot. Unfortunately you missed that.
The problem might depend on certain details of the icon or something. So of course it's important to know the exact circumstances that lead to the issue. If other people (especially Fred) can't reproduce it, it's hard if not impossible to fix the problem.
For more information see: Please read before submitting a bug report !

Does my above code display my icon properly on your system?

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 12:53 pm
by BarryG
Little John wrote:Does my above code display my icon properly on your system?
Yes, it does. That's nice. But as I said: If I compile with different versions, my icon looks different.

From item (5) of your Bug Report list, it says (in part): "commands that worked on an earlier version of PureBasic but don't on the newest", which is definitely the case here.

Compiling the exact same code with the exact same image files shouldn't produce different results, don't you agree? Please answer me that with a yes or no.

But, I think I worked out the problem. My transparent icon is used in conjunction with SetWindowColor(), with this code:

Code: Select all

SetWindowColor(MyWin,GetSysColor_(#COLOR_3DLIGHT))
When I remove that line, my icon background is no longer black. On my PC, #COLOR_3DLIGHT is not black (it's light gray RGB 227,227,227) so it's not getting applied correctly anymore.

I see Fred "fixed" SetWindowColor() recently (see here) so I guess that command got broken. Fred?

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 1:04 pm
by Little John
BarryG wrote:
Little John wrote:Does my above code display my icon properly on your system?
Yes, it does. That's nice. But as I said: If I compile with different versions, my icon looks different.

From item (5) of your Bug Report list, it says (in part): "commands that worked on an earlier version of PureBasic but don't on the newest", which is definitely the case here.

Compiling the exact same code with the exact same image files shouldn't produce different results, don't you agree? Please answer me that.
I agree. That's a matter of course.
But as I wrote: Just saying so does not help very much to fix the problem. Some working code is needed to reproduce and narrow down the problem.

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 1:09 pm
by BarryG
Unfortunately my working code that shows it is over 43000 lines. But I have narrowed the problem down to one "fixed" command for 5.73 - SetWindowColor(). See my comments above about it. Removing this line removes the black background, so it's definitely the cause and needs to be looked at again. Indeed, the bug report for it even says "SetWindowColor() affects gadgets" and my icon is used on a gadget.

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 1:20 pm
by Saki
SetWidnowColor() caused this error in 5.73 B2 - Windows.
In the B3 and B4 it was gone.
You have to make a little code.
It is not enough to say in a gadget.
In which gadget !
Affected was the ImageGadget()

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 1:32 pm
by BarryG
Saki wrote:SetWidnowColor() caused this error in 5.73 B2 - Windows.
In the B3 and B4 it was gone.
You have to make a little code.
It is not enough to say in a gadget.
In which gadget !
Affected was the ImageGadget()
I am trying to make a snippet to show, despite knowing it's SetWindowColor().

And yes, I'm using an ImageGadget(), which you said is the affected gadget.

Is there a way I can get B2 again? I'd like to see if it worked in that beta.

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 1:36 pm
by Saki
viewtopic.php?f=4&t=76124

Look, this Code and try with your Icon

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 2:05 pm
by BarryG
I finally got a working snippet to show the problem. Woohoo!

Try this code with 5.72 Final, and with 5.73 Beta 4, using Little John's icon in his first reply:

Code: Select all

w=OpenWindow(0, 100, 100, 145, 105, "ICO test", #PB_Window_Invisible|#PB_Window_BorderLess)

im=LoadImage(#PB_Any, "d:\test.ico")

ig=ImageGadget(#PB_Any, 16, 16, 16, 16, 0)
SetGadgetState(ig, ImageID(im))

bg=ButtonGadget(#PB_Any, 10, 10, 78, 78, "", #PB_Button_MultiLine|#WS_CLIPSIBLINGS)

hWnd=WindowID(0)
SetWindowLongPtr_(hWnd,#GWL_EXSTYLE,GetWindowLongPtr_(hWnd,#GWL_EXSTYLE)|#WS_EX_TOOLWINDOW)

SetWindowColor(0, GetSysColor_(#COLOR_3DLIGHT)) ; *** This breaks 5.73 Beta 4 ***

ShowWindow_(hWnd,#SW_SHOW)

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
The results are as follows:

Image

The black background in the middle image is supposed to be a very light gray (#COLOR_3DLIGHT).

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 2:19 pm
by Saki
#PB_Window_Invisible trigger it,

but the code looks a litle strange for me.

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 2:34 pm
by BarryG
Saki wrote:#PB_Window_Invisible trigger it
Okay, but in my app the window is invisible until all gadgets are drawn, and then shown. Otherwise there's an ugly flash that the user sees when all the gadgets appear.

Regardless, removing SetWindowColor() fixes it, so something broke with SetWindowColor() when it was "fixed" for this beta.

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 2:36 pm
by Saki
I would it make simple so

Code: Select all

w=OpenWindow(0, 100, 100, 145, 105, "ICO test", #PB_Window_BorderLess)
SetWindowColor(0, $E3E3E3)

im=LoadImage(#PB_Any, "C:\Users\Tanaka\OneDrive\Desktop\test.ico"); d:\test.ico")

ig=ButtonImageGadget(#PB_Any, 16, 16, 75, 75, ImageID(im))

HideWindow(0, 0)

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: Transparency regression in 5.73 B4

Posted: Sat Nov 14, 2020 2:39 pm
by BarryG
I'm using a ButtonGadget() because there's text on it, too. Just not shown for this demo code. Don't try to fix my demo code because it doesn't show the full code of what my app does; there's way more to it than that when my window is being built.

And a workaround isn't the answer because the regression needs to be fixed anyway.