Fractal painting inside window

Hello, i am making multi-threaded fractal generation program, but i run into problem how to paint it. Right now i am using simple SetPixel command, but it's too slow.
Does any one know how to paint in window ?
I found example how to open it, find a way to paint bmp but not in the window, but in defined location on screen
In Dev C++ windows application example is program witch crate window with function CreateWindowEx, but i was unable to write message, or display bpm
if some on know how to do that, that would be great
You should split the responsibilities as follows. Break the image into regions and give these tasks to threads. The controlling thread gets the results and renders them. Multiple threads shouldn't be writing to the screen, you'll get yourself into all kinds of trouble with that approach.
Ok, all problems sort out, now only one is left.
I need to be able to repaint bmp as fast as it can be calculated, like animation .
but i don't know how to update window
window code looks like this

LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

    switch(msg)
    {
        case WM_LBUTTONDOWN:
        {
            zoom+=5;
            sideJob();
            g_hbmBall = CreateBitmap( 400, 400, 1,32,wBits);
            BITMAP bm;
            PAINTSTRUCT ps;
            
            HDC hdc = BeginPaint(hwnd, &ps);
            
            HDC hdcMem = CreateCompatibleDC(hdc);
            HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmBall);
            
            GetObject(g_hbmBall, sizeof(bm), &bm);
            
            BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
            
            SelectObject(hdcMem, hbmOld);
            DeleteDC(hdcMem);
            EndPaint(hwnd, &ps);
        }
        break;
        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
             PostQuitMessage(0);
        break;
        default:
                return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;

}


i need to find right switch, or what ? (SideJob will update matrix for bmp creation, all variables are global)
Last edited on
Topic archived. No new replies allowed.