Gdip - Draw a line animation Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
SirSocks
Posts: 360
Joined: 26 Oct 2018, 08:14

Gdip - Draw a line animation

20 Oct 2021, 08:26

I’m brand new to Gdip. How can a line animation be drawn using Gdip? See the gif below.
An example script with comments would be very helpful.

All help and guidance is appreciated. Thank you.



Example Gif of line drawing animation.
Image
colt
Posts: 291
Joined: 04 Aug 2014, 23:12
Location: Portland Oregon

Re: Gdip - Draw a line animation  Topic is solved

20 Oct 2021, 09:09

most basic example

Code: Select all

SetUpGDIP()
pen := Gdip_CreatePen(0xffff0000,5)
setTimer, showLine, -1

showLine:
	mouseGetPos,x,y
	StartDrawGDIP()
	;ClearDrawGDIP()
	Gdip_DrawLine(G, pen, 0, 0, x,y)	
	EndDrawGDIP()
	setTimer, showLine, -1
	tooltip %x%`,%y%
return

#Include Gdip.ahk
#Include GdipHelper.ahk
Canvas.ahk https://github.com/Uberi/Canvas-AHK is also really good. I would suggest taking a look at that to if you are in the beginning stages.
User avatar
SirSocks
Posts: 360
Joined: 26 Oct 2018, 08:14

Re: Gdip - Draw a line animation

20 Oct 2021, 11:39

That is very helpful! Thank you very much @colt :bravo:
I'll check out Canvas aswell.
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Gdip - Draw a line animation

20 Oct 2021, 15:05

Another method.

Code: Select all

;****************************************************************************************************************************************************************************
#Include <My Altered GDIP lib> ;GDI+ Lib
#Include <PopUpWindow Class> ;https://www.autohotkey.com/boards/viewtopic.php?f=6&t=94961
;****************************************************************************************************************************************************************************
Gdip_Startup()
Gui1 := New PopUpWindow( { WindowName: "1" , WindowOptions: " -DPIScale +AlwaysOnTop " , WindowSmoothing: 2 , X: 0 , Y: 0 , W: A_ScreenWidth , H: A_ScreenHeight } )
Pen := Gdip_CreatePen( "0x99FF0000", 5 ) , Gdip_DrawLine( Gui1.G , Pen, 100 , 100 , 500 , 500 ) , Gdip_DeletePen( Pen )
Gui1.UpdateWindow()
Gui1.ShowWindow()
return
*ESC::ExitApp

Code: Select all

;****************************************************************************************************************************************************************************
#Include <My Altered GDIP lib> ;GDI+ Lib
#Include <PopUpWindow Class> ;https://www.autohotkey.com/boards/viewtopic.php?f=6&t=94961
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
CoordMode, Mouse, Screen
Gdip_Startup()
Pen := Gdip_CreatePen( "0x99FF0000", 5 )

Gui1 := New PopUpWindow( { WindowName: "1" , WindowOptions: " -DPIScale +AlwaysOnTop " , WindowSmoothing: 2 , X: 0 , Y: 0 , W: A_ScreenWidth , H: A_ScreenHeight } )
Gui1.ShowWindow()

SetTimer, Draw, 30
return

*ESC::ExitApp

Draw:
	MouseGetPos, x, y
	Gui1.ClearWindow()
	Gdip_DrawLine( Gui1.G , Pen, A_ScreenWidth / 2 , A_ScreenHeight / 2 , x , y ) 
	Gui1.UpdateWindow()
	return
User avatar
SirSocks
Posts: 360
Joined: 26 Oct 2018, 08:14

Re: Gdip - Draw a line animation

20 Oct 2021, 18:46

@Hellbent That's some nice clean code! I will defiantly experiment with your example. Thanks alot for your help.
By the way, Custom Gui Image Button is super awesome! :thumbup:
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Gdip - Draw a line animation

20 Oct 2021, 19:05

SirSocks wrote:
20 Oct 2021, 18:46
@Hellbent That's some nice clean code! I will defiantly experiment with your example. Thanks alot for your help.
By the way, Custom Gui Image Button is super awesome! :thumbup:
NP.

If you ever make any button designs I would love to get a copy of the button theme object.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: inseption86, jaka1, metallizer, Rohwedder and 336 guests