GDI+ standard library 1.45 by tic
-
- Posts: 941
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: GDI+ standard library 1.45 by tic
Good to hear . Please update to v1.95. I fixed some bugs related to that.
Best regards, Marius.
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: GDI+ standard library 1.45 by tic
Hi @robodesign,
with 1.95 the previous issue is existing again.
(with the same example).
GreetingZ
KruschenZ
with 1.95 the previous issue is existing again.
(with the same example).
GreetingZ
KruschenZ
-
- Posts: 941
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: GDI+ standard library 1.45 by tic
Interesting...
The problem is the following:
You are passing the brush as color. It is wrong. Pass it as userBrush, that parameter is the right way.
The initial creator of the GDI+ library uses this if condition: If !Gdip_DeleteBrush(Gdip_CloneBrush(Colour[2])) . It tests if it is a brush or not. It was wrong of him to do it this way.
It clones the supposed brush and deletes the brush. Now, on my system, cloning a brush that is non-existent causes a crash. So, i added extra-checks: if the string length is of 6 or 8, i consider it a color, not a brush [this is what i did in v1.95]. It seems the brush object handle iD has a string length of 6 or 8 .
I cannot have the library crash when users pass colour.
The solution in your case is, as i said, pass it as userBrush param.
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: GDI+ standard library 1.45 by tic
Hi @robodesign
ah, okay, thank you for this info/hint.
it works perfectly with this.
GreetingZ
KruschenZ
ah, okay, thank you for this info/hint.
it works perfectly with this.
GreetingZ
KruschenZ
Re: GDI+ standard library 1.45 by tic
Marius, your version of the library breaks compatibility with x64.
it always uses "UPtr" while x64 version uses "UInt" (among some other changes.
in an old library made by tic, you can find code like this:
A_PtrSize ? "UPtr" : "UInt"
this allows it to use UPtr or UInt depending on the bitness to be compatible with both versions.
I started updating my library to be compatible with x64 and I wanted to share it, but I realized that I was updating version 1.92, and I simply don't have the changelog necessary to update to your latest version.
It's a lot of work, but I guess it's better if you do it to have just one good source.
it always uses "UPtr" while x64 version uses "UInt" (among some other changes.
in an old library made by tic, you can find code like this:
A_PtrSize ? "UPtr" : "UInt"
this allows it to use UPtr or UInt depending on the bitness to be compatible with both versions.
I started updating my library to be compatible with x64 and I wanted to share it, but I realized that I was updating version 1.92, and I simply don't have the changelog necessary to update to your latest version.
It's a lot of work, but I guess it's better if you do it to have just one good source.
-
- Posts: 941
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: GDI+ standard library 1.45 by tic
Absolutely Incorrect statements, dear.Flowgun wrote: ↑25 Apr 2023, 07:11Marius, your version of the library breaks compatibility with x64.
it always uses "UPtr" while x64 version uses "UInt" (among some other changes.
in an old library made by tic, you can find code like this:
A_PtrSize ? "UPtr" : "UInt"
this allows it to use UPtr or UInt depending on the bitness to be compatible with both versions.
I started updating my library to be compatible with x64 and I wanted to share it, but I realized that I was updating version 1.92, and I simply don't have the changelog necessary to update to your latest version.
It's a lot of work, but I guess it's better if you do it to have just one good source.
Please read on ptr and uptr here :
https://www.autohotkey.com/docs/v1/lib/DllCall.htm#types
The original creator of the library developed it when ahk did not have ptr and uptr options, old ahk versions. Or he just wanted to keep it compatible with older ahk versions.
In addition to this , I'm working only on x64 and everything works. Nothing is broken.
The condition, on x64 and x32, A_PtrSize always yields uptr. The entire condition reads as: "If A_PtrSize is defined do uptr, if not uint."
A_PtrSize is 8 on x64 and 4 on x32. If you use old ahk version it's undefined, so it'll use uint.
Next time do your homework properly.
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: GDI+ standard library 1.45 by tic
hmmm fair enough. it's just that I was having some problems with the library, and they disappeared when I updated a few functions to have that condition. I'll investigate the issue further.
-
- Posts: 941
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: GDI+ standard library 1.45 by tic
If your investigations do point to an actual bug in my library, please do not hesitate to write back. But please make sure to provide a test case.
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: GDI+ standard library 1.45 by tic
btw, I noticed that the library doesn't have "Gdip_CreateBitmapFromScan0" as a function. I needed it to read webp files. maybe there's something equivalent to use and it's just my noobness. otherwise, I recommend adding it to the library.
-
- Posts: 941
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: GDI+ standard library 1.45 by tic
The function CreateBitmapFromScan0 is already covered by create bitmap function. Use search in the ahk file.
Gdi+ doesn't support webp.
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: GDI+ standard library 1.45 by tic
for Webp, I'm using Teadrinker's functions: viewtopic.php?t=66335
the "CreateBitmapFromScan0" that he is using doesn't default "Stride" to "0", but it does this calculation:
I don't know if it's safe modify the Gdip_CreateBitmap function within the library to also do that calculation instead of defaulting to zero, or if it's better to calculate it before the function and then pass it as an argument. All I know is that it is required in this use-case.
one of the problems I had was that I was shutting down pToken twice when jumping between functions, which crashes the script. In the past, I modified Gdip_Shutdown() to always load the gdiplus library in hmodule before shutting it down. This way, it always finds it and never crashes.
My current solution is to make pToken a super-Global, then, within functions, I do this:
I still have a couple of problems when I updated to the latest library. I will look more into them before posting about them.
the "CreateBitmapFromScan0" that he is using doesn't default "Stride" to "0", but it does this calculation:
Code: Select all
bpp := (PixelFormat & 0xFF00) >> 8
Stride := ((Width * bpp + 31) & ~31) >> 3
one of the problems I had was that I was shutting down pToken twice when jumping between functions, which crashes the script. In the past, I modified Gdip_Shutdown() to always load the gdiplus library in hmodule before shutting it down. This way, it always finds it and never crashes.
My current solution is to make pToken a super-Global, then, within functions, I do this:
Code: Select all
function(){
Global pToken
pTokenState := pToken
if !pTokenState
pToken := Gdip_Startup()
;;; gdip code goes here
if !pTokenState
pToken := Gdip_ShutDown(pToken)
}
-
- Posts: 941
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: GDI+ standard library 1.45 by tic
He uses a library DLL to load the WebP.
libwebp32Url := "https://s3.amazonaws.com/resizer-dynamic-downloads/webp/0.5.2/x86/libwebp.dll"
libwebp64Url := "https://s3.amazonaws.com/resizer-dynamic-downloads/webp/0.5.2/x86_64/libwebp.dll"
That is not GDI+. Please do not go offtopic here.
GDI+ start-up must be run once: when the script begins. And when everything is ending: shutdown. Not after every function is executed.
Best regards, Marius.
libwebp32Url := "https://s3.amazonaws.com/resizer-dynamic-downloads/webp/0.5.2/x86/libwebp.dll"
libwebp64Url := "https://s3.amazonaws.com/resizer-dynamic-downloads/webp/0.5.2/x86_64/libwebp.dll"
That is not GDI+. Please do not go offtopic here.
GDI+ start-up must be run once: when the script begins. And when everything is ending: shutdown. Not after every function is executed.
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: GDI+ standard library 1.45 by tic
Hello and sorry for such a simple basic question, but if a script is created using GDI, do you also need GDI on other computers to run said script on different computers?
It seems full of features, but if unable to run scripts on computers that don't also have GDI then it becomes severely limiting for my uses. Hoping I'm wrong...
It seems full of features, but if unable to run scripts on computers that don't also have GDI then it becomes severely limiting for my uses. Hoping I'm wrong...
Re: GDI+ standard library 1.45 by tic
@V0RT3X, afaik GDI and GDI+ (mind the difference) is part of Windows. Of course, you will need the GDI+ AutoHotkey library mentioned in this topic, or you simply put its relevant parts/functions (or the complete library) into your script file. Compiling to exe should also work, if your source code #includes the library.
Re: GDI+ standard library 1.45 by tic
@gregster, thank you. That makes sense.
-
- Posts: 5
- Joined: 09 Mar 2019, 07:56
Re: GDI+ standard library 1.45 by tic
Hello, are any of the changes made to Gdip_SaveBitmapToFile after 1.93 incompatible with Windows 7 x64?
I have a script that works perfectly with 1.93, outputting a bitmap file to the hard disk, but with 1.94, 1.94.1 and 1.95 it just creates an empty file.
I have a script that works perfectly with 1.93, outputting a bitmap file to the hard disk, but with 1.94, 1.94.1 and 1.95 it just creates an empty file.
-
- Posts: 941
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: GDI+ standard library 1.45 by tic
Please provide me with more details. What parameters do you pass to the function? What format do you want to save and doesn't work?ssjkakaroto wrote: ↑21 Aug 2023, 11:08Hello, are any of the changes made to Gdip_SaveBitmapToFile after 1.93 incompatible with Windows 7 x64?
I have a script that works perfectly with 1.93, outputting a bitmap file to the hard disk, but with 1.94, 1.94.1 and 1.95 it just creates an empty file.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
-
- Posts: 941
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: GDI+ standard library 1.45 by tic
Hello!
After investigations, saving as BMP failed. I fixed the bug. I released v1.96.
Thank you for the report.
Link to repository:
https://github.com/marius-sucan/AHK-GDIp-Library-Compilation
Best regards, Marius.
After investigations, saving as BMP failed. I fixed the bug. I released v1.96.
Thank you for the report.
Link to repository:
https://github.com/marius-sucan/AHK-GDIp-Library-Compilation
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
-
- Posts: 5
- Joined: 09 Mar 2019, 07:56
Re: GDI+ standard library 1.45 by tic
Sorry for the late reply. It's now working with 1.96, thank you for the fast fix!
The command was simple:
The command was simple:
Code: Select all
Gdip_SaveBitmapToFile(Haystack, "haystack.bmp")
Re: GDI+ standard library 1.45 by tic
Hello Gdip folks!
Say this 1.96 is not up to speed with the latest AHK 2.0.12 is it?
I see byref in there and VarSetCapacity which have been deprecated.
But is there a newer port? Or a better up-to-date lib? What should one use nowadays?
Cheers :
eRiC
Say this 1.96 is not up to speed with the latest AHK 2.0.12 is it?
I see byref in there and VarSetCapacity which have been deprecated.
But is there a newer port? Or a better up-to-date lib? What should one use nowadays?
Cheers :
eRiC