Jump to content

GDIPlus - Preview and then generate to file


Recommended Posts

Hello all . i'm trying to build a tool to generate some pictures/graphs automatically based on some variables. I have completed the first part and I'm struggling now on what I thought would be the easiest part :

In my tool there is a "preview" button, which helps to display on a new children GUI the generated picture. What I do in simplified :

Global $g_hGraphics = _GDIPlus_GraphicsCreateFromHWND($g_hGUI)
;Then, I'll add multiple objects to this graphic, for example
$Temp =  _GDIPlus_ImageLoadFromFile($temp[1])
_GDIPlus_GraphicsDrawImage($g_hGraphics,$temp)

 

I'm then able to have a preview GUI showing all my elements perfectly. This works but now I want to be able to really generate it and have a ".png" file written to disk.

What I tried without success:

$g_hBitmap = _GDIPlus_BitmapCreateFromGraphics($previewWidth, $previewHeight, $g_hGraphics)
        _GDIPlus_ImageSaveToFile($g_hBitmap,$OUTPUTDIR & "\generated\test-"&@HOUR&@MIN&@SEC&".png")

But what I write to file is a transparent PNG without anything.

I'm pretty sure I'm missing something obvious there, I need your help :)

 

 

NB : If this change your answer, my goal will be to generate transparent png, meaning I'll add multiple objects/pictures/texts on a transparent png background and if there are some "transparent holes" I need them to be transparent in the generated png.

 

Thanks a lot for any help !

Tim

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...