ahmd0
ahmd0

Reputation: 17293

BitBlt to invert colors using C++

I am using BitBlt WinAPI to compose a bitmap using C++, and I was wondering what flags do I need to use to invert the colors in it?

Upvotes: 0

Views: 2702

Answers (2)

MARSHMALLOW
MARSHMALLOW

Reputation: 1395

You can use BitBlt() with NOTSRCCOPY.

Here is your code:

HDC hdc = GetDC(HWND_DESKTOP);
BitBlt(hdc, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), hdc, NULL, NULL, NOTSRCCOPY);

Upvotes: 1

Roman Ryltsov
Roman Ryltsov

Reputation: 69652

What did you try?

BitBlt:

  • DSTINVERT Inverts the destination rectangle.
  • PATINVERT Combines the colors of the brush currently selected in hdcDest, with the colors of the destination rectangle by using the Boolean XOR operator.
  • SRCINVERT Combines the colors of the source and destination rectangles by using the Boolean XOR operator.

Upvotes: 1

Related Questions