[Bug 44392] New: BM_SETIMAGE sets image with white background instead of transparent. Is it possible to set a transparent image on wine ?
https://bugs.winehq.org/show_bug.cgi?id=44392 Bug ID: 44392 Summary: BM_SETIMAGE sets image with white background instead of transparent. Is it possible to set a transparent image on wine? Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: critical Priority: P2 Component: user32 Assignee: wine-bugs(a)winehq.org Reporter: nikolaysemenkov(a)gmail.com Distribution: --- Created attachment 60312 --> https://bugs.winehq.org/attachment.cgi?id=60312 the transparrent image On windows following code works: But on wine transparent image(attached png) appears with solid white background. The code: #include <windows.h> #include <gdiplus.h> HBITMAP loadBitmap(const wchar_t* path) { HBITMAP tBmp = NULL; ULONG_PTR token = 0; Gdiplus::GdiplusStartupInput input = NULL; Gdiplus::GdiplusStartup(&token, &input, NULL); if (token != 0) { Gdiplus::Bitmap* bmp = new Gdiplus::Bitmap(path); bmp->GetHBITMAP(Gdiplus::Color::Transparent, &tBmp); delete bmp; Gdiplus::GdiplusShutdown(token); } return tBmp; } LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static HBITMAP tBmp = NULL; switch (message) { case WM_CREATE: { HWND btn = CreateWindow(L"BUTTON", L"TEXT", BS_BITMAP | WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 100, 100, 95, 25, hwnd, (HMENU)1, NULL, NULL); tBmp = loadBitmap(L"C:\\zoomin_disabled.png"); SendMessage(btn, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)tBmp); ShowWindow(btn, SW_SHOW); } break; case WM_DESTROY: DeleteObject(tBmp); PostQuitMessage(0); break; default: return DefWindowProc(hwnd, message, wParam, lParam); } return 0; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) { MSG msg; WNDCLASS wc = { 0 }; wc.lpszClassName = TEXT("EU"); wc.hInstance = hInstance; wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE); wc.lpfnWndProc = WindowProcedure; wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hIcon = NULL; RegisterClass(&wc); CreateWindow(wc.lpszClassName, TEXT("Express Uninstaller"), WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_OVERLAPPEDWINDOW | WS_VSCROLL, (GetSystemMetrics(SM_CXSCREEN) - 230) / 2, (GetSystemMetrics(SM_CYSCREEN) - 100 ) / 2, 280 + 10, 110 + 20 + 190, 0, 0, hInstance, 0); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } } -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |normal -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|user32 |-unknown --- Comment #1 from Nikolay Sivov <bunglehead(a)gmail.com> --- How are you testing this? I'm seeing same results on Win10 as on Wine - image with white background. I tested with mingw-w64, command was: --- i686-w64-mingw32-g++ -DUNICODE bug44392.cpp -lgdiplus -lgdi32 -static-libgcc -static-libstdc++ -mwindows -o bug44392.exe --- -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |3.0 Component|-unknown |comctl32 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Nikolay Sivov <bunglehead(a)gmail.com> --- I probably see what's going on, you must be running with comctl32 V6, so different implementation is used. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|BM_SETIMAGE sets image with |BM_SETIMAGE sets image with |white background instead of |white background instead of |transparent. Is it possible |transparent |to set a transparent image | |on wine? | -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 --- Comment #3 from nikolaysemenkov(a)gmail.com --- How can I use v6 implementation of comctl32? On windows the following manifest works, but on wine it seems ignored and the issue happens: <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/> </dependentAssembly> </dependency> -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 --- Comment #4 from nikolaysemenkov(a)gmail.com --- (In reply to Nikolay Sivov from comment #2)
I probably see what's going on, you must be running with comctl32 V6, so different implementation is used.
Right, but how on wine do this programmatically? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 --- Comment #5 from Nikolay Sivov <bunglehead(a)gmail.com> --- (In reply to nikolaysemenkov from comment #4)
(In reply to Nikolay Sivov from comment #2)
I probably see what's going on, you must be running with comctl32 V6, so different implementation is used.
Right, but how on wine do this programmatically?
Right now Wine only has classic user controls implementation, comctl32 does not implement Button for example. You can't enable that just yet. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 --- Comment #6 from nikolaysemenkov(a)gmail.com --- The full file (vs2005): #define UNICODE #define _WIN32_IE 0x0600 #define _WIN32_WINNT 0x0501 #include <windows.h> #include <gdiplus.h> #include <Commctrl.h> #pragma comment(lib,"gdiplus.lib") #pragma comment(lib,"gdi32.lib") #pragma comment(lib,"user32.lib") #pragma comment(lib,"comctl32.lib") #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' ""version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") HBITMAP loadBitmap(const wchar_t* path) { HBITMAP tBmp = NULL; ULONG_PTR token = 0; Gdiplus::GdiplusStartupInput input = NULL; Gdiplus::GdiplusStartup(&token, &input, NULL); if (token != 0) { Gdiplus::Bitmap* bmp = new Gdiplus::Bitmap(path); bmp->GetHBITMAP(Gdiplus::Color::Transparent, &tBmp); delete bmp; Gdiplus::GdiplusShutdown(token); } return tBmp; } LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static HBITMAP tBmp = NULL; switch (message) { case WM_CREATE: { HWND btn = CreateWindow(L"BUTTON", L"TEXT", BS_BITMAP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 100, 100, 95, 25, hwnd, (HMENU)1, NULL, NULL); tBmp = loadBitmap(L"C:\\sourcecode\\llib\\include\\llib\\resources\\images\\zoomin_disabled.png"); SendMessage(btn, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)tBmp); ShowWindow(btn, SW_SHOW); } break; case WM_DESTROY: DeleteObject(tBmp); PostQuitMessage(0); break; default: return DefWindowProc(hwnd, message, wParam, lParam); } return 0; } void SetImageBug(HINSTANCE hInstance) { MSG msg; WNDCLASS wc = { 0 }; wc.lpszClassName = TEXT("EU"); wc.hInstance = hInstance; wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND; wc.lpfnWndProc = WindowProcedure; wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hIcon = NULL; RegisterClass(&wc); CreateWindow(wc.lpszClassName, TEXT("Test png loading"), WS_VISIBLE | WS_CAPTION | WS_SYSMENU , (GetSystemMetrics(SM_CXSCREEN) - 230) / 2, (GetSystemMetrics(SM_CYSCREEN) - 100) / 2, 280 + 10, 110 + 20 + 190, 0, 0, hInstance, 0); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } exit(0); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) { INITCOMMONCONTROLSEX x; x.dwSize = sizeof(x); x.dwICC = ICC_STANDARD_CLASSES; if(!InitCommonControlsEx(&x)) return 0; SetImageBug(hInstance); } -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 --- Comment #7 from nikolaysemenkov(a)gmail.com --- (In reply to Nikolay Sivov from comment #5)
(In reply to nikolaysemenkov from comment #4)
(In reply to Nikolay Sivov from comment #2)
I probably see what's going on, you must be running with comctl32 V6, so different implementation is used.
Right, but how on wine do this programmatically?
Right now Wine only has classic user controls implementation, comctl32 does not implement Button for example. You can't enable that just yet.
Thanks, Can you suggest a workaround? I can see the only one is convert images to icons and load them as icons onto buttons. Is there any other way? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 --- Comment #8 from nikolaysemenkov(a)gmail.com --- comctl32 returns it is a v 5.81. Does it means wine controls compatible with windows 98? If so, I am wondering how applications work under wine.. and why v6 is not supported as a top priority. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 --- Comment #9 from Nikolay Sivov <bunglehead(a)gmail.com> --- (In reply to nikolaysemenkov from comment #8)
comctl32 returns it is a v 5.81. Does it means wine controls compatible with windows 98? If so, I am wondering how applications work under wine.. and why v6 is not supported as a top priority.
Why wouldn't they work in Wine? We have some bugs reported for newer version, but it doesn't mean version 5 is not used on Windows anymore, it exists side-by-side, and latest Windows releases still have it. Regarding priorities, no, it's not a top one, and shouldn't be, but I'm working on it. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=44392 --- Comment #10 from Nikolay Sivov <bunglehead(a)gmail.com> --- We now have separate implementation in comctl32/button.c, so this issue is fixable with current wine. My guess is that for certain bitmaps it picks transparent color from (0,0) or something similar. That also means we'll have to use something other than DrawState() to handle this, because it does not support transparency. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
wine-bugs@winehq.org