Hello, I have a function that will find pixels (of a certain color) in a DC that are grouped together. Like an ellipse, or really any shape. The dimensions of the data is stored inside a RECT structure, and the found pixels are in a Character array, arranged like a monochrome bitmap (1 bit per pixel).
I am trying to visually display the result on the screen in the form of a monochrome bitmap, I've already tested the function by displaying the results in a console window so I know the FindClusters function is working perfectly, I simple can't draw the results on screen. When I try to, I get a mess of black and white pixels on the screen. Here is my code.
Code:
bool DrawCluster (HDC hDC, CLUSTER* Source)
{
    // If the cluster is empty don't try to do any operations on it.
    if (Source == NULL) return false;
 
    // The width and height of the source cluster
    int Source_Width = abs((*Source).Rect.right - (*Source).Rect.left) + 1;
    int Source_Height = abs((*Source).Rect.bottom - (*Source).Rect.top) + 1;
 
    HBITMAP Buffer_Bitmap = CreateBitmap (Source_Width, Source_Height, 1, 1, (*Source).Data);
    HDC Buffer = CreateCompatibleDC (NULL);
    SelectObject (Buffer, Buffer_Bitmap);
 
    return (BitBlt (hDC, 0, 0, Source_Width, Source_Height, Buffer, 0, 0, SRCCOPY) != 0);
}
I really have no idea where the problem is, but I know it's in this function. Does anyone have any ideas or a good example/article? Thanks everyone!