Ok suppose I have a brush,
HBRUSH brush = CreateSolidBrush(RGB(0, 0, 0));
And I want to change it's color.
Not calling CreateSolidBrush and DeleteObject on it over and over again.
Like in this example,
#define INFINITY UINT64_MAX // You get the point. I am just calling it many times.
RECT rect = { 0 };
HBRUSH brush = CreateSolidBrush(RGB(0, 0, 0)); // Same brush as the one above.
for(uint64_t i = 0; i < INFINITY; i++){
SetRect(&rect, 0, i, i, i + 1); // Right angle triangle btw.
// How would I change the color of the brush?
FillRect(hdc, &rect, brush);
}
As shown above, the reason I don't want to use CreateSolidBrush and DeleteObject again and again, is that it is slow and I need to be able to change the color of the brush quickly.
I have found SetDCBrushColor. Which can change the color of the selected brush? But doesn't seem to change my brush even after selecting it to the context.
That's why I'm wondering if there is any alternative to SetDCBrushColor.
So that I can use my brush in FillRect.
Any help is greatly appreciated. Thanks in advance.