This is an old revision of the document!
grabit unix gtf0
To use the gtf0.c program you do not need to compile it. Once you have edited and changed the code with a text editor and saved it, you can run ./gtf0.c to run it.
Afterwards you can use the mv command to move it to public_html.
It can be helpful to have a second terminal and a window showing your gtf0.png picture so that you can see your changes more quickly. Have your open .c file on one terminal, use the other terminal to run your .c file and to move the resulting .png file to public_html, and the window showing your picture so you can refresh it to see changes.
To view your picture you go into your file explorer where you put your Unix file and find the “gtf0.png” and then click on it to view your image.
Documentation: https://libgd.github.io/manuals/2.3.0/files/preamble-txt.html
API: https://libgd.github.io/manuals/2.3.0/index/Functions.html
You can make a color by declaring a new variable int colorName = 0; and then defining it like colorName = gdImageColor (image, 0x??, 0x??, 0x??);. The 0x?? is the amount of red, green, and blue (respectively) that is in your color. The 0x?? format is hexidecimal so the highest amount of each color would be 0xFF and the lowest would be 0x00.
A line can be drawn with the command gdImageLine (image, x, y, x2, y2, color);. x and y are the starting x and y positions, x2 and y2 are the ending x and y positions and color is which color you want it to be.
gdImageRectangle (image, x, y, x2, y2, color);
gdImageFill (image, x, y, color);