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@winehq.org Reporter: nikolaysemenkov@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); } }