| 1558 | } |
| 1559 | |
| 1560 | void DrawIconInvert(HDC hdc, HICON hIcon, int x, int y, int sizeX, int sizeY, bool invert) |
| 1561 | { |
| 1562 | if (!invert) { |
| 1563 | ri::DrawIconEx(hdc, x, y, hIcon, sizeX, sizeY, 0, NULL, DI_NORMAL | DI_COMPAT); |
| 1564 | return; |
| 1565 | } |
| 1566 | |
| 1567 | HDC hdcMem = CreateCompatibleDC(hdc); |
| 1568 | HBITMAP hbm = CreateCompatibleBitmap(hdc, sizeX, sizeY); |
| 1569 | HGDIOBJ oldObj = SelectObject(hdcMem, hbm); |
| 1570 | |
| 1571 | // take the contents of the HDC there and invert them. |
| 1572 | BitBlt(hdcMem, 0, 0, sizeX, sizeY, hdc, x, y, NOTSRCCOPY); |
| 1573 | |
| 1574 | ri::DrawIconEx(hdcMem, 0, 0, hIcon, sizeX, sizeY, 0, NULL, DI_NORMAL | DI_COMPAT); |
| 1575 | |
| 1576 | // now blit it back out inverted |
| 1577 | BitBlt(hdc, x, y, sizeX, sizeY, hdcMem, 0, 0, NOTSRCCOPY); |
| 1578 | |
| 1579 | // clean up |
| 1580 | SelectObject(hdcMem, oldObj); |
| 1581 | DeleteBitmap(hbm); |
| 1582 | DeleteDC(hdcMem); |
| 1583 | } |
| 1584 | |
| 1585 | // Resizes a transparent image with a transparent color, without looking bad. |
| 1586 | // NOTE: Creates a new bitmap. Make sure to delete the bitmap when done. |
no outgoing calls
no test coverage detected