GDI+ standard library 1.45 by tic

Post your working scripts, libraries and tools
guest3456
Posts: 2024
Joined: 09 Oct 2013, 10:31

Re: GDI+ standard library 1.45 by tic

25 Jan 2017, 19:41

buliasz wrote:In case someone needs it, I've modified Gdip_All.ahk of mmikeww (guest3456) which work with AHK 2.0+ also. I made one bugfix and made additional little changes, so that it can now be used with the "#Warn All" flag enabled.
Surely there are more changes needed for "#Warn All", but they appear only when you use a particular function. The ones I used are working now.
You can get it here.


please submit a pull request and i will accept it and merge the changes

guest3456
Posts: 2024
Joined: 09 Oct 2013, 10:31

Re: GDI+ standard library 1.45 by tic

10 Feb 2017, 18:50

I have merged the changes from @buliasz and we've bumped the version to v1.51:

backward compatible with AHK v1.1 and forward-compatible with AHK v2:

https://github.com/mmikeww/AHKv2-Gdip

serg
Posts: 35
Joined: 21 Mar 2015, 05:33

Re: GDI+ standard library 1.45 by tic

03 Mar 2017, 06:36

Hi, has anyone encountered this problem with GDIP:
- top 25 pixels of GDIP-created Gui are "un-clickable" when Gui is inactive?

I.e. if I create GDIP Gui, then activate some other window, then click on top 25pix of this Gui - it doesn't get activated. If I click below top 25 pix - it does get activated, then clicking on top 25pix of Gui responds normally.
Any ideas?
I have the latest version of AHK, GDIP lib 1.45 by TIC and Win7 32
serg
Posts: 35
Joined: 21 Mar 2015, 05:33

Re: GDI+ standard library 1.45 by tic

17 Apr 2017, 02:21

Hi folks!
What is the fastest way to test if image created with GDIP actually contains image?
When I create bitmap and copy image there from image file - it works 99% of the time, but occasionally GDIP function returns empty image (I mean it returns handle that doesn't contain any image). Since I use this GDIP func thousands of times in a relatively short period of time, I would like to know what is the fastest way to test GDIP image.
Any input is welcome and appreciated!
Helgef
Posts: 2240
Joined: 17 Jul 2016, 01:02
Contact:

Re: GDI+ standard library 1.45 by tic

17 Apr 2017, 02:44

serg wrote:When I create bitmap and copy image there from image file - it works 99% of the time, but occasionally GDIP function returns empty image (I mean it returns handle that doesn't contain any image).

Check if the functions you are using sets ErrorLevel or the underlying windows functions sets A_LastError. If there is no image, maybe it doesn't have a width and height.

Good luck
User avatar
noname
Posts: 341
Joined: 19 Nov 2013, 09:15

Re: GDI+ standard library 1.45 by tic

17 Apr 2017, 04:31

Hi, has anyone encountered this problem with GDIP


It has something to do with Gui,new . I have the problem on winXP but not on win10.

You can try this code ,the green gui can be moved on winxp the black not at the top part.I solve with deleting the Gui,new codeline or giving it a name or number.
Maybe I use the "Gui, new" in a wrong way but as it works without it I never looked into it..........

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

serg
Posts: 35
Joined: 21 Mar 2015, 05:33

Re: GDI+ standard library 1.45 by tic

17 Apr 2017, 10:22

Helgef wrote:Check if the functions you are using sets ErrorLevel or the underlying windows functions sets A_LastError. If there is no image, maybe it doesn't have a width and height.
Good luck


Helgef, thanks for response!
I have 2 suspect GDIP functions:

Code: [Select all] [Download] GeSHi © Codebox Plus

Gdip_GraphicsFromImage(pBitmap){
DllCall("gdiplus\GdipGetImageGraphicsContext", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
return pGraphics
}
Gdip_CreateBitmap(Width, Height, Format=0x26200A){
DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, A_PtrSize ? "UPtr" : "UInt", 0, A_PtrSize ? "UPtr*" : "uint*", pBitmap)
Return pBitmap
}


Do you know if there is a way to make them set ErrorLevel if they fail (return handle to empty image)?

As for Height/Weight - you mean getting them thru Gdip_GetImageWidth/Height() could be the fastest way to test image?

Thanks!
serg
Posts: 35
Joined: 21 Mar 2015, 05:33

Re: GDI+ standard library 1.45 by tic

17 Apr 2017, 10:32

Noname, thanks for your input !
I'll try your code. Btw, I have this problem only on my other Win 7 machine, but not on Win 8.1
Helgef
Posts: 2240
Joined: 17 Jul 2016, 01:02
Contact:

Re: GDI+ standard library 1.45 by tic

17 Apr 2017, 10:56

Hi serg.
serg wrote:Do you know if there is a way to make them set ErrorLevel if they fail (return handle to empty image)?

According to msdn the functions should return 0 on success. That is add r:=DllCall("gdi...) and check that r==0.
serg wrote:As for Height/Weight - you mean getting them thru Gdip_GetImageWidth/Height() could be the fastest way to test image?

I meant something like that, but checking the return value would probably be much faster.

Good luck.
serg
Posts: 35
Joined: 21 Mar 2015, 05:33

Re: GDI+ standard library 1.45 by tic

17 Apr 2017, 11:41

Helgef, I really appreciate your help! Thanks!
serg
Posts: 35
Joined: 21 Mar 2015, 05:33

Re: GDI+ standard library 1.45 by tic

17 Apr 2017, 11:49

noname wrote:It has something to do with Gui,new . I have the problem on winXP but not on win10.


Noname, you are absolutely correct, - not using "Gui,new" fixes the problem.
Thank you for setting me on the right path! :-)

BTW, should it be reported to Lexikos as a bug?
just me
Posts: 4685
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: GDI+ standard library 1.45 by tic

17 Apr 2017, 15:38

Hi noname,

did you try

Code: [Select all] [Download] GeSHi © Codebox Plus

gui,  new, -Caption +E0x80000 +LastFound +OwnDialogs +Owner +hwndhwnd +alwaysontop
?

Also, which AHK version are you using?
Remaining with AHK 1.1.25.02 until v2 will become beta.
User avatar
noname
Posts: 341
Joined: 19 Nov 2013, 09:15

Re: GDI+ standard library 1.45 by tic

18 Apr 2017, 02:49

Code: [Select all] [Download] GeSHi © Codebox Plus

gui,  new, -Caption +E0x80000 +LastFound +OwnDialogs +Owner +hwndhwnd +alwaysontop


Thanks , just me.
Your suggestion works on winXP , I am using ahk version 1.1.25.01.
I guess creating an unnamed, unnumbered Gui can have its uses.

Since I use this GDIP func thousands of times in a relatively short period of time


Hi serg,
Maybe it is unrelated but I remember when using a resize function start/stopping gdip inside the function caused problems when using it repeatedly like resizing all images in a directory.It worked well if gdip was started only once at the beginning of the program outside the function.
serg
Posts: 35
Joined: 21 Mar 2015, 05:33

Re: GDI+ standard library 1.45 by tic

18 Apr 2017, 03:09

Hi Noname,
GDIP itself is started only once in my script, I don't know yet what exactly causes the problems, but I think Helgef's suggestion:

Code: [Select all] [Download] GeSHi © Codebox Plus

if Error := DLLCall(...) ...
will catch the perpetrator soon
Thanks again!
iseahound
Posts: 104
Joined: 13 Aug 2016, 21:04
GitHub: iseahound

Re: GDI+ standard library 1.45 by tic

21 Apr 2017, 23:19

Does anyone have a working GdipSaveImageToStream?

I tried messing with some code I found here, but it's beyond me.
https://autohotkey.com/board/topic/8552 ... etobuffer/


Specifically this code. (which can be inserted at the end of Gdip_SaveBitmapToFile)

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



I'm trying to avoid File I/O since the data will be converted to base64 and sent via HTTP.
User avatar
noname
Posts: 341
Joined: 19 Nov 2013, 09:15

Re: GDI+ standard library 1.45 by tic

22 Apr 2017, 08:59

Does anyone have a working GdipSaveImageToStream?


Here is some more "messing around" !

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
nnnik
Posts: 2187
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: GDI+ standard library 1.45 by tic

27 Apr 2017, 05:45

The examples for Matrices are off.
To be more precise the MatrixNegative = -1|0|0|0|0|0|-1|0|0|0|0|0|-1|0|0|0|0|0|1|0|0|0|0|0|1 is wrong.
Just making the colours values negative will result in negative results and clamping will lead to them being set to 0.
So instead of inverting the colours this matrix will make everything black.
The correct Matrix should be MatrixNegative = -1|0|0|0|0|0|-1|0|0|0|0|0|-1|0|0|0|0|0|1|0|1|1|1|0|1.
I will test this and confirm this then make a pull request on github.
Recommends AHK Studio
guest3456
Posts: 2024
Joined: 09 Oct 2013, 10:31

Re: GDI+ standard library 1.45 by tic

27 Apr 2017, 07:52

nnnik wrote:https://github.com/mmikeww/AHKv2-Gdip/pull/5

merged, thanks

User avatar
nnnik
Posts: 2187
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: GDI+ standard library 1.45 by tic

27 Apr 2017, 13:55

BTW I found this awesome description for Gradients:
https://www.codeproject.com/Articles/20 ... -made-easy
( We're still missing path gradients )
And this API description:
https://msdn.microsoft.com/en-us/library/vs/alm/ms534047(v=vs.85).aspx
Recommends AHK Studio

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 17 guests