Fibonacci word/fractal: Difference between revisions

Content added Content deleted
Line 13: Line 13:
=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
Prints F_Word<sub>30</sub> currently. Segment length and F_Word<sub>n</sub> can be adjusted.
Prints F_Word<sub>30</sub> currently. Segment length and F_Word<sub>n</sub> can be adjusted.
{{libheader|GDIP}}Some portions of code from [http://www.autohotkey.com/board/topic/29449-gdi-standard-library-145-by-tic/ Gdip examples].
{{libheader|GDIP}}Also see the [http://www.autohotkey.com/board/topic/29449-gdi-standard-library-145-by-tic/ Gdip examples].
<lang AutoHotkey>SetBatchLines, -1
<lang AutoHotkey>#NoEnv
SetBatchLines, -1
; #MaxMem 200 ; Increased memory required for F_Word > 37
p := 0.3 ; Segment length (pixels)
p := 0.3 ; Segment length (pixels)
F_Word := 30
F_Word := 30


SysGet, Mon, MonitorWorkArea
SysGet, Mon, MonitorWorkArea
W := FibWord(F_Word), d := 1, x1 := 0, y1 := MonBottom
W := FibWord(F_Word)
d := 1
, Width := A_ScreenWidth, Height := A_ScreenHeight
x1 := 0
y1 := MonBottom
Width := A_ScreenWidth
Height := A_ScreenHeight


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


Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
Gui, 1: Show, NA


hwnd1 := WinExist(), hbm := CreateDIBSection(Width, Height), hdc := CreateCompatibleDC()
hwnd1 := WinExist()
hbm := CreateDIBSection(Width, Height)
, obm := SelectObject(hdc, hbm), G := Gdip_GraphicsFromHDC(hdc), Gdip_SetSmoothingMode(G, 4)
hdc := CreateCompatibleDC()
, pPen := Gdip_CreatePen(0xffff0000, 1)
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetSmoothingMode(G, 4)
pPen := Gdip_CreatePen(0xffff0000, 1)


Loop, Parse, W
Loop, Parse, W
Line 58: Line 66:
}
}


Gdip_DeletePen(pPen), UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width, Height)
Gdip_DeletePen(pPen)
UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width, Height)
, SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc), Gdip_DeleteGraphics(G)
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(G)
return
return


Line 69: Line 81:


Esc::
Esc::
Shutdown:
Exit:
Gdip_DeletePen(pPen), SelectObject(hdc, obm), DeleteObject(hbm)
Gdip_DeletePen(pPen)
SelectObject(hdc, obm)
, DeleteDC(hdc), Gdip_DeleteGraphics(G), Gdip_Shutdown(pToken)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(G)
Gdip_Shutdown(pToken)
ExitApp</lang>
ExitApp</lang>