I want to use brushes for a drawing effect, but I must be doing something wrong or missing some important part. I've created some custom brush patterns which need to be "merged" with a bitmap, so when I blit it to the screen, the pattern is not a seperate overlay but an actual part of the bitmap so if there is any other image underneath, it will be visible . I don't know if I'm making sense, so below is a visual example :P
I've tried some approaches using raster ops but the result always affects the whole window. This is being done in pure GDI. Here is how I set up and use my custom brush:
// at the top of the program
HBITMAP hBrush1 = NULL;
WORD bits1[8] = { 0x1f, 0xf, 0x4f, 0xf, 0xff, 0xff, 0xff, 0xff }; //heaviest
// init function
hBrush1= CreateBitmap( 4, 4, 1, 1, ( LPBYTE ) bits1 );
// draw function
HBRUSH hCustomBrush = CreatePatternBrush( hBrush1 );
HBRUSH hOldBrush = ( HBRUSH )SelectObject( hdcBuffer, hCustomBrush );
SetROP2(hdcBuffer, R2_MASKPEN^R2_MASKPENNOT); //test
ExtFloodFill(hdcBuffer,0,0,RGB( 255, 0, 255 ),FLOODFILLBORDER); //test