Sign in to follow this  
Followers 0
Tolf

Create an image with GDI+

5 posts in this topic

#1 ·  Posted (edited)

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



#3 ·  Posted (edited)

_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

Thx

I didn't search in WinAPI


My UDF : Array2D

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  
Followers 0