Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

GDI+ demo

Started by Vortex, April 10, 2020, 05:19:27 AM

Previous topic - Next topic


OK, I have a question, I have an example that loads a BMP image and displays it on the client area which gives me a bitmap handle.

If I try to use the bitmap handle with,

    invoke GdipSaveImageToFile,bitmap,L(filename),rax,NULL

It will not start. If I put 0 as the first arg that app will at least run but the function does not work.

I don't know what is expected with the first argument, the reference material I have says a pointer to the image. What would you normally point at it ?



the handle must be Gdi+, not Gdi:

GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBitmap** bitmap)

Creates a Bitmap::Bitmap object based on a handle to a Windows Graphics Device Interface (GDI) bitmap and a handle to a GDI palette.


Thanks, that worked correctly. I now have a function that will write an empty 0 length file to disk.


It vurx, it vurx !!!! Like Frankenstein  :tongue:

Powered by Vortex, Siekmanski and JJ2007.  :biggrin:

I have done 3 different types, JPG, PNG and BMP. All seem to work OK.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    CLSID_ImageType1 GUID <0557CF401h,01A04h,011D3h,<09Ah,073h,000h,000h,0F8h,01Eh,0F3h,02Eh>>
    pJPG@@@@@@ dq CLSID_ImageType1


; ------------------------------------------

SaveAsJPG proc bmHandle:QWORD,filename:QWORD

    LOCAL hGdip :QWORD

    invoke GdipCreateBitmapFromHBITMAP,bmHandle,0,ptr$(hGdip)
    invoke GdipSaveImageToFile,hGdip,L(filename),pJPG@@@@@@,NULL
    invoke GdipDisposeImage,hGdip


SaveAsJPG endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤



The BMP to PNG convertion example is translated to Poasm.