OS.SelectObject (hdc2, hMask); OS.SetBkColor (hdc1, background); OS.BitBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, OS.SRCCOPY); OS.ReleaseDC (0, hDC); OS.DeleteDC (hdc1); OS.DeleteDC (hdc2);
if (background != -1) { int hDC = OS.GetDC (0); int hdc1 = OS.CreateCompatibleDC (hDC); OS.SelectObject (hdc1, hBitmap); int hdc2 = OS.CreateCompatibleDC (hDC); OS.SelectObject (hdc2, hMask); OS.SetBkColor (hdc1, background); OS.BitBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, OS.SRCCOPY); OS.ReleaseDC (0, hDC); OS.DeleteDC (hdc1); OS.DeleteDC (hdc2); }
int createMask (int hBitmap, int width, int height) {	int hDC = OS.GetDC (0);	int hdc1 = OS.CreateCompatibleDC (hDC);	OS.SelectObject (hdc1, hBitmap);	int hdc2 = OS.CreateCompatibleDC (hDC);	int hMask = OS.CreateBitmap (width, height, 1, 1, null);	OS.SelectObject (hdc2, hMask);	OS.SetBkColor (hdc1, background);	OS.BitBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, OS.SRCCOPY);	OS.ReleaseDC (0, hDC);	OS.DeleteDC (hdc1);	OS.DeleteDC (hdc2);	return hMask;}