GpGFX is a graphics library for AutoHotkey v2, providing drawing and rendering capabilities using Gdiplus (also known as GDI+). It includes classes for creating and manipulating shapes, colors, fonts, layers, and more. For more information on GDI+, visit the Microsoft documentation. This is still an early version of the library, so expect some bugs and changes.
- Watch a demo of GpGFX in action on YouTube.
- Watch the presentation CS50x - Final Project.
- Watch CS50AI - Depth First Search (DFS), Breadth First Search (BFS) - visualization
- Provides an intuitive, easy-to-use API to draw graphics objects onto the screen.
- Provides debugging information about resource management.
- Manages freeing up used resources automatically.
- Ensure you have the latest version of AutoHotkey v2 installed.
- Clone or download this repository.
- Visit the example folder and run the files.
- There is a standalone file; you can rename it to GpGFX.ahk and use it. (optional)
Visit the example folder where you can find multiple files with comments.
A layer is a container for drawing operations. It holds shapes, text, and images that can be drawn onto the layer.
It is a transparent window and a GUI in AutoHotkey.
; A layer will be the size of the main display if no parameters are specified
lyr := Layer()
; Create a square with a size of 100 pixels, centered automatically by omitting the x and y parameters.
; The color will be either red or yellow.
sq := Square(, , 100, "Red|Yellow")
sq.str := "Hello, World!"
; Display the shape for a second
Draw(lyr)
Sleep(1000)
; Destroy the window and exit the script
End()Rectangle, Square, Ellipse, Pie, Polygon, Triangle, Point, Line, Lines, Arc, Bezier, Beziers
Rectangle, Square, Ellipse, Pie, Polygon, Triangle
Add text. The string will be auto-centered within the shape by default.
rect.str := "Hello, " A_UserNameAdd an image:
resize := 50 ; %
rect.AddImage(imgPath, resize, "Sepia")Change color:
; Using common formats
rect.Color := "#00FF00"
; Random color
rect.Color := ""
; Random color from a list of colors
rect.Color := "red|green|blue"
; Change to Linear Gradient Mode
rect.Color := ["red", "orange"]
; ... see the examplesChange fill and alpha properties to modify the shape, and so on.
I want to thank everyone who contributes to the AHK community.
-
iseahound: Graphics, Textrender, and ImagePut projects provided me guidance in many cases. Thank you for your work.
-
tic: for creating the original Gdip library.
-
Contributors: for contributing to the library AHKv2-Gdip
-
Special thanks to: G33kDude, Helgef, mcl, neogna2, robodesign, SKAN.
-
Finally, Lexikos for creating and maintaining AutoHotkey v2.
