Page 17 of 23

Re: GDI+ standard library 1.45 by tic

Posted: 12 Sep 2019, 13:25
by robodesign
Hello!

Today, six new functions:
Spoiler
This GDI+ library wrapper has two new specialized functions for easily writing texts:

Gdip_DrawOrientedString() - allows you to draw filled strings or string contours/outlines, or both, and have the text rotated at any angle. On success, its boundaries are returned.

Gdip_DrawStringAlongPolygon() - allows you to draw a string along a pPath object or along multiple given coordinates.

To illustrate these new functions, I added Example 17 and an image attached to this post :-).
Presse-papiers-20190912.jpg
Presse-papiers-20190912.jpg (63.52 KiB) Viewed 8305 times
Just with a few lines of code:

Code: Select all

pBrushBgr := Gdip_BrushCreateSolid(0x88eeffee)
Gdip_FillRectangle(G, pBrushBgr, 1, 1, 990, 990)

pBrush := Gdip_BrushCreateSolid(0x660000ff)
PolygonLine := "50,190|400,390|890,190|800,990"
Gdip_DrawStringAlongPolygon(G, "Oh my God, example text!", "Arial", 100, 1, pBrush, PolygonLine)

pPen := Gdip_CreatePen("0xCC990011", 5)
Gdip_DrawOrientedString(G, "Contour text example", "Verdana", 90, 1, 20, 500, 800, 800, 45, pBrushBgr, pPen, 1)
Tomorrow I will try to get to ImageAttributes stuff.

Best regards, Marius.

Re: GDI+ standard library 1.45 by tic

Posted: 13 Sep 2019, 08:23
by guest3456
iPhilip wrote:
10 Sep 2019, 20:21
Hi @robodesign,

I noticed a possible error in your library.

Code: Select all

Gdip_CreateHICONFromBitmap(pBitmap) {
   pBitmap := ""  ; <--- I think this line should not be here
   hIcon := 0

   DllCall("gdiplus\GdipCreateHICONFromBitmap", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "uint*", hIcon)
   return hIcon
}
robodesign wrote:
11 Sep 2019, 02:58
@iPhilip . True. It is an error inherited from mmikeww's GDI+ lib edition. I will have it fixed in the next update [today or tomorrow ]. Thanks very much for spotting the error.
why is that line an error? i believe that was added to prevent #warnings from uninitilized variables

Re: GDI+ standard library 1.45 by tic

Posted: 13 Sep 2019, 09:25
by swagfag
i dont remember what the function does exactly, but if u clear the bitmap, what bitmap are u creating an icon from then?

Re: GDI+ standard library 1.45 by tic

Posted: 13 Sep 2019, 10:36
by robodesign
@guest3456 : SwagFag nailed it. That is why it is an error. I know about the #Warn related changes, but in that function, it ruins it all.

Re: GDI+ standard library 1.45 by tic

Posted: 13 Sep 2019, 15:28
by robodesign
Hello!

10 new GDI+ functions.
Spoiler
Gdip_SetImageAttributesColorKeys() causes a crash on my end, I do not know why. If you guys want to test it...

Gdip_DrawImage() can now receive as a parameter an ImageAttributes object handle, and then the matrix parameter is ignored, because it is redundant, as the user can construct his/her own imageAttributes object as they want. I did my best to maintain compatibility with the original Gdip library.

I am almost over with the work on the library... I will see what other functions I might implement... Currently planned, none. Just some general overview, list of functions structured by GDI+ classes.

Link: https://github.com/marius-sucan/AHK-GDIp-Library-Compilation

Best regards, Marius.

Re: GDI+ standard library 1.45 by tic

Posted: 13 Sep 2019, 23:36
by guest3456
swagfag wrote:
13 Sep 2019, 09:25
i dont remember what the function does exactly, but if u clear the bitmap, what bitmap are u creating an icon from then?
duh lol i see thanks

Re: GDI+ standard library 1.45 by tic

Posted: 14 Sep 2019, 07:59
by DRocks
is this 2015 link:
Download: Gdip_All.ahk ( reccomended library Version for all AHK Versions ( ANSI|Unicode, x64|x86 ) )
...the most up to date link for using gdip+ on windows 64bits ?

Re: GDI+ standard library 1.45 by tic

Posted: 14 Sep 2019, 08:06
by robodesign
@DRocks .the most up to date is... Here https://github.com/marius-sucan/AHK-GDIp-Library-Compilation

The edition is maintained by me and it's the most complete gdip library you can find. It has about 255 new functions that enable you to create new things previously not possible.

It works with x64 & 32 bits of AHK v1.1 and most likely with AHK V2 as well.

Best regards, Marius.

Re: GDI+ standard library 1.45 by tic

Posted: 14 Sep 2019, 11:30
by DRocks
All right! Nice man, thank you for the link !!

hello im trying to make my bitmap gray sacle

Posted: 15 Sep 2019, 10:28
by arazu
pBitmapBotitHay := Gdip_BitmapFromHWND(hwnd := WinExist("" targetwindow "" ))
GDI_GrayscaleBitmap(pBitmapBotitHay) ; not working
Gdip_SetBitmapToClipboard(pBitmapBotitHay)
pBitmapBotitN := Gdip_CreateBitmapFromFile(ImgFileName)
result:= Gdip_ImageSearch(pBitmapBotitHay,pBitmapBotitN,List,0,0,0,0,75,0,1,0)

im trying to set my pBitmapBotitHay on gray scale before in image match it.
seen a few scripts but non worked.

i can see gdip got it but i cant find how to call it

hello im trying to make my bitmap gray sacle

Posted: 15 Sep 2019, 10:28
by arazu

Code: Select all

        pBitmapBotitHay := Gdip_BitmapFromHWND(hwnd := WinExist("" targetwindow "" ))
	GDI_GrayscaleBitmap(pBitmapBotitHay) ; not working
	Gdip_SetBitmapToClipboard(pBitmapBotitHay)
	pBitmapBotitN := Gdip_CreateBitmapFromFile(ImgFileName)
	result:= Gdip_ImageSearch(pBitmapBotitHay,pBitmapBotitN,List,0,0,0,0,75,0,1,0)
        
im trying to set my pBitmapBotitHay on gray scale before in image match it.
seen a few scripts but non worked.

i can see gdip got it but i cant find how to call it

Re: GDI+ standard library 1.45 by tic

Posted: 16 Sep 2019, 09:44
by robodesign
Hello, guys!

The work continues... 10 new functions implemented:
Spoiler
A few more functions are planned...

Link : https://github.com/marius-sucan/AHK-GDIp-Library-Compilation

I also created a functions-list.txt file to help give users a perspective/overview of what you can find in this library.

Best regards, Marius.

Re: GDI+ standard library 1.45 by tic

Posted: 16 Sep 2019, 13:05
by Frosti
Your work will be helpfull. It´s nice to have more functions!
Thank you.

Re: GDI+ standard library 1.45 by tic

Posted: 17 Sep 2019, 11:44
by robodesign
@Frosti : Thank you very much .

Today's update brings six new functions:
Spoiler
I also had to rename a few recently added functions. The TXT is also updated to reflect the changes in the AHK file.

The functions-list.txt file also lists GDI+ functions that are not yet implemented, about 170 functions.

PS. In case someone wonders, I actually test the functions I add ;).

Best regards, Marius.

Re: GDI+ standard library 1.45 by tic

Posted: 19 Sep 2019, 07:46
by guest3456
robodesign wrote:
17 Sep 2019, 11:44
PS. In case someone wonders, I actually test the functions I add ;).
it would be useful if you added Example files for them, that way we can test to make sure they work correctly

also i wish your commits were more atomic, so that i could merge some changes back into the v1/v2 lib. you tend to make big commits encompassing many multiple changes all at once. this is bad git practice for this very reason. each commit should be one logical change in the codebase. you seem to be using a git commit simply as a "save button" and every now and then you just click save do a git commit. its more of an art than a science, but in general you should tend to keep your commits smaller if possible.

Re: GDI+ standard library 1.45 by tic

Posted: 19 Sep 2019, 12:48
by robodesign
@guest3456 . Thank you for the suggestions.

There are several new examples that feature most of the new major features. The most recent one is written by me. Have you seen those?

About Github. Yes, I am aware of the good practice regarding commits. However, I am a bit lazy to perform commits on every tiny change. Example: «updated comments for function Gdip_blahBlah()». .... or, «changed the order of X, Y, Z functions»... I feel a lot more comfortable to make commits at the end of the day and when I know that the functions were tested, not semi-implemented, half-worked.

But yeah, I agree, some of my earlier commits were too large.

I made a new commit now, v1.74. It features two new functions Gdip_CompareBitmaps() [now, with an accuracy option] by Tariq and Gdip_ResizeBitmap() by me. In addition, two GDI functions, related to DIBs.

Best regards, Marius.

Re: GDI+ standard library 1.45 by tic

Posted: 23 Sep 2019, 07:59
by robodesign
Hello, guys!

I updated my GDI+ iibrary edition with four new functions related to bitmaps:
Spoiler
Link: https://github.com/marius-sucan/AHK-GDIp-Library-Compilation
Version: 1.75.

Edit. Updated to 1.76. Minor fixes.

Best regards, Marius.

Re: GDI+ standard library 1.45 by tic

Posted: 30 Sep 2019, 20:01
by malcev
Don`t You want to add check for ErrorLevel and return value of each DllCall?
It would be good for debugging.

Re: GDI+ standard library 1.45 by tic

Posted: 01 Oct 2019, 08:42
by robodesign
Yes, I agree.... But, it's a lot of work ^_^

I did my best to offer the users of the library the possibility to know when an error occurs.

For example, when possible, I return the result of the DLL call, which often is a gdip status enumeration code. In other cases, it returns - 1 as an error when the function fails to retrieve a specific value. In such instances, to return the status enumeration code, would be wrong, because often it can be confused with the value intended to be retrieved.

Contributions are welcomed, here or as GitHub pull requests.

Best regards, Marius.

Re: GDI+ standard library 1.45 by tic

Posted: 27 Oct 2019, 12:15
by robodesign
Hello!

A new release of the GDI+ library, extended compilation edition v1.78. Added 5 new GDI+ functions and bug fixes for Gdip_TestBitmapUniformity(), Gdip_RotateBitmapAtCenter() and Gdip_ResizeBitmap().

The new functions:
- Gdip_CreateFontFamilyFromFile() by tmplinshi
- Gdip_BitmapConvertGray()
- Gdip_BitmapSetColorDepth()
- Gdip_BitmapConvertFormat()
- Gdip_GetImageRawFormat()

Now, the following functions allow the use of a private font, by pointing them to a specific font file: Gdip_DrawOrientedString(), Gdip_DrawStringAlongPolygon() and Gdip_TextToGraphics().

Download link: https://github.com/marius-sucan/AHK-GDIp-Library-Compilation

Best regards, Marius.