Jump to content

GDI Plus function redundancies / errata


Recommended Posts

There are three functions which I have doubts about implementing:
_GDIPlus_ImageDispose

_GDIPlus_BitmapDispose

_WinAPI_DeleteObject

First of all, _GDIPlus_ImageDispose and _GDIPlus_BitmapDispose are exactly the same (they call the "GdipDisposeImage" function of GDIPlus.dll). So why are both implemented in the GDIPlus.au3 UDF?

Then there is _WinAPI_DeleteObject. Even though this is a GDI32.dll function (DeleteObject) and not a GDIPlus.dll function, this is used in the _GDIPlus_ImageDispose help file. Even more confusing is that it is used after the _GDIPlus_ImageDispose call, which makes it redundant.

Could someone help to clear things up?

Link to comment
Share on other sites

Have a look here: https://www.autoitscript.com/forum/topic/146026-diference-between-_gdiplus_bitmapcreatefromfile-_gdiplus_imageloadfromfile/?do=findComment&comment=1032804

First: GDI is not GDI+. Many user are mixing up both but you can merge both (by building "bridges") for your gfx code!

If you have created a GDI object handle then you have to release it using _WinAPI_DeleteObject(). In the help file _ScreenCapture_Capture() returns a GDI bitmap handle, thus is has to be released using _WinAPI_DeleteObject().

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

​ok, so there is a difference between a bitmap and an image. Nonetheless, the _GDIPlus_ImageDispose and _GDIPlus_BitmapDispose functions in the GDIPlus.au3 are exactly the same. Wouldn't it be more efficient to just define one and use those two calls as aliases?

 

First: GDI is not GDI+. Many user are mixing up both but you can merge both (by building "bridges") for your gfx code!

​I know that, but as indicated in the topic title, I am using GDI+.

 

If you have created a GDI object handle then you have to release it using _WinAPI_DeleteObject(). In the help file _ScreenCapture_Capture() returns a GDI bitmap handle, thus is has to be released using _WinAPI_DeleteObject().

I understand but I think this (or any GDI function, for that matter) shouldn't be in the example for a helpfile of a GDI+ function since it will only create confusion, don't you think?

Link to comment
Share on other sites

​ok, so there is a difference between a bitmap and an image. Nonetheless, the _GDIPlus_ImageDispose and _GDIPlus_BitmapDispose functions in the GDIPlus.au3 are exactly the same. Wouldn't it be more efficient to just define one and use those two calls as aliases?

​I cannot say why _GDIPlus_BitmapDispose has been added, probably not to mix up bitmap and image functions, although the dispose functions are the same. I can live with it.

 

I understand but I think this (or any GDI function, for that matter) shouldn't be in the example for a helpfile of a GDI+ function since it will only create confusion, don't you think?

How you want to use the captured image in GDI+ then? It might be difficult for a newbie to understand the differences but when you playing with the gfx functions you will learn and see the differences.

GDI and GDI+ are like father and son.

 

But feel free to contribute a better description in the help file.

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

We also need to be very cautious when reading variable names used in the helpfile (definitions and sample codes)  :)

One example among many others :

$hClone = _GDIPlus_BitmapCloneArea($hBitmap, ...)  ; a handle to a new Bitmap object
; ...
; Save bitmap to file
_GDIPlus_ImageSaveToFile($hClone, ...)


_GDIPlus_ImageSaveToFile($hImage, ...)
; ...
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP(...)  ; a handle to a Bitmap object
; Save resultant image
_GDIPlus_ImageSaveToFile($hImage1, ...)

 

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