paste-demo-bitmap

: paste-demo-bitmap   { flag \ hbm hdcMem -- }

                GetHandle: DEMOW call OpenClipboard 0=

        IF      s" Can't Open Clipboard\n\n...press a key to continue"

                "demo-message

                2000 ms demo-message-off

                EXIT

        then

                SCREEN-WIDTH

                SCREEN-HEIGHT

                CreateCompatibleBitMap: demo-dc to hbm

                GetHandle: demo-dc

                call CreateCompatibleDC to hdcMem

                CF_BITMAP call GetClipboardData dup to hbm ?win-error

                hbm hdcMem call SelectObject drop

                flag

                IF     NOTSRCCOPY

                ELSE   SRCCOPY

                THEN

                0 0                       \ y,x origin

                hdcMem                    \ from memory dc

                SCREEN-HEIGHT             \ source height

                SCREEN-WIDTH              \ source width

                0 0                       \ y,x dest

                GetHandle: demo-dc        \ to screen

                call BitBlt ?win-error          \ invert the bitmap

                call CloseClipboard ?win-error

                hdcMem call DeleteDC ?win-error

\               hbm call DeleteObject ?win-error

                ;