Assembly language > Assembly discussions

Displaying an image with GDI+

(1/1)

Vortex:
A small example :


--- Code: ---   .if uMsg == WM_CREATE

        mov     rax,OFFSET StartupInfo
        mov     GdiplusStartupInput.GdiplusVersion[rax],1

        invoke  GdiplusStartup,ADDR token,ADDR StartupInfo,0
        invoke  UnicodeStr,ADDR filename,ADDR UnicodeFileName

        invoke  GdipCreateBitmapFromFile,ADDR UnicodeFileName,\
                ADDR BmpImage

        invoke  GdipCreateHBITMAPFromBitmap,BmpImage,\
                ADDR hBitmap+rip,0

        invoke  GdipDisposeImage,BmpImage

    .elseif uMsg == WM_PAINT

        invoke  BeginPaint,_hWnd,ADDR ps
        mov     hdc,rax

        invoke  CreateCompatibleDC,rax
        mov     hMemDC,rax

        invoke  SelectObject,rax,hBitmap+rip

        invoke  GetObject,hBitmap+rip,sizeof(BITMAP),ADDR bm
       
        lea     r11,bm
        mov     r10d,BITMAP.bmHeight[r11]
        mov     r9d,BITMAP.bmWidth[r11]

        invoke  BitBlt,hdc,0,0,r9,r10,\
                hMemDC,0,0,SRCCOPY
           
        invoke  DeleteDC,hMemDC
        invoke  EndPaint,_hWnd,ADDR ps
--- End code ---

Navigation

[0] Message Index

Go to full version