NO

Author Topic: Displaying an image with GDI+  (Read 174 times)

Online Vortex

  • Member
  • *
  • Posts: 792
    • http://www.vortex.masmcode.com
Displaying an image with GDI+
« on: December 17, 2023, 12:43:04 PM »
A small example :

Code: [Select]
   .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
Code it... That's all...