open-demo-bitmap

\ ---------------------------------------------------------------

\ Open image file support

\ ---------------------------------------------------------------

: open-demo-bitmap     { \ open$ hbm hdcMem --  }

                max-path LocalAlloc: open$

                GetHandle: DEMOW 

                

                Start: ViewBitmap dup c@ \ -- a1 n1

                

                open$ dup c@    

               IF      count 

                        LR_LOADFROMFILE

                        LR_CREATEDIBSECTION or

                        NULL

                        NULL

                        IMAGE_BITMAP

                        open$ dup +NULL 1+

                        NULL

                        Call LoadImage to hbm

                        GetHandle: demo-dc

                        Call CreateCompatibleDC to hdcMem

                        hbm hdcMem Call SelectObject  drop

                        SRCCOPY                                   \

                        0 0                                       \ y,x origin

                        hdcMem                                    \ from memory dc

                        SCREEN-HEIGHT                             \ height of dest rect

                        SCREEN-WIDTH                              \ width of dest rect

                        0 0                                       \ y,x dest

                        GetHandle: demo-dc                        \ to screen

                        Call BitBlt ?win-error                    \

                        hdcMem Call DeleteDC ?win-error

                ELSE    DROP

                THEN

                 ;