How to Use Plgblt

I need to rotate picture by pressing arrows.

         rotate(dots, 90, 150, 120, size.cx, size.cy);
         PlgBlt(dc, dots, my_dc, 0, 0, size.cx, size.cy, my_mask, 0, 0);

There is a function - rotate. But I don't know where to put this part. When I put it into WM_TIMER - happens nothing. In WM_PAINT - too. What's wrong? Where put this code and where call this?

Here is WM_PAINT and WM_TIMER

case WM_PAINT:
    dc = BeginPaint(hwnd, &ps);

    GetClientRect(hwnd, &rect);
    BitBlt(mdc, 0, 0, info.bmWidth, info.bmHeight, bdc, 0, 0, SRCCOPY);
    MaskBlt(mdc, my_pos.x, my_pos.y, my_size.cx, my_size.cy, my_dc, 0, 0, my_mask, 0, 0, MAKEROP4(SRCCOPY, SRCPAINT));
    BitBlt(dc, 0, 0, rect.right, rect.bottom, mdc, 0, 0, SRCCOPY);
    EndPaint(hwnd, &ps);
break;
case WM_TIMER:
    if(LOWORD(wParam) == 777u) {  
        if(GetAsyncKeyState(VK_LEFT))
        {
            if (GreatFuncLeftRight(my_pos.x,my_pos.y))
            { 
                my_pos.x -= 2; 
            }
            else my_pos.x-=0;
        }
        if(GetAsyncKeyState(VK_RIGHT))
        {
            if (GreatFuncLeftRightReverse(my_pos.x,my_pos.y))
            {
                my_pos.x += 2; 
            }
            else my_pos.x+=0;
        }
        if(GetAsyncKeyState(VK_UP))
        {
            if (GreatFuncUpDown(my_pos.x,my_pos.y))
            {
                my_pos.y -= 2;
            }
            else my_pos.y-=0;// вверх
        }
        if(GetAsyncKeyState(VK_DOWN))
        {
            if (GreatFuncUpDownReverse(my_pos.x,my_pos.y))
            {
                my_pos.y += 2;  
            }
            else my_pos.y+=0;
        }
        InvalidateRect(hwnd, NULL, FALSE);
    }
    break;
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article