[wx-dev] [wxStaticBitmap] png transparancy bug

Christian Buhtz exsudat at gmx.de
Sat May 3 03:26:37 PDT 2008


Ok, I did some more tests.



I extremly minimized the control-sample to <40 lines. You can see the 
code below.

Compiling the code with the control-sample makefile with MinGW work 
fine. The transparancy is shown correctly.

Compiling 100% exactly the same code in a Code::Blocks project using 
MinGW doesn't work. The transparancy area is black there.

So I think it is a compiler think? But I can not found a difference 
between the two builds.

Here is the build-log for the control-sample
[control-build-log]
C:\wxWidgets\samples\controls>mingw32-make -f makefile.gcc SHARED=1 
MONOLITHIC=1
  BUILD=debug
if not exist gcc_mswuddll mkdir gcc_mswuddll
g++ -c -o gcc_mswuddll\controls_controls.o -g -O0 -mthreads 
-DHAVE_W32API_H -D_
_WXMSW__  -D__WXDEBUG__    -D_UNICODE   -I.\..\..\lib\gcc_dll\mswud 
-I.\..\..\in
clude -W -Wall -I. -DWXUSINGDLL -I.\..\..\samples -DNOPCH 
-Wno-ctor-dtor-priva
cy   -MTgcc_mswuddll\controls_controls.o 
-MFgcc_mswuddll\controls_controls.o.d -
MD controls.cpp
windres --use-temp-file -icontrols.rc 
-ogcc_mswuddll\controls_controls_rc.o    -
-define __WXMSW__  --define __WXDEBUG__    --define _UNICODE 
--include-dir .\.
.\..\lib\gcc_dll\mswud --include-dir ./../../include --include-dir . 
--define WX
USINGDLL --include-dir ./../../samples --define NOPCH
g++ -o gcc_mswuddll\controls.exe gcc_mswuddll\controls_controls.o 
gcc_mswuddll\c
ontrols_controls_rc.o  -g -mthreads -L.\..\..\lib\gcc_dll 
-Wl,--subsystem,window
s -mwindows      -lwxmsw29ud -lwxtiffd -lwxjpegd -lwxpngd  -lwxzlibd 
-lwxregexud
  -lwxexpatd    -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool 
-lwinmm -lshell
32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32
if not exist gcc_mswuddll mkdir gcc_mswuddll
for %%f in (test2.bmp) do if not exist gcc_mswuddll\%%f copy .\%%f 
gcc_mswuddll
         1 Datei(en) kopiert.
[/control-build-log]

And that is the build-log from the Code::Blocks project:
[cb-build-log]

-------------- Build: Debug Dynamic in wxStaticBitmap_bug ---------------

mingw32-g++.exe  -g -D_DEBUG -D__WXDEBUG__ -DWXUSINGDLL -D__WXMSW__ 
-IC:\wxWidgets\include -IC:\wxWidgets\contrib\include 
-Ithird-party\wxSerialize\include\wx -Iinclude 
-IC:\Programme\CodeBlocks\include  -c 
D:\Garage\projekte\wxStaticBitmap_bug\App.cpp -o .out\objs_debd\App.o
mingw32-g++.exe -LC:\wxWidgets\lib\gcc_dll -LC:\Programme\CodeBlocks\lib 
  -o .\wxStaticBitmap_bug_dd.exe .out\objs_debd\App.o    -lwxzlibd 
-lwxmsw29ud -lwxpngd -lwxtiffd -lwxjpegd -lwxregexud -lwxexpatd 
-lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 
-lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 
-mwindows
Output size is 1.97 MB
Process terminated with status 0 (0 minutes, 26 seconds)
0 errors, 0 warnings
[/cb-build-log]

That is the code:
[code]
#include <wx/wx.h>

class MyApp: public wxApp
{
public:
     bool OnInit();
};


IMPLEMENT_APP(MyApp)


bool MyApp::OnInit()
{
     // use standard command line handling:
     if ( !wxApp::OnInit() )
         return false;

     wxInitAllImageHandlers();

     // Create the main frame window
     wxFrame *frame = new wxFrame(NULL, wxID_ANY, wxEmptyString);

     wxPanel* panel = new wxPanel( frame, wxID_ANY, wxPoint(10, 10), 
wxSize(300, 100) );

     wxStaticBitmap* pSB = new wxStaticBitmap(panel, wxID_ANY, 
wxBitmap(_T("logo_text.png"), wxBITMAP_TYPE_PNG));

     // sizer
     wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
     sizer->Add(pSB, wxSizerFlags(0).Expand());
     panel->SetSizer( sizer );

     frame->Show(true);

     return true;
}
[/code]

I am using wx from SVN revision 53295 build (cleaned before!) with MinGW 
on WINXPSP2 with this command
mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=debug

Can you see any differences?



More information about the wx-dev mailing list