Transparency regression in 5.73 B4

Just starting out? Need help? Post your questions and find answers here.
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Transparency regression in 5.73 B4

Post 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
Last edited by BarryG on Sat Nov 14, 2020 2:06 pm, edited 3 times in total.
Little John
Addict
Addict
Posts: 4778
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Transparency regression in 5.73 B4

Post 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
Last edited by Little John on Sun Nov 15, 2020 8:14 am, edited 1 time in total.
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Transparency regression in 5.73 B4

Post 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.
Little John
Addict
Addict
Posts: 4778
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Transparency regression in 5.73 B4

Post 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?
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Transparency regression in 5.73 B4

Post 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?
Little John
Addict
Addict
Posts: 4778
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Transparency regression in 5.73 B4

Post 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.
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Transparency regression in 5.73 B4

Post 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.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Transparency regression in 5.73 B4

Post 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()
地球上の平和
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Transparency regression in 5.73 B4

Post 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.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Transparency regression in 5.73 B4

Post by Saki »

viewtopic.php?f=4&t=76124

Look, this Code and try with your Icon
地球上の平和
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Transparency regression in 5.73 B4

Post 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).
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Transparency regression in 5.73 B4

Post by Saki »

#PB_Window_Invisible trigger it,

but the code looks a litle strange for me.
Last edited by Saki on Sat Nov 14, 2020 2:38 pm, edited 1 time in total.
地球上の平和
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Transparency regression in 5.73 B4

Post 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.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Transparency regression in 5.73 B4

Post 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
地球上の平和
BarryG
Addict
Addict
Posts: 4130
Joined: Thu Apr 18, 2019 8:17 am

Re: Transparency regression in 5.73 B4

Post 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.
Post Reply