Transparent -> black after upgrade Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Transparent -> black after upgrade

Post by Jive Dadson » Fri Mar 02, 2018 7:17 am

I hope this problem rings a bell with someone

I updated a project from wxWidgets 2.8 x86 to wxWidgets 3.1 64bit. Using Visual Studio 2017, VC++17. The project worked well before. Now in some circumstances .ico files with transparent backgrounds are displaying the backgrounds as black.

The main window displays its buttons properly in Release mode. The images for the buttons are compiled into .cpp compilation units, as bit-for-bit copies of .ico files.

Image

Switch to Debug, and this is what I get.

Image

When I display an icon read from a file, it shows up okay at first.

Image

But if I resize it, either larger or smaller, the background goes black.

Image

What else do you need to know? It would be difficult to trim this down to a small program, so I am hoping someone will be able to guess what's happening.
Last edited by Jive Dadson on Fri Mar 02, 2018 2:33 pm, edited 2 times in total.

User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: Transparent -> black after upgrade

Post by eranon » Fri Mar 02, 2018 10:51 am

Hello, And what if you explicitely convert the alpha channel to a mask using wxImage::ConvertAlphaToMask()?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]

Jive Dadson
Experienced Solver
Experienced Solver
Posts: 60
Joined: Thu Sep 06, 2012 8:00 pm

Re: Transparent -> black after upgrade

Post by Jive Dadson » Fri Mar 02, 2018 12:35 pm

image.ConvertAlphaToMask(gray, gray, gray);

Yessiree. That does the trick. Thanks much!

Post Reply