Jump to content

Create an image with GDI+


Recommended Posts

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
Link to comment
Share on other sites

_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
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...