Jump to content
Sign in to follow this  
Tolf

Create an image with GDI+

Recommended Posts

Tolf

Hi

In my script, I have to create an image with GDI+ and I do this :

Func CreateImage($width, $height, ByRef $h_image, ByRef $h_graphic)
    Local $hwndtemp = GUICreate("", $width, $height)
    
    $h_bitmap = _ScreenCapture_CaptureWnd("", $hwndtemp, 0, 0, $width, $height)
    $h_image = _GDIPlus_BitmapCreateFromHBITMAP($h_bitmap)
    $h_graphic = _GDIPlus_ImageGetGraphicsContext($h_image)
    _GDIPlus_GraphicsClear($h_graphic, 0xFFFFFFFF)
    
    GUIDelete($hwndtemp)
EndFunc
...but I think it is not the best way to create an image (using a window :P ).

So how can I create my image without using a window ?

Thank you for answering !

Edited by Tolf

My UDF : Array2D

Share this post


Link to post
Share on other sites
Zedna

_WinAPI_CreateBitmap()

Func CreateImage($width, $height, ByRef $h_image, ByRef $h_graphic)    
    $h_bitmap = _WinAPI_CreateBitmap($width, $height)
    $h_image = _GDIPlus_BitmapCreateFromHBITMAP($h_bitmap)
    $h_graphic = _GDIPlus_ImageGetGraphicsContext($h_image)
    _GDIPlus_GraphicsClear($h_graphic, 0xFFFFFFFF)
EndFunc
Edited by Zedna

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.