GDI+ standard library 1.45 by tic

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

Re: GDI+ standard library 1.45 by tic

15 Nov 2017, 12:12

nnnik wrote:I think instead of waiting for them it would be faster to implement AHK v1.1 backwards compatability.
i will start to work on it.

User avatar
tidbit
Posts: 1094
Joined: 29 Sep 2013, 17:15
Location: USA

Re: GDI+ standard library 1.45 by tic

15 Nov 2017, 12:55

nnnik, you deleted the wrong link, you're lucky the old forum still has gdip_all.
https://autohotkey.com/board/topic/2944 ... 45-by-tic/
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
User avatar
nnnik
Posts: 3527
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: GDI+ standard library 1.45 by tic

15 Nov 2017, 13:52

Fixed
Recommends AHK Studio
guest3456
Posts: 2468
Joined: 09 Oct 2013, 10:31

Re: GDI+ standard library 1.45 by tic

15 Nov 2017, 15:54

just for reference for people reading:

tic's original:
https://github.com/tariqporter/Gdip/blo ... r/Gdip.ahk

Rseding's unicode and x64 Gdip_All fixes:
https://www.dropbox.com/s/0e9gdfetbfa8v0o/Gdip_All.ahk

AHK v2 version (now also backward compatible with v1 thanks to @nnnik):
https://github.com/mmikeww/AHKv2-Gdip

JoeSchmoe
Posts: 36
Joined: 08 Dec 2014, 08:58

Re: GDI+ standard library 1.45 by tic

03 Jan 2018, 19:26

guest3456 wrote:just for reference for people reading:

tic's original:
https://github.com/tariqporter/Gdip/blo ... r/Gdip.ahk

Rseding's unicode and x64 Gdip_All fixes:
https://www.dropbox.com/s/0e9gdfetbfa8v0o/Gdip_All.ahk

AHK v2 version (now also backward compatible with v1 thanks to @nnnik):
https://github.com/mmikeww/AHKv2-Gdip
Thanks. I found the following, taken from the last github link above, to be helpful in interpreting the above. I reproduce it here for reference:
History
  • @tic created the original Gdip.ahk library
  • @Rseding91 updated it to make it compatible with unicode and x64 AHK versions and renamed the file Gdip_All.ahk
  • this repository updates @Rseding91's Gdip_All.ahk to make it compatible with AHK v2
JoeSchmoe
Posts: 36
Joined: 08 Dec 2014, 08:58

Re: GDI+ standard library 1.45 by tic

03 Jan 2018, 19:29

Am I correct in understanding that everyone should use the mmikeww AHKv2-Gdip version? It seems to be the most compatible. (I actually use AHK 1.1)
guest3456
Posts: 2468
Joined: 09 Oct 2013, 10:31

Re: GDI+ standard library 1.45 by tic

03 Jan 2018, 20:11

JoeSchmoe wrote:Am I correct in understanding that everyone should use the mmikeww AHKv2-Gdip version? It seems to be the most compatible. (I actually use AHK 1.1)
That is meant to be used for AHK v2, but it should also be compatible with AHK 1.1. You can use that or you can use the normal Gdip_All.ahk, which ever you choose

iseahound
Posts: 355
Joined: 13 Aug 2016, 21:04
GitHub: iseahound

Re: GDI+ standard library 1.45 by tic

10 Apr 2018, 21:08

Added a pull request to the v2.

From

Code: Select all

	DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics, "UInt*", Region)
to

Code: Select all

	DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics, "UInt", Region)
Fixes crashes in create rounded rectange()
guest3456
Posts: 2468
Joined: 09 Oct 2013, 10:31

Re: GDI+ standard library 1.45 by tic

10 Apr 2018, 21:36

^merged thanks

jonathan scott james
Posts: 42
Joined: 05 Apr 2016, 01:56
Facebook: https://www.facebook.com/Jonathan-scott-james-for-

Re: GDI+ standard library 1.45 by tic

17 Apr 2018, 05:51

how do you recompile the autohotkey kernel to include gdi.ahk aurtomaticaly?
and how do you make it include gdi.ahk every time you compile a new .ahk script intto an exe? should i make a .bat file to replace the Ahk2Exe.exe file? with the line Ahk2Exe.exe/incluse gdi.ahk %%1 ? then use link to compile that into a new Ahk2Exe.exe. i don't even think i have link.. it was on dos2 dirty dos
jonathan scott james
Posts: 42
Joined: 05 Apr 2016, 01:56
Facebook: https://www.facebook.com/Jonathan-scott-james-for-

Re: GDI+ standard library 1.45 by tic

17 Apr 2018, 05:52

when will the new ahk kernel be ready?
User avatar
joedf
Posts: 6684
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: GDI+ standard library 1.45 by tic

17 Apr 2018, 09:32

Add #Include gdip_all.ahk to the beginning of your script or put it in your global library and it will be included automatically if the functions are used.
docs: https://autohotkey.com/docs/Functions.htm#lib
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
jonathan scott james
Posts: 42
Joined: 05 Apr 2016, 01:56
Facebook: https://www.facebook.com/Jonathan-scott-james-for-

Re: GDI+ standard library 1.45 by tic

18 Apr 2018, 13:19

why does this not show me the sine wave in the demo driver?

Code: Select all

;CfgSigrokJSJ = -d fx2lafw:conn=7.2 -O binary -o jsj.txt -c samplerate=20k --samples 1000
CfgSigrokJSJ = -d demo -O binary -o jsj.txt -c samplerate=20k --samples 10
run  sigrok-cli.exe %CfgSigrokJSJ%,,hide
loopcount:=0
Gui,scopejsj:+Resize +caption 
Gui,scopejsj:Add, Text ,x0 y0 h12 w2000 hwndhwnd1 +wrap vctrlv1 ;h w create disp area
Gui,scopejsj:Show,H300 W300 ;h w set window frame hight width
DC:=DllCall("GetDC",UInt,hwnd1)
MouseGetPos,x,y
DllCall("SelectObject",UInt,DC,UInt,DllCall("gdi32.dll\CreatePen","int",0,"int",1,"uint",0x00aa00))
DllCall("MoveToEx",UInt,DC,Uint,x,Uint,y,Uint,0)
SetTimer dispUp,500

;******main graph loop loop
DrawLine:

++loopcount
;MouseGetPos,x,y
inloop:
++y
StringMid,xx,hp,1
xx=Asc(xx)
DllCall("SelectObject",UInt,DC,UInt,DllCall("gdi32.dll\CreatePen","int",0,"int",1,"uint",0xffffff))
DllCall("MoveToEx",UInt,DC,Uint,y,Uint,0)
DllCall("LineTo",uint,DC,Uint,y,uint,200)
DllCall("MoveToEx",UInt,DC,Uint,y,Uint,xx_old,Uint,0)
DllCall("SelectObject",UInt,DC,UInt,DllCall("gdi32.dll\CreatePen","int",0,"int",1,"uint",0x00aa00))
DllCall("LineTo",uint,DC,Uint,y,uint,xx,int,0)
xx_old:=xx
;DllCall("ScrollWindow",uInt,DC,Int,0,Int,-1,Int,NULL,Int,NULL)
if y< 1000
	goto inloop
y:=0


GOTO DrawLine
return

;********update status display sub call timer
dispUp:
aaa:=strlen(jsj)
run  sigrok-cli.exe %CfgSigrokJSJ%,,hide
FileRead,jsj,jsj.txt
GuiControl scopejsj:,ctrlv1,%aaa%_%jsj%_%x%_%jsj%(XX=%xx%_X=%X%_Y=%Y%_Z=%Z%_loops=%loopcount%)

esc::
GuiClose:  ; User clicked "x" or pressed alt+f4 to closed the window.
ExitApp
jonathan scott james
Posts: 42
Joined: 05 Apr 2016, 01:56
Facebook: https://www.facebook.com/Jonathan-scott-james-for-

Re: GDI+ standard library 1.45 by tic

18 Apr 2018, 14:07

at first. when i made this, i thought the rest would be a piece of cake.. but somehow it all went wrong:

Code: Select all

loopcount:=0,x:=100,y:=100
Gui,1:+LastFound +Resize +caption
Gui,1: Add, Text ,h12 w200 x0 y0 vcunt1,
Gui,1:Show,H300 W300, vcunt
GuiHwnd := WinExist()
hDC:=DllCall("GetDC",UInt,GuiHwnd)
pen:=DllCall("gdi32.dll\CreatePen","int",0,"int",1,"uint",0x0000ff) 
MouseGetPos,x,y
DllCall("SelectObject",UInt,hdc,UInt,(pen))
DllCall("MoveToEx",UInt,hdc,Uint,x,Uint,y,Uint,0)

DrawLine:
loopcount:=loopcount+1
MouseGetPos, x, y

Gui, 1:Show,,(XX=%xx%_X=%X%_Y=%Y%_Z=%Z%_loops=%loopcount%)
GuiControl 1:,cunt1,(XX=%xx%_X=%X%_Y=%Y%_Z=%Z%_loops=%loopcount%)
DllCall("LineTo",uint,hdc,Uint,x-3,Uint,y-28)
GOTO DrawLine

esc::
GuiClose:  ; User clicked "x" or pressed alt+f4 to closed the window.
ExitApp
guest3456
Posts: 2468
Joined: 09 Oct 2013, 10:31

Re: GDI+ standard library 1.45 by tic

18 Apr 2018, 16:54

these have nothing to do with GDI+, and should be posted in Ask For Help

jonathan scott james
Posts: 42
Joined: 05 Apr 2016, 01:56
Facebook: https://www.facebook.com/Jonathan-scott-james-for-

Re: GDI+ standard library 1.45 by tic

18 Apr 2018, 22:00

it's gdi32.dll
buts since it's loaded, it is implyed
but this is the real shocker...
btw, if you can help me make include gdi.ahk work. please convert this to it. i can't even make gdi.ahk do anything but error on every command,
but the only way i can make it work so far is usung gdi32.dll in a dllcall command like this( remember calldll("gdi32.dll\movetoex",UInt,hdc,Uint,y,Uint,x) )

Code: Select all

;copyright jonathanscottjames the great
loopcount:=0,x:=100,y:=100
Gui,1:+LastFound +Resize HwndScopehwd 
Gui,1: Add, Text ,h12 w200 x0 y0 vScopev
Gui,1:Show,H300 W1024, 
hDC:=DllCall("GetDC",UInt,Scopehwd)
pen:=DllCall("CreatePen","int",0,"int",1,"uint",0x0000ff) 
MouseGetPos,x,y
DllCall("SelectObject",UInt,hdc,UInt,(pen))
DllCall("MoveToEx",UInt,hdc,Uint,y,Uint,x,Uint,0)
SetTimer statdisp,100

DrawLine:
loopcount:=loopcount+1
y:=y+1-1007*(y>1007),x:=x+1-50*(x>50)

DllCall("SelectObject",UInt,hdc,UInt,DllCall("CreatePen","int",0,"int",1,"uint",0xffffff))
DllCall("MoveToEx",UInt,hdc,Uint,y,Uint,0)
DllCall("LineTo",uint,hdc,Uint,y,Uint,51)

DllCall("SelectObject",UInt,hdc,UInt,DllCall("CreatePen","int",0,"int",1,"uint",0x0000ff))
DllCall("LineTo",uint,hdc,Uint,y,Uint,x)
;sleep ,1
GOTO DrawLine

statdisp:
GuiControl 1:, Scopev,(%Scopehwd%_X=%X%_Y=%Y%_loops=%loopcount%)
Gui, 1:Show,,(X=%X%_Y=%Y%_loops=%loopcount%)
return

esc::
GuiClose:  ; User clicked "x" or pressed alt+f4 to closed the window.
ExitApp
;MouseGetPos, x, y
jonathan scott james
Posts: 42
Joined: 05 Apr 2016, 01:56
Facebook: https://www.facebook.com/Jonathan-scott-james-for-

Re: GDI+ standard library 1.45 by tic

19 Apr 2018, 02:51

i copied gdi.ahk into the directory.. where do i get gdi+
it says can't start gdi+

Code: Select all

#SingleInstance, Force
#NoEnv
SetBatchLines, -1

; Uncomment if Gdip.ahk is not in your standard library
#Include, Gdip.ahk

 Start gdi+
If !pToken := Gdip_Startup()
{
	MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
	ExitApp
}
OnExit, Exit

; Set the width and height we want as our drawing area, to draw everything in. This will be the dimensions of our bitmap
Width := 5100, Height := 6600

; Create a gdi bitmap with width and height of what we are going to draw into it. This is the entire drawing area for everything
hbm := CreateDIBSection(Width, Height)

; Get a device context compatible with the screen
bhdc := CreateCompatibleDC()

; Select the bitmap into the device context
obm := SelectObject(bhdc, hbm)

; Get a pointer to the graphics of the bitmap, for use with drawing functions
G := Gdip_GraphicsFromHDC(bhdc)

; Set the smoothing mode to antialias = 4 to make shapes appear smother (only used for vector drawing and filling)
Gdip_SetSmoothingMode(G, 4)

; Create a fully opaque red pen (ARGB = Transparency, red, green, blue) of width 3 (the thickness the pen will draw at) to draw a circle
pPen := Gdip_CreatePen(0xffff0000, 3)

; Draw an ellipse into the graphics of the bitmap (this being only the outline of the shape) using the pen created
; This pen has a width of 3, and is drawing from coordinates (100,50) an ellipse of 200x300
Gdip_DrawEllipse(G, pPen, 50, 50, 5000, 6500)

; Delete the pen as it is no longer needed and wastes memory
Gdip_DeletePen(pPen)

; Create a slightly transparent (66) blue pen (ARGB = Transparency, red, green, blue) to draw a rectangle
; This pen is wider than the last one, with a thickness of 10
pPen := Gdip_CreatePen(0x660000ff, 10)

; Draw a rectangle onto the graphics of the bitmap using the pen just created
; Draws the rectangle from coordinates (250,80) a rectangle of 300x200 and outline width of 10 (specified when creating the pen)
Gdip_DrawRectangle(G, pPen, 50, 50, 5000, 6500)

; Delete the brush as it is no longer needed and wastes memory
Gdip_DeletePen(pPen)


  StringToPrint := "Defenestration can be hazardous"
  Document_Name :="print test"
  DllCall("LoadLibrary","str","comdlg32.dll")
  ;PRINTDIALOG_STRUCT
  VarSetCapacity(PRINTDIALOG_STRUCT,66,0), NumPut(66,PRINTDIALOG_STRUCT)
  ; PD_RETURNDEFAULT: Return hDevMode and hDevNames for default printer,
  ; instead of displaying the dialog.
  ; PD_RETURNDC: Return a printer device context.
  NumPut((PD_RETURNDC:=0x100),PRINTDIALOG_STRUCT,20) ; (PD_RETURNDC:=0x100)|(PD_RETURNDEFAULT:=0x400)
  if !DllCall("comdlg32\PrintDlgA","uint",&PRINTDIALOG_STRUCT)
    return
  ; Free unneeded (for now) structures created by PrintDlg().
  if (hDevMode := NumGet(PRINTDIALOG_STRUCT,8))
    DllCall("GlobalFree","uint",hDevMode)
  if (hDevNames := NumGet(PRINTDIALOG_STRUCT,12))
    DllCall("GlobalFree","uint",hDevNames)
  ; Get the newly created printer device context.
  if (hDC := NumGet(PRINTDIALOG_STRUCT,16))
    {
    VarSetCapacity(DOCUMENTINFO_STRUCT,20,0), NumPut(20,DOCUMENTINFO_STRUCT), NumPut(&Document_Name,DOCUMENTINFO_STRUCT,4)
    if DllCall("StartDoc","uint",hDC,"uint",&DOCUMENTINFO_STRUCT,"int") > 0
      {
      if DllCall("StartPage","uint",hDC,"int") > 0
        {
        DllCall("TextOut","uint",bhDC,"int",xPos,"int",yPos ,"str",StringToPrint,"int",StrLen(StringToPrint))
        BitBlt(hDC, 0, 0, width, height, bhDC, 0, 0)

        DllCall("EndPage","uint",hDC,"int")
        }
      DllCall("EndDoc","uint",hDC)
      }
    DllCall("DeleteDC","uint",hDC)
    
    }

; Select the object back into the hdc
SelectObject(hdc, obm)

; Now the bitmap may be deleted
DeleteObject(hbm)

; Also the device context related to the bitmap may be deleted
DeleteDC(hdc)

; The graphics may now be deleted
Gdip_DeleteGraphics(G)
Return


Exit:
; gdi+ may now be shutdown on exiting the program
Gdip_Shutdown(pToken)
ExitApp
Return
User avatar
jNizM
Posts: 2341
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: GDI+ standard library 1.45 by tic

19 Apr 2018, 06:10

jonathan scott james wrote:i copied gdi.ahk into the directory

Code: Select all

#Include, Gdip.ahk
gdi.ahk != gdip.ahk
[AHK] 1.1.30.01 x64 Unicode | [WIN] 10 Pro (Version 1803) x64 | [GitHub] Profile
Donations are appreciated if I could help you
User avatar
nnnik
Posts: 3527
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: GDI+ standard library 1.45 by tic

19 Apr 2018, 06:17

Well if you have the correct gdip.ahk and still get the message then it is one of the following:

A) you are running this on an old system ( prior to Win XP )
B) you are running this on Linux with WINE
C) you have the wrong gdip.ahk for your AHK installation ( the original version only supported 32 bit AHK see https://www.dropbox.com/s/0e9gdfetbfa8v0o/Gdip_All.ahk )
D) something is seriously wrong with your PC
Recommends AHK Studio

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 33 guests